| | |
| | | import com.ruoyi.common.core.domain.AjaxResult; |
| | | import com.ruoyi.common.core.domain.entity.SysUser; |
| | | import com.ruoyi.common.utils.SecurityUtils; |
| | | import com.ruoyi.domain.ZAuthority; |
| | | import com.ruoyi.domain.ZInfoUser; |
| | | import com.ruoyi.domain.ZfCode; |
| | | import com.ruoyi.domain.ZfFamily; |
| | | import com.ruoyi.common.utils.StringUtils; |
| | | import com.ruoyi.domain.*; |
| | | import com.ruoyi.domain.dto.AuthorityDto; |
| | | import com.ruoyi.domain.dto.AuthorityDto2; |
| | | import com.ruoyi.domain.dto.AuthorityDtoWithName; |
| | |
| | | public List<ZAuthority> getAuthority() { |
| | | SysUser user = SecurityUtils.getLoginUser().getUser(); |
| | | Long userId = user.getUserId(); |
| | | |
| | | ZInfoUser zInfoUser = zInfoUserService.getInfoBysysId(userId); |
| | | LambdaQueryWrapper<ZAuthority> lqw = new LambdaQueryWrapper<>(); |
| | | lqw.eq(ZAuthority::getUid,userId); |
| | | lqw.eq(ZAuthority::getUid,zInfoUser.getUserId()); |
| | | |
| | | return list(lqw); |
| | | } |
| | |
| | | public AuthorityDto getByCondition(AuthorityDto authorityDto) { |
| | | SysUser user = SecurityUtils.getLoginUser().getUser(); |
| | | Long userId = user.getUserId(); |
| | | |
| | | Integer clanId = user.getClanId(); |
| | | String familyName = authorityDto.getFamilyName(); |
| | | String modelName = authorityDto.getModelName(); |
| | | |
| | | //根据家庭的名字查出家庭的id |
| | | Long familyId = zfFamilyService.getByName(familyName).getId(); |
| | | // Integer clanId = 0; |
| | | Long familyId = zfFamilyService.getByName(familyName, clanId).getId(); |
| | | |
| | | //根据模块的名字查出对应的权限码 |
| | | List<ZfCode> zfCodeList = zfCodeService.likeGetByName(modelName); |
| | |
| | | return AjaxResult.success(returnData); |
| | | |
| | | } |
| | | private LambdaQueryWrapper<ZAuthority> uniqueCondition(ZAuthority zAuthority) { |
| | | LambdaQueryWrapper<ZAuthority> lqw = new LambdaQueryWrapper<>(); |
| | | lqw.eq(zAuthority.getUid()!=null,ZAuthority::getUid,zAuthority.getUid()); |
| | | lqw.eq(zAuthority.getFid()!=null,ZAuthority::getFid,zAuthority.getFid()); |
| | | |
| | | lqw.eq(zAuthority.getAuthority()!=null,ZAuthority::getAuthority,zAuthority.getAuthority()); |
| | | |
| | | return lqw; |
| | | } |
| | | public void addData(ZAuthority za) |
| | | { |
| | | //判断是否重复授权 |
| | | |
| | | LambdaQueryWrapper<ZAuthority> lqw = uniqueCondition(za); |
| | | List<ZAuthority> list = list(lqw); |
| | | // |
| | | if(list.size()>0){ |
| | | throw new RuntimeException("请勿新增重复数据"); |
| | | } |
| | | zAuthorityService.save(za); |
| | | |
| | | } |
| | |
| | | za.setFid(zAuthority.getFid()); |
| | | za.setUid(uid); |
| | | addData(za); |
| | | System.out.println(za); |
| | | } |
| | | // Long [] |
| | | // if(bl) |
| | |
| | | lqw.eq(ZAuthority::getFid,empowerDto.getFid()) |
| | | .eq(ZAuthority::getAuthority, auri) |
| | | .eq(ZAuthority::getUid, uid); |
| | | |
| | | System.out.println("11111111111111111111"+list(lqw)); |
| | | zAuthorityService.remove(lqw); |
| | | // addData(za); |
| | | } |
| | |
| | | |
| | | |
| | | LambdaQueryWrapper<ZInfoUser> lq = new LambdaQueryWrapper<>(); |
| | | lq.in(ZInfoUser::getUserId, allUserListId); |
| | | List<ZInfoUser> userInfo = new ArrayList<>(); |
| | | if(allUserListId.size()!=0) { |
| | | lq.in(ZInfoUser::getUserId, allUserListId); |
| | | |
| | | List<ZInfoUser> userInfo = zInfoUserService.list(lq); |
| | | userInfo = zInfoUserService.list(lq); |
| | | } |
| | | // Map<Long, String> usi = userInfo.stream().collect(Collectors.toMap(ZInfoUser::getUserId,ZInfoUser::getNickName)); |
| | | return AjaxResult.success(userInfo); |
| | | } |