新增返回主键的新增方法
This commit is contained in:
parent
ca4aaa6119
commit
99f7cda2ae
@ -44,6 +44,25 @@ public interface IDataDictionaryService {
|
||||
*/
|
||||
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();
|
||||
}
|
||||
|
||||
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 dictionaryParentId = dictionaryVO.getDictionaryParentId();
|
||||
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);
|
||||
Map<String, Object> params = HashMapUtil.beanToMap(dictionaryVO);
|
||||
params.put("dictionaryCode", dictionaryCode);
|
||||
params.put("dictionaryId", UUIDUtil.getUUID());
|
||||
params.put("dictionaryId", uuid);
|
||||
if (StringUtils.isBlank(token)) {
|
||||
setSaveInfo(params);
|
||||
} else {
|
||||
setSaveInfo(token, params);
|
||||
}
|
||||
dictionaryDao.saveDictionary(params);
|
||||
return uuid;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
Loading…
Reference in New Issue
Block a user