<?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.changhu.module.management.mapper.ManagementSecurityUnitUserMapper">
    <select id="pager" resultType="com.changhu.module.management.pojo.vo.ManagementSecurityUnitUserPagerVo">
        select
        msuu.*,
        msuu2.name as 'createUserName'
        from management_security_unit_user msuu
        left join management_security_unit_user msuu2 on msuu.create_by = msuu2.snow_flake_id
        where
        msuu.delete_flag = 0
        and msuu.security_unit_id = ${@com.changhu.common.utils.UserUtil@getUnitId()}
        <if test="params.name!=null and params.name!=''">
            and msuu.name like concat('%',#{params.name},'%')
        </if>
        <if test="params.telephone!=null and params.telephone!=''">
            and msuu.telephone like concat('%',#{params.telephone},'%')
        </if>
        <if test="params.sex!=null">
            and msuu.sex = #{params.sex.value}
        </if>
        order by msuu.create_time desc
    </select>
</mapper>
