From 3b882c3be44b2eede09999d8b65d2630ce818a81 Mon Sep 17 00:00:00 2001
From: liyj <1003249715@qq.com>
Date: Sat, 31 Aug 2024 18:12:12 +0800
Subject: [PATCH] 1、附件管理模块修改3

---
 dyh-service/dyh-cust/src/main/java/cn/huge/module/ctrole/service/CtRoleService.java |   47 +++++++++++++++++++++++++++++++++++++++++++++++
 1 files changed, 47 insertions(+), 0 deletions(-)

diff --git a/dyh-service/dyh-cust/src/main/java/cn/huge/module/ctrole/service/CtRoleService.java b/dyh-service/dyh-cust/src/main/java/cn/huge/module/ctrole/service/CtRoleService.java
index a6ba27a..dbf45ca 100644
--- a/dyh-service/dyh-cust/src/main/java/cn/huge/module/ctrole/service/CtRoleService.java
+++ b/dyh-service/dyh-cust/src/main/java/cn/huge/module/ctrole/service/CtRoleService.java
@@ -5,8 +5,14 @@
 import cn.huge.base.common.utils.IdUtils;
 import cn.huge.module.client.api.impl.UtilsClientImpl;
 import cn.huge.module.ctrole.dao.mapper.CtRoleMapper;
+import cn.huge.module.ctrole.domain.bo.CtRoleBO;
 import cn.huge.module.ctrole.domain.po.CtRole;
+import cn.huge.module.ctuser.domain.bo.RoleTreeBO;
+import cn.huge.module.ctuser.service.CtUserService;
+import cn.huge.module.cust.dto.CtUserDTO;
+import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
 import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
+import org.springframework.beans.BeanUtils;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
 import lombok.extern.slf4j.Slf4j;
@@ -37,6 +43,12 @@
 
     @Autowired
     private UtilsClientImpl utilsClient;
+
+    @Autowired
+    private CtUserService ctUserService;
+
+    @Autowired
+    private CtRolefunService ctRolefunService;
 
     /**
     * 更新对象
@@ -128,4 +140,39 @@
         }
     }
 
+    /**
+     * 根据单位编号和角色编号查询
+     * @param unitId 单位编号
+     * @param roleId 角色编号
+     * @return
+     */
+    public CtRole getByUnitIdAndRoleId(String unitId, String roleId){
+        QueryWrapper<CtRole> ctRoleQueryWrapper = new QueryWrapper<>();
+        ctRoleQueryWrapper.eq("unit_id", unitId).eq("role_code", roleId);
+        CtRole ctRole = mapper.selectOne(ctRoleQueryWrapper);
+        return ctRole;
+    }
+
+    /**
+     * 根据单位编号和角色编号查询
+     * @param id
+     * @param userId
+     * @return
+     */
+    public CtRoleBO webGetById(String id, String userId){
+        // 临时-演示用户赋予超级管理员角色
+        // 获取当前登录用户
+        CtUserDTO loginUser = ctUserService.clientGetUserAll(userId);
+        String acc = loginUser.getAcc();
+        if ("yanstjy".equals(acc) || "yansjdb".equals(acc)){
+            id = "2303191513151003";
+        }
+        CtRole ctRole = this.getById(id);
+        CtRoleBO bo = new CtRoleBO();
+        BeanUtils.copyProperties(ctRole,bo);
+        //查询角色权限
+        List<RoleTreeBO> roleTrees = ctRolefunService.getRolefunTree(ctRole.getId());
+        bo.setRoleTreeBOS(roleTrees);
+        return bo;
+    }
 }

--
Gitblit v1.8.0