From 2822626c4f82e45159781f444e53955da67ca6c2 Mon Sep 17 00:00:00 2001 From: liyongde <1419499670@qq.com> Date: Mon, 19 Dec 2022 09:17:37 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BB=A3=E7=A0=81=E6=9B=B4=E6=96=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../service/dict/impl/SysDictServiceImpl.java | 27 ++++++++++--------- nladmin-ui/src/components/Crud/crud.js | 1 - nladmin-ui/src/views/system/dict/index.vue | 2 +- 3 files changed, 15 insertions(+), 15 deletions(-) diff --git a/nladmin-system/nlsso-server/src/main/java/org/nl/system/service/dict/impl/SysDictServiceImpl.java b/nladmin-system/nlsso-server/src/main/java/org/nl/system/service/dict/impl/SysDictServiceImpl.java index 3e0c21f..e564c07 100644 --- a/nladmin-system/nlsso-server/src/main/java/org/nl/system/service/dict/impl/SysDictServiceImpl.java +++ b/nladmin-system/nlsso-server/src/main/java/org/nl/system/service/dict/impl/SysDictServiceImpl.java @@ -129,24 +129,25 @@ public class SysDictServiceImpl extends ServiceImpl impleme .eq(Dict::getCode, dict.getCode())); if (ObjectUtil.isNotEmpty(one)) throw new BadRequestException("标签[" + dict.getLabel() + "]已存在"); // 判断是否有空的值 - Dict selectOne = sysDictMapper.selectOne(new LambdaQueryWrapper().eq(Dict::getCode, dict.getCode())); - if (ObjectUtil.isEmpty(selectOne.getLabel())) { + List selectOne = sysDictMapper.selectList(new LambdaQueryWrapper().eq(Dict::getCode, dict.getCode())); + Dict dic = selectOne.get(0); + if (ObjectUtil.isEmpty(dic.getLabel())) { // 空就赋值 - selectOne.setCode(dict.getCode()); - selectOne.setLabel(dict.getLabel()); - selectOne.setValue(dict.getValue()); - selectOne.setDictSort(dict.getDictSort()); - selectOne.setDictType(dict.getDictType()); - selectOne.setPara1(dict.getPara1()); - selectOne.setPara2(dict.getPara2()); - selectOne.setPara3(dict.getPara3()); - sysDictMapper.updateById(selectOne); + dic.setCode(dict.getCode()); + dic.setLabel(dict.getLabel()); + dic.setValue(dict.getValue()); + dic.setDictSort(dict.getDictSort()); + dic.setDictType(dict.getDictType()); + dic.setPara1(dict.getPara1()); + dic.setPara2(dict.getPara2()); + dic.setPara3(dict.getPara3()); + sysDictMapper.updateById(dic); return; } // 插入新的数据 dict.setDictId(IdUtil.getSnowflake(1, 1).nextIdStr()); - dict.setCode(selectOne.getCode()); - dict.setName(selectOne.getName()); + dict.setCode(dic.getCode()); + dict.setName(dic.getName()); dict.setCreateId(SecurityUtils.getCurrentUserId()); dict.setCreateName(SecurityUtils.getCurrentNickName()); dict.setCreateTime(DateUtil.now()); diff --git a/nladmin-ui/src/components/Crud/crud.js b/nladmin-ui/src/components/Crud/crud.js index 4544ff1..a307e48 100644 --- a/nladmin-ui/src/components/Crud/crud.js +++ b/nladmin-ui/src/components/Crud/crud.js @@ -140,7 +140,6 @@ function CRUD(options) { crud.loading = true // 请求数据 initData(crud.url, crud.getQueryParams()).then(data => { - console.log(data) const table = crud.getTable() if (table && table.lazy) { // 懒加载子节点数据,清掉已加载的数据 table.store.states.treeData = {} diff --git a/nladmin-ui/src/views/system/dict/index.vue b/nladmin-ui/src/views/system/dict/index.vue index 91e65bb..76bbe73 100644 --- a/nladmin-ui/src/views/system/dict/index.vue +++ b/nladmin-ui/src/views/system/dict/index.vue @@ -77,7 +77,7 @@