|
|
@@ -1,6 +1,7 @@
|
|
|
package com.xunmei.system.service.impl;
|
|
|
|
|
|
import cn.hutool.core.lang.Pair;
|
|
|
+import cn.hutool.core.util.ObjectUtil;
|
|
|
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
|
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
|
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
|
|
@@ -72,31 +73,26 @@ public class SysMultiLayerDictionaryServiceImpl extends ServiceImpl<SysMultiLaye
|
|
|
public TableDataInfo<SysMultiLayerDictionary> selectTableList(SysMultiLayerDictionaryDto para) {
|
|
|
LambdaQueryWrapper<SysMultiLayerDictionary> wrapper = new LambdaQueryWrapper<>();
|
|
|
wrapper.eq(SysMultiLayerDictionary::getDeleted, 0);
|
|
|
- if(para.getParentId()==-1 && StringUtils.isNotEmpty(para.getType()))
|
|
|
- {
|
|
|
+ if (para.getParentId() == -1 && StringUtils.isNotEmpty(para.getType())) {
|
|
|
wrapper.eq(SysMultiLayerDictionary::getType, para.getType());
|
|
|
}
|
|
|
- if(StringUtils.isNotEmpty(para.getPath()))
|
|
|
- {
|
|
|
+ if (StringUtils.isNotEmpty(para.getPath())) {
|
|
|
wrapper.likeRight(SysMultiLayerDictionary::getPath, para.getPath());
|
|
|
}
|
|
|
- if(StringUtils.isEmpty(para.getPath()) && StringUtils.isEmpty(para.getType()) && para.getParentId()!=-1 )
|
|
|
- {
|
|
|
+ if (StringUtils.isEmpty(para.getPath()) && StringUtils.isEmpty(para.getType()) && para.getParentId() != -1) {
|
|
|
wrapper.eq(SysMultiLayerDictionary::getParentId, para.getParentId());
|
|
|
}
|
|
|
|
|
|
- if(StringUtils.isNotEmpty(para.getName()))
|
|
|
- {
|
|
|
+ if (StringUtils.isNotEmpty(para.getName())) {
|
|
|
wrapper.like(SysMultiLayerDictionary::getName, para.getName());
|
|
|
}
|
|
|
- if(StringUtils.isNotEmpty(para.getStatus()))
|
|
|
- {
|
|
|
+ if (StringUtils.isNotEmpty(para.getStatus())) {
|
|
|
wrapper.eq(SysMultiLayerDictionary::getStatus, para.getStatus());
|
|
|
}
|
|
|
Page<SysMultiLayerDictionary> page;
|
|
|
- if (para.getPageNum() != null &¶.getPageSize() != null){
|
|
|
+ if (para.getPageNum() != null && para.getPageSize() != null) {
|
|
|
page = new Page<>(para.getPageNum(), para.getPageSize());
|
|
|
- }else{
|
|
|
+ } else {
|
|
|
page = new Page<>();
|
|
|
}
|
|
|
|
|
|
@@ -113,4 +109,15 @@ public class SysMultiLayerDictionaryServiceImpl extends ServiceImpl<SysMultiLaye
|
|
|
final List<SysMultiLayerDictionary> dictionaryList = baseMapper.selectList(wrapper);
|
|
|
return dictionaryList.stream().map(item -> Pair.of(item.getId(), item.getName())).collect(Collectors.toList());
|
|
|
}
|
|
|
+
|
|
|
+ @Override
|
|
|
+ public boolean checkRepeat(String name, String type, Long id) {
|
|
|
+ final LambdaQueryWrapper<SysMultiLayerDictionary> wrapper = new LambdaQueryWrapper<>();
|
|
|
+ wrapper.eq(SysMultiLayerDictionary::getDeleted, 0);
|
|
|
+ wrapper.eq(SysMultiLayerDictionary::getName, name);
|
|
|
+ wrapper.eq(SysMultiLayerDictionary::getType, type);
|
|
|
+ wrapper.ne(ObjectUtil.isNotNull(id), SysMultiLayerDictionary::getId, id);
|
|
|
+ final Long count = baseMapper.selectCount(wrapper);
|
|
|
+ return count != null && count < 1;
|
|
|
+ }
|
|
|
}
|