根据岗位编码查询用户信息

This commit is contained in:
漂泊 2025-11-04 17:13:40 +08:00
parent 346ba1a966
commit d0a8e2207b
2 changed files with 12 additions and 3 deletions

View File

@ -4,9 +4,11 @@ import lombok.Data;
@Data @Data
public class UserPost { public class UserPost {
// 用户id
private String userId;
// 用户名 // 用户名
private String nickName; private String nickName;
// 用户 // 岗位名称
private String postName; private String postName;
// 岗位编码 // 岗位编码
private String postCode; private String postCode;

View File

@ -5,14 +5,21 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<mapper namespace="com.zhyc.module.common.mapper.UserPostMapper"> <mapper namespace="com.zhyc.module.common.mapper.UserPostMapper">
<resultMap type="UserPost" id="UserPostResult"> <resultMap type="UserPost" id="UserPostResult">
<result property="userId" column="user_id" />
<result property="nickName" column="nick_name" /> <result property="nickName" column="nick_name" />
<result property="postName" column="post_name"/> <result property="postName" column="post_name"/>
<result property="postCode" column="post_code" /> <result property="postCode" column="post_code" />
</resultMap> </resultMap>
<select id="getUserPostListByCode" resultMap="UserPostResult"> <select id="getUserPostListByCode" resultMap="UserPostResult">
SELECT u.user_id, nick_name , post_name , post_code
FROM sys_role r
JOIN sys_user_role ur ON r.role_id = ur.role_id
JOIN sys_user u ON ur.user_id = u.user_id
JOIN sys_user_post up ON u.user_id = up.user_id
JOIN sys_post p ON up.post_id = p.post_id
WHERE p.post_code LIKE CONCAT('%', #{postCode}, '%')
AND r.status = 0 and r.del_flag = 0;
</select> </select>
</mapper> </mapper>