| | |
| | | import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; |
| | | import com.xcong.farmer.cms.common.response.Result; |
| | | import com.xcong.farmer.cms.modules.system.dto.AdminAddUserDto; |
| | | import com.xcong.farmer.cms.modules.system.dto.AdminDeleteDto; |
| | | import com.xcong.farmer.cms.modules.system.dto.AdminUpdateUserDto; |
| | | import com.xcong.farmer.cms.modules.system.dto.AdminUserDto; |
| | | import com.xcong.farmer.cms.modules.system.entity.*; |
| | |
| | | AdminUserMenuVo adminUserMenuVo = menuMapper.selectAdminRoleMenuVoById(childId); |
| | | Long parentId = adminUserMenuVo.getParentId(); |
| | | AdminUserMenuVo adminUserMenuVoParent = menuMap.get(parentId); |
| | | List<AdminUserMenuVo> child = adminUserMenuVoParent.getChild(); |
| | | if(CollUtil.isEmpty(child)){ |
| | | List<AdminUserMenuVo> list = new ArrayList<>(); |
| | | list.add(adminUserMenuVo); |
| | | adminUserMenuVoParent.setChild(list); |
| | | }else{ |
| | | child.add(adminUserMenuVo); |
| | | if(ObjectUtil.isNotEmpty(adminUserMenuVoParent)){ |
| | | List<AdminUserMenuVo> child = adminUserMenuVoParent.getChild(); |
| | | if(CollUtil.isEmpty(child)){ |
| | | List<AdminUserMenuVo> list = new ArrayList<>(); |
| | | list.add(adminUserMenuVo); |
| | | adminUserMenuVoParent.setChild(list); |
| | | }else{ |
| | | child.add(adminUserMenuVo); |
| | | } |
| | | } |
| | | } |
| | | } |
| | |
| | | return Result.ok(adminUserMenuVos); |
| | | } |
| | | |
| | | @Override |
| | | @Transactional |
| | | public Result delObjs(AdminDeleteDto adminDeleteDto) { |
| | | String ids = adminDeleteDto.getIds(); |
| | | if(StrUtil.isNotEmpty(ids)){ |
| | | String[] userIds = ids.split(StringPool.COMMA); |
| | | for(String userIdStr : userIds){ |
| | | Long userId = Long.valueOf(userIdStr); |
| | | |
| | | QueryWrapper<UserRoleEntity> objectQueryWrapper = new QueryWrapper<>(); |
| | | objectQueryWrapper.eq("user_id",userId); |
| | | userRoleMapper.delete(objectQueryWrapper); |
| | | |
| | | this.baseMapper.deleteById(userId); |
| | | } |
| | | |
| | | } |
| | | return Result.ok("删除成功"); |
| | | } |
| | | |
| | | private void saveUserRole(String roleIds,Long userId) { |
| | | if (StrUtil.isNotEmpty(roleIds)) { |
| | | String[] roleIdList = roleIds.split(StringPool.COMMA); |