新增返回主键的新增方法
This commit is contained in:
parent
ca4aaa6119
commit
99f7cda2ae
@ -44,6 +44,25 @@ public interface IDataDictionaryService {
|
|||||||
*/
|
*/
|
||||||
SuccessResult saveDictionary(String token, DataDictionaryVO dictionaryVO) throws Exception;
|
SuccessResult saveDictionary(String token, DataDictionaryVO dictionaryVO) throws Exception;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 字典新增
|
||||||
|
*
|
||||||
|
* @param dictionaryVO
|
||||||
|
* @return 新增ID
|
||||||
|
* @throws Exception
|
||||||
|
*/
|
||||||
|
String saveDictionaryReturnId(DataDictionaryVO dictionaryVO) throws Exception;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 字典新增
|
||||||
|
*
|
||||||
|
* @param token
|
||||||
|
* @param dictionaryVO
|
||||||
|
* @return 新增ID
|
||||||
|
* @throws Exception
|
||||||
|
*/
|
||||||
|
String saveDictionaryReturnId(String token, DataDictionaryVO dictionaryVO) throws Exception;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 字典删除
|
* 字典删除
|
||||||
*
|
*
|
||||||
|
@ -52,7 +52,18 @@ public class DataDictionaryServiceImpl extends AbstractService implements IDataD
|
|||||||
return new SuccessResult();
|
return new SuccessResult();
|
||||||
}
|
}
|
||||||
|
|
||||||
private void saveDictionaryInfo(String token, DataDictionaryVO dictionaryVO) throws Exception {
|
@Override
|
||||||
|
public String saveDictionaryReturnId(DataDictionaryVO dictionaryVO) throws Exception {
|
||||||
|
return saveDictionaryInfo(null, dictionaryVO);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String saveDictionaryReturnId(String token, DataDictionaryVO dictionaryVO) throws Exception {
|
||||||
|
return saveDictionaryInfo(token, dictionaryVO);
|
||||||
|
}
|
||||||
|
|
||||||
|
private String saveDictionaryInfo(String token, DataDictionaryVO dictionaryVO) throws Exception {
|
||||||
|
String uuid = UUIDUtil.getUUID();
|
||||||
String parentCode = null;
|
String parentCode = null;
|
||||||
String dictionaryParentId = dictionaryVO.getDictionaryParentId();
|
String dictionaryParentId = dictionaryVO.getDictionaryParentId();
|
||||||
if (!StringUtils.equals(dictionaryParentId, ISystemConstant.TREE_BASE_ROOT_ID_VALUE)) {
|
if (!StringUtils.equals(dictionaryParentId, ISystemConstant.TREE_BASE_ROOT_ID_VALUE)) {
|
||||||
@ -62,13 +73,14 @@ public class DataDictionaryServiceImpl extends AbstractService implements IDataD
|
|||||||
String dictionaryCode = getCode(parentCode, dictionaryParentId);
|
String dictionaryCode = getCode(parentCode, dictionaryParentId);
|
||||||
Map<String, Object> params = HashMapUtil.beanToMap(dictionaryVO);
|
Map<String, Object> params = HashMapUtil.beanToMap(dictionaryVO);
|
||||||
params.put("dictionaryCode", dictionaryCode);
|
params.put("dictionaryCode", dictionaryCode);
|
||||||
params.put("dictionaryId", UUIDUtil.getUUID());
|
params.put("dictionaryId", uuid);
|
||||||
if (StringUtils.isBlank(token)) {
|
if (StringUtils.isBlank(token)) {
|
||||||
setSaveInfo(params);
|
setSaveInfo(params);
|
||||||
} else {
|
} else {
|
||||||
setSaveInfo(token, params);
|
setSaveInfo(token, params);
|
||||||
}
|
}
|
||||||
dictionaryDao.saveDictionary(params);
|
dictionaryDao.saveDictionary(params);
|
||||||
|
return uuid;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
Loading…
Reference in New Issue
Block a user