Browse Source

[feat] 修改:用户Mapper新增方法,根据角色查找用户。

dev
zhangsiqi 3 months ago
parent
commit
ac8bc4e136
  1. 27
      ruoyi-system/src/main/java/com/ruoyi/system/mapper/SysUserMapper.java

27
ruoyi-system/src/main/java/com/ruoyi/system/mapper/SysUserMapper.java

@ -2,6 +2,8 @@ package com.ruoyi.system.mapper;
import com.ruoyi.common.core.domain.entity.SysUser;
import org.apache.ibatis.annotations.MapKey;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;
import java.util.List;
import java.util.Map;
@ -137,4 +139,29 @@ public interface SysUserMapper
List<Map<String,String>> selectUserSelList(String userName);
List<SysUser> selectRoleToUserList(String[] roleKeys);
/**
* 根据角色名称查找用户
* @param roleKey
* @return
*/
@Select("select a.login_name from sys_user a,sys_role b,sys_user_role c\r\n" +
"where a.del_flag = 0 and a.status = 0\r\n" +
"and b.del_flag = 0 and b.status = 0\r\n" +
"and b.role_id = c.role_id\r\n" +
"and a.user_id = c.user_id\r\n" +
"and b.role_key = #{roleKey} order by a.login_name ")
public String selectUserByUniqueRolekey(String roleKey);
@Select("select a.user_name as userName,a.login_name as loginName from sys_user a,sys_dept b where a.dept_id = b.dept_id and b.dept_name=#{deptName} and a.status = 0 and a.del_flag = 0")
public List<SysUser> selectUserByDeptName(String deptName);
/**
* 查询部门领导
* @param roleKey
* @param deptId
* @return
*/
@Select("select login_name from sys_user a,sys_user_role b,sys_role c where a.user_id = b.user_id and b.role_id = c.role_id and a.dept_id=#{deptId} and c.role_key= #{roleKey} and a.del_flag = 0 and a.status = 0")
public String selectDeptLeaderId(@Param(value = "roleKey") String roleKey, @Param(value = "deptId") Long deptId);
}

Loading…
Cancel
Save