|
|
|
|
@@ -7,7 +7,6 @@ import cn.hutool.core.util.StrUtil;
|
|
|
|
|
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
|
|
|
|
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
|
|
|
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
|
|
|
|
import com.njcn.common.pojo.enums.common.DataStateEnum;
|
|
|
|
|
import com.njcn.common.pojo.exception.BusinessException;
|
|
|
|
|
import com.njcn.gather.system.dictionary.mapper.DictTreeMapper;
|
|
|
|
|
import com.njcn.gather.system.dictionary.pojo.param.DictTreeParam;
|
|
|
|
|
@@ -82,7 +81,7 @@ public class DictTreeServiceImpl extends ServiceImpl<DictTreeMapper, DictTree> i
|
|
|
|
|
public boolean updateDictTree(DictTreeParam.UpdateParam param) {
|
|
|
|
|
param.setName(param.getName().trim());
|
|
|
|
|
DictTree dictTree = this.getById(param.getId());
|
|
|
|
|
if("975f63baeb6f653c54fca226a9ae36ca".equals(param.getId()) || dictTree.getPids().contains("975f63baeb6f653c54fca226a9ae36ca")){
|
|
|
|
|
if ("975f63baeb6f653c54fca226a9ae36ca".equals(param.getId()) || dictTree.getPids().contains("975f63baeb6f653c54fca226a9ae36ca")) {
|
|
|
|
|
throw new BusinessException(SystemResponseEnum.CAN_NOT_UPDATE_USED_DICT);
|
|
|
|
|
}
|
|
|
|
|
checkRepeat(param, true);
|
|
|
|
|
@@ -96,7 +95,7 @@ public class DictTreeServiceImpl extends ServiceImpl<DictTreeMapper, DictTree> i
|
|
|
|
|
public boolean deleteDictTree(String id) {
|
|
|
|
|
boolean result = false;
|
|
|
|
|
DictTree dictTree = this.getById(id);
|
|
|
|
|
if("975f63baeb6f653c54fca226a9ae36ca".equals(id) || dictTree.getPids().contains("975f63baeb6f653c54fca226a9ae36ca")){
|
|
|
|
|
if ("975f63baeb6f653c54fca226a9ae36ca".equals(id) || dictTree.getPids().contains("975f63baeb6f653c54fca226a9ae36ca")) {
|
|
|
|
|
throw new BusinessException(SystemResponseEnum.CAN_NOT_DELETE_USED_DICT);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@@ -139,6 +138,14 @@ public class DictTreeServiceImpl extends ServiceImpl<DictTreeMapper, DictTree> i
|
|
|
|
|
);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
public List<DictTree> listByFatherIds(List<String> fatherIdList) {
|
|
|
|
|
if (CollUtil.isNotEmpty(fatherIdList)) {
|
|
|
|
|
return this.lambdaQuery().in(DictTree::getPid, fatherIdList).eq(DictTree::getState, DictConst.ENABLE).list();
|
|
|
|
|
}
|
|
|
|
|
return null;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private void checkRepeat(DictTreeParam dictTreeParam, boolean isExcludeSelf) {
|
|
|
|
|
LambdaQueryWrapper<DictTree> wrapper = new LambdaQueryWrapper<>();
|
|
|
|
|
wrapper.eq(DictTree::getPid, dictTreeParam.getPid()) // 同一父节点下不能有相同的code
|
|
|
|
|
|