| | |
| | | import com.xcong.farmer.cms.modules.system.dto.AdminUpdateMenuDto; |
| | | import com.xcong.farmer.cms.modules.system.entity.MenuEntity; |
| | | import com.xcong.farmer.cms.modules.system.entity.RoleMenuEntity; |
| | | import com.xcong.farmer.cms.modules.system.entity.UserEntity; |
| | | import com.xcong.farmer.cms.modules.system.entity.UserRoleEntity; |
| | | import com.xcong.farmer.cms.modules.system.mapper.MenuMapper; |
| | | import com.xcong.farmer.cms.modules.system.mapper.RoleMenuMapper; |
| | | import com.xcong.farmer.cms.modules.system.service.IMenuService; |
| | | import com.xcong.farmer.cms.modules.system.util.LoginUserUtil; |
| | | import com.xcong.farmer.cms.modules.system.vo.AdminMenuVo; |
| | | import com.xcong.farmer.cms.modules.system.vo.AdminSeeMenuInfoVo; |
| | | import lombok.extern.slf4j.Slf4j; |
| | |
| | | @Override |
| | | public Result getMenuInPage(AdminMenuDto adminMenuDto) { |
| | | Page<AdminMenuVo> page = new Page<>(adminMenuDto.getPageNum(), adminMenuDto.getPageSize()); |
| | | UserEntity userlogin = LoginUserUtil.getLoginUser(); |
| | | MenuEntity menuEntity = new MenuEntity(); |
| | | menuEntity.setParentId(MenuEntity.PARENTID_DEFAULT); |
| | | menuEntity.setBelongId(userlogin.getBelongId()==null?0L:userlogin.getBelongId()); |
| | | IPage<AdminMenuVo> list = this.baseMapper.selectAdminMenuVoInPage(page,menuEntity); |
| | | List<AdminMenuVo> records = list.getRecords(); |
| | | if(CollUtil.isNotEmpty(records)){ |
| | |
| | | @Override |
| | | @Transactional |
| | | public Result addMenu(AdminAddMenuDto adminAddMenuDto) { |
| | | UserEntity userlogin = LoginUserUtil.getLoginUser(); |
| | | long belongId = userlogin.getBelongId() == null ? 0L : userlogin.getBelongId(); |
| | | String menuName = adminAddMenuDto.getMenuName(); |
| | | if(StrUtil.isEmpty(menuName)){ |
| | | return Result.fail("请输入菜单名称"); |
| | |
| | | if(StrUtil.isNotEmpty(routeUrl)){ |
| | | menuEntity.setRouteUrl(routeUrl); |
| | | } |
| | | menuEntity.setBelongId(belongId); |
| | | this.baseMapper.insert(menuEntity); |
| | | return Result.ok("新增成功"); |
| | | } |
| | |
| | | |
| | | @Override |
| | | public Result getMenuInList() { |
| | | List<AdminMenuVo> records = this.baseMapper.selectAdminMenuVoInListByParentId(MenuEntity.PARENTID_DEFAULT); |
| | | UserEntity userlogin = LoginUserUtil.getLoginUser(); |
| | | long belongId = userlogin.getBelongId() == null ? 0L : userlogin.getBelongId(); |
| | | List<AdminMenuVo> records = this.baseMapper.selectAdminMenuVoInListByParentId(MenuEntity.PARENTID_DEFAULT,belongId); |
| | | if(CollUtil.isNotEmpty(records)){ |
| | | for(AdminMenuVo adminMenuVo : records){ |
| | | Long id = adminMenuVo.getId(); |
| | | QueryWrapper<MenuEntity> objectQueryWrapper = new QueryWrapper<>(); |
| | | objectQueryWrapper.eq("parent_id",id); |
| | | objectQueryWrapper.eq("belong_id",belongId); |
| | | List<MenuEntity> menuEntities = this.baseMapper.selectList(objectQueryWrapper); |
| | | List<AdminMenuVo> adminMenuVoChilds = new ArrayList<>(); |
| | | if(CollUtil.isNotEmpty(menuEntities)){ |