<?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.fdkankan.platform.user.mapper.IUserMapper">
    <select id="getListByParam" resultType="com.fdkankan.platform.user.vo.ResponseUser">
        SELECT u.id, u.nick_name, u.user_name, u.head, u.email, u.register_time, u.status, u.download_num_total, u.download_num,
        (SELECT count(*) FROM t_user_increment where u.id = user_id and is_expired = 0) as increment_num
        FROM t_user u
        WHERE u.rec_status = 'A'
        <if test=" param.searchKey != null and param.searchKey !='' " >
            and u.user_name like concat('%',#{param.searchKey},'%')
        </if>
        <if test="param.startDate != null and param.startDate !='' " >
            and  u.register_time &gt;= ${param.startDate} '00:00:00'
        </if>
        <if test=" param.endDate != null and param.endDate !='' " >
            and  u.register_time &lt;= ${param.endDate} '23:59:59'
        </if>
        <if test="param.orderBy != null">
            order by ${param.orderBy}
        </if>
    </select>

</mapper>
