<?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.LiveLiveMapper">
    
    <resultMap type="com.game.business.domain.LiveLive" id="LiveLiveResult">
        <result property="id"    column="id"    />
        <result property="address"    column="address"    />
        <result property="adsTemplateId"    column="ads_template_id"    />
        <result property="avatar"    column="avatar"    />
        <result property="bankerCoin"    column="banker_coin"    />
        <result property="channelId"    column="channel_id"    />
        <result property="city"    column="city"    />
        <result property="demoAccount"    column="demo_account"    />
        <result property="gameAction"    column="game_action"    />
        <result property="goodnum"    column="goodnum"    />
        <result property="hotSortId"    column="hot_sort_id"    />
        <result property="hotvotes"    column="hotvotes"    />
        <result property="importTemplateId"    column="import_template_id"    />
        <result property="isEnableTemplate"    column="is_enable_template"    />
        <result property="isRecommend"    column="is_recommend"    />
        <result property="islive"    column="islive"    />
        <result property="ismic"    column="ismic"    />
        <result property="isvideo"    column="isvideo"    />
        <result property="lat"    column="lat"    />
        <result property="liveFunction"    column="live_function"    />
        <result property="liveLockStatus"    column="live_lock_status"    />
        <result property="lng"    column="lng"    />
        <result property="nickname"    column="nickname"    />
        <result property="notice"    column="notice"    />
        <result property="province"    column="province"    />
        <result property="pull"    column="pull"    />
        <result property="roomAdsId0"    column="room_ads_id0"    />
        <result property="roomAdsId1"    column="room_ads_id1"    />
        <result property="roomAdsId2"    column="room_ads_id2"    />
        <result property="roomAdsId3"    column="room_ads_id3"    />
        <result property="roomAdsId4"    column="room_ads_id4"    />
        <result property="roomAdsId5"    column="room_ads_id5"    />
        <result property="roomAdsId6"    column="room_ads_id6"    />
        <result property="roomAdsId7"    column="room_ads_id7"    />
        <result property="roomAdsId8"    column="room_ads_id8"    />
        <result property="roomStatus"    column="room_status"    />
        <result property="roomType"    column="room_type"    />
        <result property="roomTypeVal"    column="room_type_val"    />
        <result property="shopLiveBanner"    column="shop_live_banner"    />
        <result property="shopRoomLabel"    column="shop_room_label"    />
        <result property="showid"    column="showid"    />
        <result property="sort"    column="sort"    />
        <result property="starttime"    column="starttime"    />
        <result property="stream"    column="stream"    />
        <result property="tabName"    column="tab_name"    />
        <result property="tabStyle"    column="tab_style"    />
        <result property="thumb"    column="thumb"    />
        <result property="thumbAuditBy"    column="thumb_audit_by"    />
        <result property="thumbAuditReason"    column="thumb_audit_reason"    />
        <result property="thumbAuditTime"    column="thumb_audit_time"    />
        <result property="thumbState"    column="thumb_state"    />
        <result property="title"    column="title"    />
        <result property="userId"    column="user_id"    />
    </resultMap>

    <sql id="selectLiveLiveVo">
        select id, address, ads_template_id, avatar, banker_coin, channel_id, city, demo_account, game_action, goodnum, hot_sort_id, hotvotes, import_template_id, is_enable_template, is_recommend, islive, ismic, isvideo, lat, live_function, live_lock_status, lng, nickname, notice, province, pull, room_ads_id0, room_ads_id1, room_ads_id2, room_ads_id3, room_ads_id4, room_ads_id5, room_ads_id6, room_ads_id7, room_ads_id8, room_status, room_type, room_type_val, shop_live_banner, shop_room_label, showid, sort, starttime, stream, tab_name, tab_style, thumb, thumb_audit_by, thumb_audit_reason, thumb_audit_time, thumb_state, title, user_id from live_live
    </sql>

    <select id="selectLiveLiveList" parameterType="com.game.business.domain.LiveLive" resultMap="LiveLiveResult">
        <include refid="selectLiveLiveVo"/>
        <where>  
            <if test="address != null  and address != ''"> and address = #{address}</if>
            <if test="adsTemplateId != null "> and ads_template_id = #{adsTemplateId}</if>
            <if test="avatar != null  and avatar != ''"> and avatar = #{avatar}</if>
            <if test="bankerCoin != null "> and banker_coin = #{bankerCoin}</if>
            <if test="channelId != null "> and channel_id = #{channelId}</if>
            <if test="city != null  and city != ''"> and city = #{city}</if>
            <if test="demoAccount != null "> and demo_account = #{demoAccount}</if>
            <if test="gameAction != null "> and game_action = #{gameAction}</if>
            <if test="goodnum != null  and goodnum != ''"> and goodnum = #{goodnum}</if>
            <if test="hotSortId != null "> and hot_sort_id = #{hotSortId}</if>
            <if test="hotvotes != null "> and hotvotes = #{hotvotes}</if>
            <if test="importTemplateId != null "> and import_template_id = #{importTemplateId}</if>
            <if test="isEnableTemplate != null "> and is_enable_template = #{isEnableTemplate}</if>
            <if test="isRecommend != null "> and is_recommend = #{isRecommend}</if>
            <if test="islive != null "> and islive = #{islive}</if>
            <if test="ismic != null "> and ismic = #{ismic}</if>
            <if test="isvideo != null "> and isvideo = #{isvideo}</if>
            <if test="lat != null "> and lat = #{lat}</if>
            <if test="liveFunction != null "> and live_function = #{liveFunction}</if>
            <if test="liveLockStatus != null "> and live_lock_status = #{liveLockStatus}</if>
            <if test="lng != null "> and lng = #{lng}</if>
            <if test="nickname != null  and nickname != ''"> and nickname like concat('%', #{nickname}, '%')</if>
            <if test="notice != null  and notice != ''"> and notice = #{notice}</if>
            <if test="province != null  and province != ''"> and province = #{province}</if>
            <if test="pull != null  and pull != ''"> and pull = #{pull}</if>
            <if test="roomAdsId0 != null "> and room_ads_id0 = #{roomAdsId0}</if>
            <if test="roomAdsId1 != null "> and room_ads_id1 = #{roomAdsId1}</if>
            <if test="roomAdsId2 != null "> and room_ads_id2 = #{roomAdsId2}</if>
            <if test="roomAdsId3 != null "> and room_ads_id3 = #{roomAdsId3}</if>
            <if test="roomAdsId4 != null "> and room_ads_id4 = #{roomAdsId4}</if>
            <if test="roomAdsId5 != null "> and room_ads_id5 = #{roomAdsId5}</if>
            <if test="roomAdsId6 != null "> and room_ads_id6 = #{roomAdsId6}</if>
            <if test="roomAdsId7 != null "> and room_ads_id7 = #{roomAdsId7}</if>
            <if test="roomAdsId8 != null "> and room_ads_id8 = #{roomAdsId8}</if>
            <if test="roomStatus != null "> and room_status = #{roomStatus}</if>
            <if test="roomType != null "> and room_type = #{roomType}</if>
            <if test="roomTypeVal != null  and roomTypeVal != ''"> and room_type_val = #{roomTypeVal}</if>
            <if test="shopLiveBanner != null  and shopLiveBanner != ''"> and shop_live_banner = #{shopLiveBanner}</if>
            <if test="shopRoomLabel != null  and shopRoomLabel != ''"> and shop_room_label = #{shopRoomLabel}</if>
            <if test="showid != null  and showid != ''"> and showid = #{showid}</if>
            <if test="sort != null "> and sort = #{sort}</if>
            <if test="starttime != null "> and starttime = #{starttime}</if>
            <if test="stream != null  and stream != ''"> and stream = #{stream}</if>
            <if test="tabName != null  and tabName != ''"> and tab_name like concat('%', #{tabName}, '%')</if>
            <if test="tabStyle != null  and tabStyle != ''"> and tab_style = #{tabStyle}</if>
            <if test="thumb != null  and thumb != ''"> and thumb = #{thumb}</if>
            <if test="thumbAuditBy != null  and thumbAuditBy != ''"> and thumb_audit_by = #{thumbAuditBy}</if>
            <if test="thumbAuditReason != null  and thumbAuditReason != ''"> and thumb_audit_reason = #{thumbAuditReason}</if>
            <if test="thumbAuditTime != null "> and thumb_audit_time = #{thumbAuditTime}</if>
            <if test="thumbState != null "> and thumb_state = #{thumbState}</if>
            <if test="title != null  and title != ''"> and title = #{title}</if>
            <if test="userId != null "> and user_id = #{userId}</if>
        </where>
    </select>
    
    <select id="selectLiveLiveById" parameterType="Long" resultMap="LiveLiveResult">
        <include refid="selectLiveLiveVo"/>
        where id = #{id}
    </select>
        
    <insert id="insertLiveLive" parameterType="com.game.business.domain.LiveLive">
        insert into live_live
        <trim prefix="(" suffix=")" suffixOverrides=",">
            <if test="id != null">id,</if>
            <if test="address != null">address,</if>
            <if test="adsTemplateId != null">ads_template_id,</if>
            <if test="avatar != null">avatar,</if>
            <if test="bankerCoin != null">banker_coin,</if>
            <if test="channelId != null">channel_id,</if>
            <if test="city != null">city,</if>
            <if test="demoAccount != null">demo_account,</if>
            <if test="gameAction != null">game_action,</if>
            <if test="goodnum != null">goodnum,</if>
            <if test="hotSortId != null">hot_sort_id,</if>
            <if test="hotvotes != null">hotvotes,</if>
            <if test="importTemplateId != null">import_template_id,</if>
            <if test="isEnableTemplate != null">is_enable_template,</if>
            <if test="isRecommend != null">is_recommend,</if>
            <if test="islive != null">islive,</if>
            <if test="ismic != null">ismic,</if>
            <if test="isvideo != null">isvideo,</if>
            <if test="lat != null">lat,</if>
            <if test="liveFunction != null">live_function,</if>
            <if test="liveLockStatus != null">live_lock_status,</if>
            <if test="lng != null">lng,</if>
            <if test="nickname != null">nickname,</if>
            <if test="notice != null">notice,</if>
            <if test="province != null">province,</if>
            <if test="pull != null">pull,</if>
            <if test="roomAdsId0 != null">room_ads_id0,</if>
            <if test="roomAdsId1 != null">room_ads_id1,</if>
            <if test="roomAdsId2 != null">room_ads_id2,</if>
            <if test="roomAdsId3 != null">room_ads_id3,</if>
            <if test="roomAdsId4 != null">room_ads_id4,</if>
            <if test="roomAdsId5 != null">room_ads_id5,</if>
            <if test="roomAdsId6 != null">room_ads_id6,</if>
            <if test="roomAdsId7 != null">room_ads_id7,</if>
            <if test="roomAdsId8 != null">room_ads_id8,</if>
            <if test="roomStatus != null">room_status,</if>
            <if test="roomType != null">room_type,</if>
            <if test="roomTypeVal != null">room_type_val,</if>
            <if test="shopLiveBanner != null">shop_live_banner,</if>
            <if test="shopRoomLabel != null">shop_room_label,</if>
            <if test="showid != null">showid,</if>
            <if test="sort != null">sort,</if>
            <if test="starttime != null">starttime,</if>
            <if test="stream != null">stream,</if>
            <if test="tabName != null">tab_name,</if>
            <if test="tabStyle != null">tab_style,</if>
            <if test="thumb != null">thumb,</if>
            <if test="thumbAuditBy != null">thumb_audit_by,</if>
            <if test="thumbAuditReason != null">thumb_audit_reason,</if>
            <if test="thumbAuditTime != null">thumb_audit_time,</if>
            <if test="thumbState != null">thumb_state,</if>
            <if test="title != null">title,</if>
            <if test="userId != null">user_id,</if>
         </trim>
        <trim prefix="values (" suffix=")" suffixOverrides=",">
            <if test="id != null">#{id},</if>
            <if test="address != null">#{address},</if>
            <if test="adsTemplateId != null">#{adsTemplateId},</if>
            <if test="avatar != null">#{avatar},</if>
            <if test="bankerCoin != null">#{bankerCoin},</if>
            <if test="channelId != null">#{channelId},</if>
            <if test="city != null">#{city},</if>
            <if test="demoAccount != null">#{demoAccount},</if>
            <if test="gameAction != null">#{gameAction},</if>
            <if test="goodnum != null">#{goodnum},</if>
            <if test="hotSortId != null">#{hotSortId},</if>
            <if test="hotvotes != null">#{hotvotes},</if>
            <if test="importTemplateId != null">#{importTemplateId},</if>
            <if test="isEnableTemplate != null">#{isEnableTemplate},</if>
            <if test="isRecommend != null">#{isRecommend},</if>
            <if test="islive != null">#{islive},</if>
            <if test="ismic != null">#{ismic},</if>
            <if test="isvideo != null">#{isvideo},</if>
            <if test="lat != null">#{lat},</if>
            <if test="liveFunction != null">#{liveFunction},</if>
            <if test="liveLockStatus != null">#{liveLockStatus},</if>
            <if test="lng != null">#{lng},</if>
            <if test="nickname != null">#{nickname},</if>
            <if test="notice != null">#{notice},</if>
            <if test="province != null">#{province},</if>
            <if test="pull != null">#{pull},</if>
            <if test="roomAdsId0 != null">#{roomAdsId0},</if>
            <if test="roomAdsId1 != null">#{roomAdsId1},</if>
            <if test="roomAdsId2 != null">#{roomAdsId2},</if>
            <if test="roomAdsId3 != null">#{roomAdsId3},</if>
            <if test="roomAdsId4 != null">#{roomAdsId4},</if>
            <if test="roomAdsId5 != null">#{roomAdsId5},</if>
            <if test="roomAdsId6 != null">#{roomAdsId6},</if>
            <if test="roomAdsId7 != null">#{roomAdsId7},</if>
            <if test="roomAdsId8 != null">#{roomAdsId8},</if>
            <if test="roomStatus != null">#{roomStatus},</if>
            <if test="roomType != null">#{roomType},</if>
            <if test="roomTypeVal != null">#{roomTypeVal},</if>
            <if test="shopLiveBanner != null">#{shopLiveBanner},</if>
            <if test="shopRoomLabel != null">#{shopRoomLabel},</if>
            <if test="showid != null">#{showid},</if>
            <if test="sort != null">#{sort},</if>
            <if test="starttime != null">#{starttime},</if>
            <if test="stream != null">#{stream},</if>
            <if test="tabName != null">#{tabName},</if>
            <if test="tabStyle != null">#{tabStyle},</if>
            <if test="thumb != null">#{thumb},</if>
            <if test="thumbAuditBy != null">#{thumbAuditBy},</if>
            <if test="thumbAuditReason != null">#{thumbAuditReason},</if>
            <if test="thumbAuditTime != null">#{thumbAuditTime},</if>
            <if test="thumbState != null">#{thumbState},</if>
            <if test="title != null">#{title},</if>
            <if test="userId != null">#{userId},</if>
         </trim>
    </insert>

    <update id="updateLiveLive" parameterType="com.game.business.domain.LiveLive">
        update live_live
        <trim prefix="SET" suffixOverrides=",">
            <if test="address != null">address = #{address},</if>
            <if test="adsTemplateId != null">ads_template_id = #{adsTemplateId},</if>
            <if test="avatar != null">avatar = #{avatar},</if>
            <if test="bankerCoin != null">banker_coin = #{bankerCoin},</if>
            <if test="channelId != null">channel_id = #{channelId},</if>
            <if test="city != null">city = #{city},</if>
            <if test="demoAccount != null">demo_account = #{demoAccount},</if>
            <if test="gameAction != null">game_action = #{gameAction},</if>
            <if test="goodnum != null">goodnum = #{goodnum},</if>
            <if test="hotSortId != null">hot_sort_id = #{hotSortId},</if>
            <if test="hotvotes != null">hotvotes = #{hotvotes},</if>
            <if test="importTemplateId != null">import_template_id = #{importTemplateId},</if>
            <if test="isEnableTemplate != null">is_enable_template = #{isEnableTemplate},</if>
            <if test="isRecommend != null">is_recommend = #{isRecommend},</if>
            <if test="islive != null">islive = #{islive},</if>
            <if test="ismic != null">ismic = #{ismic},</if>
            <if test="isvideo != null">isvideo = #{isvideo},</if>
            <if test="lat != null">lat = #{lat},</if>
            <if test="liveFunction != null">live_function = #{liveFunction},</if>
            <if test="liveLockStatus != null">live_lock_status = #{liveLockStatus},</if>
            <if test="lng != null">lng = #{lng},</if>
            <if test="nickname != null">nickname = #{nickname},</if>
            <if test="notice != null">notice = #{notice},</if>
            <if test="province != null">province = #{province},</if>
            <if test="pull != null">pull = #{pull},</if>
            <if test="roomAdsId0 != null">room_ads_id0 = #{roomAdsId0},</if>
            <if test="roomAdsId1 != null">room_ads_id1 = #{roomAdsId1},</if>
            <if test="roomAdsId2 != null">room_ads_id2 = #{roomAdsId2},</if>
            <if test="roomAdsId3 != null">room_ads_id3 = #{roomAdsId3},</if>
            <if test="roomAdsId4 != null">room_ads_id4 = #{roomAdsId4},</if>
            <if test="roomAdsId5 != null">room_ads_id5 = #{roomAdsId5},</if>
            <if test="roomAdsId6 != null">room_ads_id6 = #{roomAdsId6},</if>
            <if test="roomAdsId7 != null">room_ads_id7 = #{roomAdsId7},</if>
            <if test="roomAdsId8 != null">room_ads_id8 = #{roomAdsId8},</if>
            <if test="roomStatus != null">room_status = #{roomStatus},</if>
            <if test="roomType != null">room_type = #{roomType},</if>
            <if test="roomTypeVal != null">room_type_val = #{roomTypeVal},</if>
            <if test="shopLiveBanner != null">shop_live_banner = #{shopLiveBanner},</if>
            <if test="shopRoomLabel != null">shop_room_label = #{shopRoomLabel},</if>
            <if test="showid != null">showid = #{showid},</if>
            <if test="sort != null">sort = #{sort},</if>
            <if test="starttime != null">starttime = #{starttime},</if>
            <if test="stream != null">stream = #{stream},</if>
            <if test="tabName != null">tab_name = #{tabName},</if>
            <if test="tabStyle != null">tab_style = #{tabStyle},</if>
            <if test="thumb != null">thumb = #{thumb},</if>
            <if test="thumbAuditBy != null">thumb_audit_by = #{thumbAuditBy},</if>
            <if test="thumbAuditReason != null">thumb_audit_reason = #{thumbAuditReason},</if>
            <if test="thumbAuditTime != null">thumb_audit_time = #{thumbAuditTime},</if>
            <if test="thumbState != null">thumb_state = #{thumbState},</if>
            <if test="title != null">title = #{title},</if>
            <if test="userId != null">user_id = #{userId},</if>
        </trim>
        where id = #{id}
    </update>

    <delete id="deleteLiveLiveById" parameterType="Long">
        delete from live_live where id = #{id}
    </delete>

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