Merge remote-tracking branch 'origin/master'

This commit is contained in:
zhangzhiqiang
2022-12-19 09:23:35 +08:00
3 changed files with 15 additions and 15 deletions

View File

@@ -129,24 +129,25 @@ public class SysDictServiceImpl extends ServiceImpl<SysDictMapper, Dict> impleme
.eq(Dict::getCode, dict.getCode())); .eq(Dict::getCode, dict.getCode()));
if (ObjectUtil.isNotEmpty(one)) throw new BadRequestException("标签[" + dict.getLabel() + "]已存在"); if (ObjectUtil.isNotEmpty(one)) throw new BadRequestException("标签[" + dict.getLabel() + "]已存在");
// 判断是否有空的值 // 判断是否有空的值
Dict selectOne = sysDictMapper.selectOne(new LambdaQueryWrapper<Dict>().eq(Dict::getCode, dict.getCode())); List<Dict> selectOne = sysDictMapper.selectList(new LambdaQueryWrapper<Dict>().eq(Dict::getCode, dict.getCode()));
if (ObjectUtil.isEmpty(selectOne.getLabel())) { Dict dic = selectOne.get(0);
if (ObjectUtil.isEmpty(dic.getLabel())) {
// 空就赋值 // 空就赋值
selectOne.setCode(dict.getCode()); dic.setCode(dict.getCode());
selectOne.setLabel(dict.getLabel()); dic.setLabel(dict.getLabel());
selectOne.setValue(dict.getValue()); dic.setValue(dict.getValue());
selectOne.setDictSort(dict.getDictSort()); dic.setDictSort(dict.getDictSort());
selectOne.setDictType(dict.getDictType()); dic.setDictType(dict.getDictType());
selectOne.setPara1(dict.getPara1()); dic.setPara1(dict.getPara1());
selectOne.setPara2(dict.getPara2()); dic.setPara2(dict.getPara2());
selectOne.setPara3(dict.getPara3()); dic.setPara3(dict.getPara3());
sysDictMapper.updateById(selectOne); sysDictMapper.updateById(dic);
return; return;
} }
// 插入新的数据 // 插入新的数据
dict.setDictId(IdUtil.getSnowflake(1, 1).nextIdStr()); dict.setDictId(IdUtil.getSnowflake(1, 1).nextIdStr());
dict.setCode(selectOne.getCode()); dict.setCode(dic.getCode());
dict.setName(selectOne.getName()); dict.setName(dic.getName());
dict.setCreateId(SecurityUtils.getCurrentUserId()); dict.setCreateId(SecurityUtils.getCurrentUserId());
dict.setCreateName(SecurityUtils.getCurrentNickName()); dict.setCreateName(SecurityUtils.getCurrentNickName());
dict.setCreateTime(DateUtil.now()); dict.setCreateTime(DateUtil.now());

View File

@@ -140,7 +140,6 @@ function CRUD(options) {
crud.loading = true crud.loading = true
// 请求数据 // 请求数据
initData(crud.url, crud.getQueryParams()).then(data => { initData(crud.url, crud.getQueryParams()).then(data => {
console.log(data)
const table = crud.getTable() const table = crud.getTable()
if (table && table.lazy) { // 懒加载子节点数据,清掉已加载的数据 if (table && table.lazy) { // 懒加载子节点数据,清掉已加载的数据
table.store.states.treeData = {} table.store.states.treeData = {}

View File

@@ -77,7 +77,7 @@
<script> <script>
import checkPermission from '@/utils/permission' import checkPermission from '@/utils/permission'
import dictDetail from './dictDetail' import dictDetail from './dictDetail.vue'
import crudDict from '@/views/system/dict/dict' import crudDict from '@/views/system/dict/dict'
import CRUD, { presenter, header, form } from '@crud/crud' import CRUD, { presenter, header, form } from '@crud/crud'