<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE mapper
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.zhyc.module.common.mapper.UserMapper">
    
    <resultMap type="User" id="UserResult">
        <result property="userId"      column="user_id"      />
        <result property="nickName"    column="nick_name"    />
        <result property="postName" column="post_name"/>
        <result property="postCode"    column="post_code"    />
    </resultMap>

    <select id="getUserPostListByCode" resultMap="UserResult">
        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>

</mapper>