| | |
| | | |
| | | import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; |
| | | import com.baomidou.mybatisplus.core.toolkit.Wrappers; |
| | | import com.whyc.constant.YamlProperties; |
| | | import com.whyc.dto.Response; |
| | | import com.whyc.mapper.MenuMapper; |
| | | import com.whyc.pojo.Menu; |
| | | import org.springframework.stereotype.Service; |
| | |
| | | List<Menu> resultMenuList = new LinkedList<>(); |
| | | |
| | | QueryWrapper<Menu> wrapper = Wrappers.query(); |
| | | wrapper.eq("enableduse",1); |
| | | //wrapper.eq("enableduse",1); |
| | | List<Menu> menuList = mapper.selectList(wrapper); |
| | | Map<Integer, List<Menu>> collect = menuList.stream().collect(Collectors.groupingBy(Menu::getMenuId)); |
| | | Collection<List<Menu>> values = collect.values(); |
| | |
| | | return resultMenuList; |
| | | } |
| | | |
| | | public void updateMenuList(List<Menu> menuList) { |
| | | mapper.updateMenuList(menuList); |
| | | public Response updateMenuList(List<Menu> menuList) { |
| | | List<Menu> allMenu = new LinkedList<>(); |
| | | for (Menu menu : menuList){ |
| | | allMenu.add(menu); |
| | | if (menu.getChildrens().size()!=0){ |
| | | allMenu.addAll(menu.getChildrens()); |
| | | } |
| | | } |
| | | //todo 国网菜单需要进行审核 |
| | | if(2 == YamlProperties.systemType) { |
| | | |
| | | } |
| | | //先删除所有再添加 |
| | | mapper.deleteMenuAll(); |
| | | int flag = mapper.insertBatchSomeColumn(allMenu); |
| | | return new Response().set(1,flag>0?true:false,"更新成功"); |
| | | } |
| | | } |