<?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.ytpm.dao.dyz.AppUserMapper">
    <select id="selectAppUserList" resultType="com.ytpm.app.view.YtAppUserListView">
        select
            au.user_id,
            au.app_id,
            au.channel_id,
            au.platform_id,
            au.wx_open_id,
            au.nick_name,
            au.registry_time,
            au.last_login_time,
            au.last_login_ip,
            a.app_name,
            au.channel_type,
            au.channel_origin,
            au.user_type,
            au.total_video,
            au.total_income,
            au.red_packet_balance,
            au.red_packet_amount,
            au.points_balance,
            au.points_total,
            a.version_code,
            au.user_status,
            au.login_days,
            au.withdraw_total,
            au.sign_days
        from yt_app_user au
        join yt_app a on au.app_id = a.app_id
        where au.user_status not in (4)
        <if test="registryTime != null">
            and DATE_FORMAT(au.registry_time,'%Y-%m-%d') = DATE_FORMAT(#{registryTime},'%Y-%m-%d')
        </if>
        <if test="lastLoginTime != null">
            and DATE_FORMAT(au.last_login_time,'%Y-%m-%d') = DATE_FORMAT(#{lastLoginTime},'%Y-%m-%d')
        </if>
        <if test="channelType != null">
            and au.channel_type = #{channelType}
        </if>
        <if test="channelOrigin != null">
            and au.channel_origin = #{channelOrigin}
        </if>
        <if test="userType != null">
            and au.user_type = #{userType}
        </if>
        <if test="nickName != null and nickName != ''">
            and au.nick_name like CONCAT('%',#{nickName},'%')
        </if>
    </select>
</mapper>