<?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.jiayue.center.mapper.SysUserMapper">

    <resultMap type="SysUser" id="SysUserResult">
        <id     property="id"       column="id"      />
        <result property="username"     column="username"    />
        <result property="nickname"     column="nickname"    />
        <result property="idcard"     column="idcard"    />
        <result property="usertype"        column="usertype"        />
        <result property="signstr"        column="signstr"        />
        <result property="phonenumber"  column="phonenumber"  />
        <result property="lockTime"          column="lock_time"          />
        <result property="errNum"       column="err_num"       />
        <result property="password"     column="password"     />
        <result property="status"       column="status"       />
        <result property="onlineStatus"       column="online_status"       />
        <result property="lastUpdatePwdTime"       column="last_update_pwd_time"       />
        <result property="loginIp"       column="login_ip"       />
        <result property="loginDate"       column="login_date"       />
		<result property="delFlag"            column="del_flag"              />
		<result property="createBy"           column="create_by"             />
		<result property="createTime"         column="create_time"           />
		<result property="updateBy"           column="update_by"             />
		<result property="updateTime"         column="update_time"           />
		<result property="remark"             column="remark"                />
    </resultMap>

    <select id="selectUserByRole" parameterType="String" resultMap="SysUserResult">
		SELECT
			*
		FROM
			sys_user u
		WHERE
			u.del_flag = '0'
		  AND u.id IN (
			SELECT
				user_id
			FROM
				sys_user_role ur
			WHERE
				ur.role_id = #{roleId}
			  AND ur.del_flag = '0'
		)
	</select>
</mapper>
