From 99f7cda2ae5d401e662f83545148da6b0c5c5a1a Mon Sep 17 00:00:00 2001 From: wenc000 <450292408@qq.com> Date: Tue, 7 Apr 2020 14:05:12 +0800 Subject: [PATCH] =?UTF-8?q?=E6=96=B0=E5=A2=9E=E8=BF=94=E5=9B=9E=E4=B8=BB?= =?UTF-8?q?=E9=94=AE=E7=9A=84=E6=96=B0=E5=A2=9E=E6=96=B9=E6=B3=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../IDataDictionaryService.java | 19 +++++++++++++++++++ .../impl/DataDictionaryServiceImpl.java | 16 ++++++++++++++-- 2 files changed, 33 insertions(+), 2 deletions(-) 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