From b39a20d6b37f96e1d44c6c194ce56bd30593e3ad Mon Sep 17 00:00:00 2001 From: feige <791364011@qq.com> Date: 星期四, 29 八月 2024 22:20:31 +0800 Subject: [PATCH] 登录用用户昵称了 --- zhang-content/src/main/java/com/ruoyi/service/impl/ZAuthorityServiceImpl.java | 75 ++++++++++++++++++++++++++++++++++++- 1 files changed, 73 insertions(+), 2 deletions(-) diff --git a/zhang-content/src/main/java/com/ruoyi/service/impl/ZAuthorityServiceImpl.java b/zhang-content/src/main/java/com/ruoyi/service/impl/ZAuthorityServiceImpl.java index bb31f3b..f4620d2 100644 --- a/zhang-content/src/main/java/com/ruoyi/service/impl/ZAuthorityServiceImpl.java +++ b/zhang-content/src/main/java/com/ruoyi/service/impl/ZAuthorityServiceImpl.java @@ -12,6 +12,7 @@ import com.ruoyi.domain.dto.AuthorityDto; import com.ruoyi.domain.dto.AuthorityDto2; import com.ruoyi.domain.dto.AuthorityDtoWithName; +import com.ruoyi.domain.dto.EmpowerDto; import com.ruoyi.mapper.ZAuthorityMapper; import com.ruoyi.service.ZAuthorityService; import com.ruoyi.service.ZInfoUserService; @@ -63,12 +64,13 @@ 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); @@ -275,4 +277,73 @@ } + public void addData(ZAuthority za) + { + //鍒ゆ柇鏄惁閲嶅鎺堟潈 + + // + zAuthorityService.save(za); + + } + public AjaxResult saveZa(EmpowerDto zAuthority) + { + // boolean bl = zAuthorityService.saveOrUpdate(zAuthority); + Long [] uids = zAuthority.getUids(); + Long [] authoritys = zAuthority.getAuthoritys(); + for(Long uid : uids) + for(Long auri: authoritys) + { + ZAuthority za = new ZAuthority(); + za.setAuthority(auri); + za.setFid(zAuthority.getFid()); + za.setUid(uid); + addData(za); + } + // Long [] + // if(bl) + return AjaxResult.success("鏉冮檺鏂板鎴愬姛!"); + // else + // return AjaxResult.error("鏉冮檺鏂板澶辫触锛�"); + + } + + @Override + public AjaxResult deleteZa(EmpowerDto empowerDto) { + Long [] uids = empowerDto.getUids(); + Long [] authoritys = empowerDto.getAuthoritys(); + for(Long uid : uids) + for(Long auri: authoritys) + { + + LambdaQueryWrapper<ZAuthority> lqw = new LambdaQueryWrapper<>(); + lqw.eq(ZAuthority::getFid,empowerDto.getFid()) + .eq(ZAuthority::getAuthority, auri) + .eq(ZAuthority::getUid, uid); + + zAuthorityService.remove(lqw); + // addData(za); + } + return AjaxResult.success("鏉冮檺鏀跺洖鎴愬姛!"); + + } + + @Override + public AjaxResult listByFidAid(ZAuthority zAuthority) { + //鎵惧埌瀵瑰簲瀹跺涵浠ュ強鏉冮檺妯″潡瀵瑰簲鐨勭敤鎴� + LambdaQueryWrapper<ZAuthority> lqw = new LambdaQueryWrapper<>(); + lqw.eq(ZAuthority::getFid,zAuthority.getFid()) + .eq(ZAuthority::getAuthority, zAuthority.getAuthority()); + + List<ZAuthority> authorityList = list(lqw); + + List<Long> allUserListId = authorityList.stream().map(ZAuthority::getUid).collect(Collectors.toList());//鎺堟潈鐢ㄦ埛鏁扮粍鏁扮粍 + + + LambdaQueryWrapper<ZInfoUser> lq = new LambdaQueryWrapper<>(); + lq.in(ZInfoUser::getUserId, allUserListId); + + List<ZInfoUser> userInfo = zInfoUserService.list(lq); + // Map<Long, String> usi = userInfo.stream().collect(Collectors.toMap(ZInfoUser::getUserId,ZInfoUser::getNickName)); + return AjaxResult.success(userInfo); + } } -- Gitblit v1.9.1