forked from gzzfw/backEnd/gz-dyh

wangwh
2024-08-28 b47d4a7accabce974e19d2a1ffb3c5c67507d74b
dyh-service/dyh-cust/src/main/java/cn/huge/module/ctrole/service/CtRoleService.java
@@ -5,9 +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;
@@ -38,6 +43,12 @@
    @Autowired
    private UtilsClientImpl utilsClient;
    @Autowired
    private CtUserService ctUserService;
    @Autowired
    private CtRolefunService ctRolefunService;
    /**
    * 更新对象
@@ -142,4 +153,26 @@
        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;
    }
}