<?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.game.business.mapper.AppUsersAuthMapper">
    
    <resultMap type="com.game.business.domain.AppUsersAuth" id="AppUsersAuthResult">
        <result property="uid"    column="uid"    />
        <result property="addtime"    column="addtime"    />
        <result property="backView"    column="back_view"    />
        <result property="cerNo"    column="cer_no"    />
        <result property="extraInfo"    column="extra_info"    />
        <result property="frontView"    column="front_view"    />
        <result property="handsetView"    column="handset_view"    />
        <result property="mobile"    column="mobile"    />
        <result property="other1View"    column="other1_view"    />
        <result property="other2View"    column="other2_view"    />
        <result property="other3View"    column="other3_view"    />
        <result property="pidLevel1"    column="pid_level1"    />
        <result property="pidLevel2"    column="pid_level2"    />
        <result property="pidLevel3"    column="pid_level3"    />
        <result property="pidLevel4"    column="pid_level4"    />
        <result property="qq"    column="qq"    />
        <result property="realName"    column="real_name"    />
        <result property="reason"    column="reason"    />
        <result property="starId"    column="star_id"    />
        <result property="status"    column="status"    />
        <result property="step"    column="step"    />
        <result property="uptime"    column="uptime"    />
        <result property="videoUrl"    column="video_url"    />
        <result property="wechat"    column="wechat"    />
    </resultMap>

    <sql id="selectAppUsersAuthVo">
        select uid, addtime, back_view, cer_no, extra_info, front_view, handset_view, mobile, other1_view, other2_view, other3_view, pid_level1, pid_level2, pid_level3, pid_level4, qq, real_name, reason, star_id, status, step, uptime, video_url, wechat from app_users_auth
    </sql>

    <select id="selectAppUsersAuthList" parameterType="com.game.business.domain.AppUsersAuth" resultMap="AppUsersAuthResult">
        <include refid="selectAppUsersAuthVo"/>
        <where>  
            <if test="uid != null "> and uid = #{uid}</if>
            <if test="cerNo != null  and cerNo != ''"> and cer_no = #{cerNo}</if>
            <if test="status != null "> and status = #{status}</if>
        </where>
        order by uptime desc , addtime desc
    </select>
    
    <select id="selectAppUsersAuthByUid" parameterType="Long" resultMap="AppUsersAuthResult">
        <include refid="selectAppUsersAuthVo"/>
        where uid = #{uid}
    </select>
        
    <insert id="insertAppUsersAuth" parameterType="com.game.business.domain.AppUsersAuth">
        insert into app_users_auth
        <trim prefix="(" suffix=")" suffixOverrides=",">
            <if test="uid != null">uid,</if>
            <if test="addtime != null">addtime,</if>
            <if test="backView != null">back_view,</if>
            <if test="cerNo != null">cer_no,</if>
            <if test="extraInfo != null">extra_info,</if>
            <if test="frontView != null">front_view,</if>
            <if test="handsetView != null">handset_view,</if>
            <if test="mobile != null">mobile,</if>
            <if test="other1View != null">other1_view,</if>
            <if test="other2View != null">other2_view,</if>
            <if test="other3View != null">other3_view,</if>
            <if test="pidLevel1 != null">pid_level1,</if>
            <if test="pidLevel2 != null">pid_level2,</if>
            <if test="pidLevel3 != null">pid_level3,</if>
            <if test="pidLevel4 != null">pid_level4,</if>
            <if test="qq != null">qq,</if>
            <if test="realName != null">real_name,</if>
            <if test="reason != null">reason,</if>
            <if test="starId != null">star_id,</if>
            <if test="status != null">status,</if>
            <if test="step != null">step,</if>
            <if test="uptime != null">uptime,</if>
            <if test="videoUrl != null">video_url,</if>
            <if test="wechat != null">wechat,</if>
         </trim>
        <trim prefix="values (" suffix=")" suffixOverrides=",">
            <if test="uid != null">#{uid},</if>
            <if test="addtime != null">#{addtime},</if>
            <if test="backView != null">#{backView},</if>
            <if test="cerNo != null">#{cerNo},</if>
            <if test="extraInfo != null">#{extraInfo},</if>
            <if test="frontView != null">#{frontView},</if>
            <if test="handsetView != null">#{handsetView},</if>
            <if test="mobile != null">#{mobile},</if>
            <if test="other1View != null">#{other1View},</if>
            <if test="other2View != null">#{other2View},</if>
            <if test="other3View != null">#{other3View},</if>
            <if test="pidLevel1 != null">#{pidLevel1},</if>
            <if test="pidLevel2 != null">#{pidLevel2},</if>
            <if test="pidLevel3 != null">#{pidLevel3},</if>
            <if test="pidLevel4 != null">#{pidLevel4},</if>
            <if test="qq != null">#{qq},</if>
            <if test="realName != null">#{realName},</if>
            <if test="reason != null">#{reason},</if>
            <if test="starId != null">#{starId},</if>
            <if test="status != null">#{status},</if>
            <if test="step != null">#{step},</if>
            <if test="uptime != null">#{uptime},</if>
            <if test="videoUrl != null">#{videoUrl},</if>
            <if test="wechat != null">#{wechat},</if>
         </trim>
    </insert>

    <update id="updateAppUsersAuth" parameterType="com.game.business.domain.AppUsersAuth">
        update app_users_auth
        <trim prefix="SET" suffixOverrides=",">
            <if test="addtime != null">addtime = #{addtime},</if>
            <if test="backView != null">back_view = #{backView},</if>
            <if test="cerNo != null">cer_no = #{cerNo},</if>
            <if test="extraInfo != null">extra_info = #{extraInfo},</if>
            <if test="frontView != null">front_view = #{frontView},</if>
            <if test="handsetView != null">handset_view = #{handsetView},</if>
            <if test="mobile != null">mobile = #{mobile},</if>
            <if test="other1View != null">other1_view = #{other1View},</if>
            <if test="other2View != null">other2_view = #{other2View},</if>
            <if test="other3View != null">other3_view = #{other3View},</if>
            <if test="pidLevel1 != null">pid_level1 = #{pidLevel1},</if>
            <if test="pidLevel2 != null">pid_level2 = #{pidLevel2},</if>
            <if test="pidLevel3 != null">pid_level3 = #{pidLevel3},</if>
            <if test="pidLevel4 != null">pid_level4 = #{pidLevel4},</if>
            <if test="qq != null">qq = #{qq},</if>
            <if test="realName != null">real_name = #{realName},</if>
            <if test="reason != null">reason = #{reason},</if>
            <if test="starId != null">star_id = #{starId},</if>
            <if test="status != null">status = #{status},</if>
            <if test="step != null">step = #{step},</if>
            <if test="uptime != null">uptime = #{uptime},</if>
            <if test="videoUrl != null">video_url = #{videoUrl},</if>
            <if test="wechat != null">wechat = #{wechat},</if>
        </trim>
        where uid = #{uid}
    </update>

    <delete id="deleteAppUsersAuthByUid" parameterType="Long">
        delete from app_users_auth where uid = #{uid}
    </delete>

    <delete id="deleteAppUsersAuthByUids" parameterType="String">
        delete from app_users_auth where uid in 
        <foreach item="uid" collection="array" open="(" separator="," close=")">
            #{uid}
        </foreach>
    </delete>
</mapper>