微调
This commit is contained in:
@@ -168,6 +168,7 @@ public class AdPlanServiceImpl extends ServiceImpl<AdPlanMapper, AdPlan> impleme
|
||||
child.put("id", adPlan.getId());
|
||||
child.put("pid", adPlan.getFatherPlanId());
|
||||
child.put("name", adPlan.getName());
|
||||
child.put("timeCheck",adPlan.getTimeCheck());
|
||||
children.add(child);
|
||||
});
|
||||
}
|
||||
|
||||
@@ -5,6 +5,7 @@ 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;
|
||||
@@ -51,6 +52,7 @@ public class DictTreeServiceImpl extends ServiceImpl<DictTreeMapper, DictTree> i
|
||||
@Override
|
||||
@Transactional(rollbackFor = {Exception.class})
|
||||
public boolean addDictTree(DictTreeParam dictTreeParam) {
|
||||
checkRepeat(dictTreeParam,false);
|
||||
boolean result;
|
||||
DictTree dictTree = new DictTree();
|
||||
BeanUtils.copyProperties(dictTreeParam, dictTree);
|
||||
@@ -73,6 +75,7 @@ public class DictTreeServiceImpl extends ServiceImpl<DictTreeMapper, DictTree> i
|
||||
@Override
|
||||
@Transactional(rollbackFor = {Exception.class})
|
||||
public boolean updateDictTree(DictTreeParam.UpdateParam param) {
|
||||
checkRepeat(param,true);
|
||||
boolean result;
|
||||
DictTree dictTree = new DictTree();
|
||||
BeanUtils.copyProperties(param, dictTree);
|
||||
@@ -165,6 +168,20 @@ public class DictTreeServiceImpl extends ServiceImpl<DictTreeMapper, DictTree> i
|
||||
// lambdaQueryWrapper.eq(DictTree::getState, DictConst.ENABLE).eq(DictTree::getType, type);
|
||||
// return this.list(lambdaQueryWrapper);
|
||||
// }
|
||||
private void checkRepeat(DictTreeParam dictTreeParam,boolean isExcludeSelf){
|
||||
LambdaQueryWrapper<DictTree> wrapper = new LambdaQueryWrapper<>();
|
||||
wrapper.eq(DictTree::getCode, dictTreeParam.getCode())
|
||||
.eq(DictTree::getState, DataStateEnum.ENABLE.getCode());
|
||||
if(isExcludeSelf){
|
||||
if(dictTreeParam instanceof DictTreeParam.UpdateParam){
|
||||
wrapper.ne(DictTree::getId, ((DictTreeParam.UpdateParam) dictTreeParam).getId());
|
||||
}
|
||||
}
|
||||
int count = this.count(wrapper);
|
||||
if (count > 0) {
|
||||
throw new BusinessException(SystemResponseEnum.CODE_REPEAT);
|
||||
}
|
||||
}
|
||||
|
||||
private List<DictTree> filterTreeByName(List<DictTree> tree, String keyword) {
|
||||
if (CollectionUtils.isEmpty(tree) || !StrUtil.isNotBlank(keyword)) {
|
||||
|
||||
@@ -64,8 +64,8 @@ public enum SystemResponseEnum {
|
||||
LOG_EXCEPTION_TIME("A0302", "导入旧日志文件异常:缺少时间范围"),
|
||||
DELETE_DATA("A0303", "导入旧日志文件异常:删除数据失败"),
|
||||
MULTIPLE_CLICKS_LOG_FILE_WRITER("A0304", "当前文件备份数据未结束,请勿多次点击"),
|
||||
MULTIPLE_CLICKS_RECOVER_LOG_FILE("A0303", "当前文件恢复数据未结束,请勿多次点击")
|
||||
;
|
||||
MULTIPLE_CLICKS_RECOVER_LOG_FILE("A0303", "当前文件恢复数据未结束,请勿多次点击"),
|
||||
CODE_REPEAT("A0305","编码重复" );
|
||||
|
||||
private final String code;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user