<?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.mosty.wzzx.mapper.WzzxUserMapper">

    <resultMap id="BaseResultMap" type="com.mosty.common.core.business.entity.SysUser">
            <id property="id" column="id" jdbcType="BIGINT"/>
            <result property="positionId" column="position_id" jdbcType="BIGINT"/>
            <result property="positionName" column="position_name" jdbcType="VARCHAR"/>
            <result property="userName" column="user_name" jdbcType="VARCHAR"/>
            <result property="loginName" column="login_name" jdbcType="VARCHAR"/>
            <result property="mobile" column="mobile" jdbcType="VARCHAR"/>
            <result property="telePhone" column="tele_phone" jdbcType="VARCHAR"/>
            <result property="idEntityCard" column="id_entity_card" jdbcType="VARCHAR"/>
            <result property="inDustRialId" column="in_dust_rial_id" jdbcType="VARCHAR"/>
            <result property="sex" column="sex" jdbcType="VARCHAR"/>
            <result property="xtLrsj" column="xt_lrsj" jdbcType="TIMESTAMP"/>
            <result property="deptId" column="dept_id" jdbcType="BIGINT"/>
            <result property="deptCode" column="dept_code" jdbcType="VARCHAR"/>
            <result property="deptName" column="dept_name" jdbcType="VARCHAR"/>
    </resultMap>

    <sql id="Base_Column_List">
        id,position_id,position_name,
        user_name,login_name,mobile,tele_phone,
        id_entity_card,in_dust_rial_id,sex,
        xt_lrsj,dept_id,dept_code,
        dept_name
    </sql>

    <select id="selectByPage" resultType="com.mosty.common.core.business.entity.SysUser">
        select  a.id, a.position_id, a.position_name,
                a.user_name, a.login_name, a.mobile, a.tele_phone,
                a.id_entity_card, a.in_dust_rial_id, a.sex,
                a.xt_lrsj, c.id as dept_id, c.org_code as dept_code,
                c.org_name as dept_name
        from mosty_base.sys_user a
        LEFT JOIN mosty_base.sys_user_dept b on a.id = b.user_id
        LEFT JOIN mosty_base.sys_dept c on b.dept_id = c.id
        where a.xt_zxbz = 0
    </select>

</mapper>
