|
|
|
@ -1,5 +1,6 @@
|
|
|
|
|
package com.supervision.police.service.impl;
|
|
|
|
|
|
|
|
|
|
import cn.hutool.core.collection.CollUtil;
|
|
|
|
|
import com.baomidou.mybatisplus.core.conditions.Wrapper;
|
|
|
|
|
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
|
|
|
|
import com.baomidou.mybatisplus.core.metadata.IPage;
|
|
|
|
@ -68,30 +69,33 @@ public class ComDictionaryServiceImpl extends ServiceImpl<ComDictionaryMapper, C
|
|
|
|
|
*/
|
|
|
|
|
private Map<String, List<ComDictionary>> queryDictionary(DictionaryByTypeParam dictionaryByTypeParam) {
|
|
|
|
|
Map<String,List<ComDictionary>> resultMap = new HashMap<>();
|
|
|
|
|
List<String> typeList = new ArrayList<>();
|
|
|
|
|
if (dictionaryByTypeParam.getList() == null || dictionaryByTypeParam.getList().size() <=0) {
|
|
|
|
|
typeList = comDictionaryMapper.queryAllType();
|
|
|
|
|
} else {
|
|
|
|
|
typeList = dictionaryByTypeParam.getList();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
List<String> typeList = CollUtil.isEmpty(dictionaryByTypeParam.getList()) ?
|
|
|
|
|
comDictionaryMapper.queryAllType() : dictionaryByTypeParam.getList();
|
|
|
|
|
|
|
|
|
|
for (String dictType : typeList) {
|
|
|
|
|
List<ComDictionary> queryList = new ArrayList<>();
|
|
|
|
|
List<ComDictionary> queryList;
|
|
|
|
|
List<ComDictionary> otherList = new ArrayList<>();
|
|
|
|
|
ComDictionary comDictionary = new ComDictionary();
|
|
|
|
|
comDictionary.setType(dictType);
|
|
|
|
|
Wrapper<ComDictionary> wrapper = Wrappers.query(comDictionary);
|
|
|
|
|
queryList = this.comDictionaryMapper.selectList(wrapper);
|
|
|
|
|
changeTree(queryList,otherList);
|
|
|
|
|
if (otherList.size() > 1) {
|
|
|
|
|
if (dictionaryByTypeParam.getIsTree() != null && dictionaryByTypeParam.getIsTree() == 0) {
|
|
|
|
|
|
|
|
|
|
if (CollUtil.size(otherList) > 1) {
|
|
|
|
|
// 平铺数据
|
|
|
|
|
if (Integer.valueOf(0).equals(dictionaryByTypeParam.getIsTree())) {
|
|
|
|
|
resultMap.put(dictType,queryList);
|
|
|
|
|
}else {
|
|
|
|
|
// 树形数据
|
|
|
|
|
resultMap.put(dictType,otherList);
|
|
|
|
|
}
|
|
|
|
|
} else {
|
|
|
|
|
if (dictionaryByTypeParam.getIsTree() != null && dictionaryByTypeParam.getIsTree() == 0){
|
|
|
|
|
// 平铺数据
|
|
|
|
|
if (Integer.valueOf(0).equals(dictionaryByTypeParam.getIsTree())){
|
|
|
|
|
resultMap.put(dictType,otherList.get(0).getChild());
|
|
|
|
|
}else {
|
|
|
|
|
// 树形数据
|
|
|
|
|
resultMap.put(dictType,otherList);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
@ -129,7 +133,7 @@ public class ComDictionaryServiceImpl extends ServiceImpl<ComDictionaryMapper, C
|
|
|
|
|
// 先找到所有的一级菜单
|
|
|
|
|
for (ComDictionary comDictionary : queryList) {
|
|
|
|
|
// 一级菜单没有parentId
|
|
|
|
|
if (comDictionary.getPid() == null || comDictionary.getPid() == 0l) {
|
|
|
|
|
if (Long.valueOf(0L).equals(comDictionary.getPid())) {
|
|
|
|
|
resultList.add(comDictionary);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|