|
|
@@ -3,11 +3,11 @@ package com.sckw.system.service;
|
|
|
import java.util.Date;
|
|
|
|
|
|
import java.util.*;
|
|
|
+import java.util.stream.Collectors;
|
|
|
|
|
|
import cn.hutool.core.collection.CollectionUtil;
|
|
|
import com.sckw.core.exception.SystemException;
|
|
|
import com.sckw.core.model.constant.Global;
|
|
|
-import com.sckw.core.model.enums.ClientTypeEnum;
|
|
|
import com.sckw.core.model.enums.MenuTypeEnum;
|
|
|
import com.sckw.core.model.enums.SystemTypeEnum;
|
|
|
import com.sckw.core.utils.BeanUtils;
|
|
|
@@ -495,12 +495,33 @@ public class KwsMenuService {
|
|
|
* @author: czh
|
|
|
* @date: 2023/6/13
|
|
|
*/
|
|
|
- public List<KwsMenu> queryMapping(Long id) {
|
|
|
+ public List<QueryMappingResVo> queryMapping(Long id) {
|
|
|
List<KwsMenuMapping> kwsMenuMappings = kwsMenuMappingDao.selectByMenuId(id);
|
|
|
if (CollectionUtils.isEmpty(kwsMenuMappings)) {
|
|
|
return Collections.emptyList();
|
|
|
}
|
|
|
|
|
|
- return kwsMenuDao.selectByKeys(kwsMenuMappings.stream().map(KwsMenuMapping::getMappingId).toList());
|
|
|
+
|
|
|
+ List<KwsMenu> kwsMenus = kwsMenuDao.selectByKeys(kwsMenuMappings.stream().map(KwsMenuMapping::getMappingId).toList());
|
|
|
+ Map<Long, List<KwsMenu>> collect = kwsMenus.stream().collect(Collectors.groupingBy(KwsMenu::getParentId));
|
|
|
+
|
|
|
+ List<QueryMappingResVo> list = new ArrayList<>();
|
|
|
+ for (KwsMenuMapping kwsMenuMapping : kwsMenuMappings) {
|
|
|
+ KwsMenu kwsMenu = kwsMenuDao.selectByKey(kwsMenuMapping.getMappingId());
|
|
|
+ if (Objects.nonNull(kwsMenu)) {
|
|
|
+ QueryMappingResVo queryMappingResVo = new QueryMappingResVo();
|
|
|
+ queryMappingResVo.setId(kwsMenuMapping.getId());
|
|
|
+ queryMappingResVo.setRemark(kwsMenu.getRemark());
|
|
|
+ queryMappingResVo.setName(kwsMenu.getName());
|
|
|
+ queryMappingResVo.setPerms(kwsMenu.getPerms());
|
|
|
+ queryMappingResVo.setType(kwsMenu.getType());
|
|
|
+ queryMappingResVo.setSort(kwsMenu.getSort());
|
|
|
+ queryMappingResVo.setMenuId(kwsMenuMapping.getMenuId());
|
|
|
+ queryMappingResVo.setMappingMenuId(kwsMenuMapping.getMappingId());
|
|
|
+ list.add(queryMappingResVo);
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ return list;
|
|
|
}
|
|
|
}
|