代码更新
This commit is contained in:
@@ -129,24 +129,25 @@ public class SysDictServiceImpl extends ServiceImpl<SysDictMapper, Dict> impleme
|
||||
.eq(Dict::getCode, dict.getCode()));
|
||||
if (ObjectUtil.isNotEmpty(one)) throw new BadRequestException("标签[" + dict.getLabel() + "]已存在");
|
||||
// 判断是否有空的值
|
||||
Dict selectOne = sysDictMapper.selectOne(new LambdaQueryWrapper<Dict>().eq(Dict::getCode, dict.getCode()));
|
||||
if (ObjectUtil.isEmpty(selectOne.getLabel())) {
|
||||
List<Dict> selectOne = sysDictMapper.selectList(new LambdaQueryWrapper<Dict>().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());
|
||||
|
||||
@@ -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 = {}
|
||||
|
||||
@@ -77,7 +77,7 @@
|
||||
|
||||
<script>
|
||||
import checkPermission from '@/utils/permission'
|
||||
import dictDetail from './dictDetail'
|
||||
import dictDetail from './dictDetail.vue'
|
||||
import crudDict from '@/views/system/dict/dict'
|
||||
|
||||
import CRUD, { presenter, header, form } from '@crud/crud'
|
||||
|
||||
Reference in New Issue
Block a user