From 1695c8356c17395139bc806ead0596a929518707 Mon Sep 17 00:00:00 2001
From: feige <feige@qq.com>
Date: 星期二, 16 一月 2024 21:25:47 +0800
Subject: [PATCH] 增加内容

---
 zhang-content/src/main/java/com/ruoyi/service/impl/ZAuthorityServiceImpl.java |   70 +++++++++++++++++++++++++++++++++++
 1 files changed, 70 insertions(+), 0 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..91bd22b 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;
@@ -275,4 +276,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