diff --git a/cloud-common-plugin-dictionary/src/main/java/com/cm/common/plugin/service/datadictionary/IDataDictionaryService.java b/cloud-common-plugin-dictionary/src/main/java/com/cm/common/plugin/service/datadictionary/IDataDictionaryService.java index 75267fd..ac3a417 100644 --- a/cloud-common-plugin-dictionary/src/main/java/com/cm/common/plugin/service/datadictionary/IDataDictionaryService.java +++ b/cloud-common-plugin-dictionary/src/main/java/com/cm/common/plugin/service/datadictionary/IDataDictionaryService.java @@ -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; + /** * 字典删除 * diff --git a/cloud-common-plugin-dictionary/src/main/java/com/cm/common/plugin/service/datadictionary/impl/DataDictionaryServiceImpl.java b/cloud-common-plugin-dictionary/src/main/java/com/cm/common/plugin/service/datadictionary/impl/DataDictionaryServiceImpl.java index 6f89ba1..9305e12 100644 --- a/cloud-common-plugin-dictionary/src/main/java/com/cm/common/plugin/service/datadictionary/impl/DataDictionaryServiceImpl.java +++ b/cloud-common-plugin-dictionary/src/main/java/com/cm/common/plugin/service/datadictionary/impl/DataDictionaryServiceImpl.java @@ -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 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