linwe
2023-11-25 8400a67289b214b83a20484410fff96d236c6d49
src/main/java/org/springblade/modules/system/service/impl/MenuServiceImpl.java
@@ -16,6 +16,7 @@
 */
package org.springblade.modules.system.service.impl;
import com.alibaba.fastjson.JSON;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
@@ -79,7 +80,14 @@
      if (Func.isEmpty(Func.toStr(param.get(PARENT_ID)))) {
         parentId = null;
      }
      return baseMapper.lazyList(parentId, param);
      List<MenuVO> menuVOS = baseMapper.lazyList(parentId, param);
      for (MenuVO menuVO : menuVOS) {
         if(StringUtils.isNotBlank(menuVO.getLabelStr())){
            List<List<String>> lists = (List<List<String>>)JSON.parse(menuVO.getLabelStr() );
            menuVO.setLabelList(lists);
         }
      }
      return menuVOS;
   }
   @Override
@@ -87,7 +95,14 @@
      if (Func.isEmpty(Func.toStr(param.get(PARENT_ID)))) {
         parentId = null;
      }
      return baseMapper.lazyMenuList(parentId, param);
      List<MenuVO> menuVOS = baseMapper.lazyList(parentId, param);
      for (MenuVO menuVO : menuVOS) {
         if(StringUtils.isNotBlank(menuVO.getLabelStr())){
            List<List<String>> lists = (List<List<String>>)JSON.parse(menuVO.getLabelStr() );
            menuVO.setLabelList(lists);
         }
      }
      return menuVOS;
   }
   public static final List<Integer> list1 = Arrays.asList(1, 2, 3, 4, 5, 6, 11, null);
@@ -131,6 +146,28 @@
                  List<Integer> integerList = Arrays.stream(split).map(Integer::valueOf).collect(Collectors.toList());
                  Collection<? extends Serializable> union = CollectionUtils.intersection(integerList, integers);
                  if (union.size() == 0) {
                     iterator.remove();
                  }
               } else {
                  if (next.getName().trim().equals("标签报事")) {
                     iterator.remove();
                  }
                  if (next.getName().trim().equals("取保候审")) {
                     iterator.remove();
                  }
                  if (next.getName().trim().equals("打金店")) {
                     iterator.remove();
                  }
                  if (next.getName().trim().equals("旅馆安全")) {
                     iterator.remove();
                  }
                  if (next.getName().trim().equals("二手车交易")) {
                     iterator.remove();
                  }
                  if (next.getName().trim().equals("二手手机维修")) {
                     iterator.remove();
                  }
                  if (next.getName().trim().equals("校园安全")) {
                     iterator.remove();
                  }
               }
@@ -315,7 +352,7 @@
   }
   @Override
   public boolean submit(Menu menu) {
   public boolean submit(MenuDTO menu) {
      LambdaQueryWrapper<Menu> menuQueryWrapper = Wrappers.lambdaQuery();
      if (menu.getId() == null) {
         menuQueryWrapper.eq(Menu::getCode, menu.getCode()).or(
@@ -341,6 +378,13 @@
            throw new ServiceException("父节点只可选择菜单类型!");
         }
      }
      menu.setLabelStr(JSON.toJSONString(menu.getLabelList()));
      List<List<String>> labelList = menu.getLabelList();
      StringBuffer stringBuffer = new StringBuffer();
      for (List<String> strings : labelList) {
         stringBuffer.append(strings.get(strings.size()-1)).append(",");
      }
      menu.setLabelId(stringBuffer.toString());
      menu.setIsDeleted(BladeConstant.DB_NOT_DELETED);
      return saveOrUpdate(menu);
   }