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