<?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.lz.modules.third.dao.ThirdMsgSendRecordMapper">

    <!-- 通用查询映射结果 -->
    <resultMap id="BaseResultMap" type="com.lz.modules.third.entity.ThirdMsgSendRecord">
        <id column="id" property="id"/>
        <result column="is_delete" property="isDelete"/>
        <result column="create_time" property="createTime"/>
        <result column="update_time" property="updateTime"/>
        <result column="msg_type" property="msgType"/>
        <result column="head_bgcolor" property="headBgcolor"/>
        <result column="head_text" property="headText"/>
        <result column="msg_title" property="msgTitle"/>
        <result column="msg_content" property="msgContent"/>
        <result column="media_id" property="mediaId"/>
        <result column="duration" property="duration"/>
        <result column="msg_url" property="msgUrl"/>
        <result column="pic_url" property="picUrl"/>
        <result column="pc_url" property="pcUrl"/>
        <result column="form" property="form"/>
        <result column="rich_num" property="richNum"/>
        <result column="rich_unit" property="richUnit"/>
        <result column="file_count" property="fileCount"/>
        <result column="author" property="author"/>
        <result column="action_card_btn_orientation" property="actionCardBtnOrientation"/>
        <result column="action_card_btn_list" property="actionCardBtnList"/>
        <result column="staff_id" property="staffId"/>
        <result column="status" property="status"/>
        <result column="app_id" property="appId"/>
        <result column="task_id" property="taskId"/>
        <result column="remark" property="remark"/>
    </resultMap>


    <!-- 通用查询结果列 -->
    <sql id="Base_Column_List">
        id AS id, is_delete AS isDelete, create_time AS createTime, update_time AS updateTime, msg_type AS msgType, head_bgcolor AS headBgcolor, head_text AS headText, msg_title AS msgTitle, msg_content AS msgContent, media_id AS mediaId, duration AS duration, msg_url AS msgUrl, pic_url AS picUrl, pc_url AS pcUrl, form AS form, rich_num AS richNum, rich_unit AS richUnit, file_count AS fileCount, author AS author, action_card_btn_orientation AS actionCardBtnOrientation, action_card_btn_list AS actionCardBtnList, staff_id AS staffId, status AS status, app_id AS appId, task_id AS taskId, remark AS remark
    </sql>




    <select id="selectThirdMsgSendRecordById" resultType="ThirdMsgSendRecord" >
        select * from third_msg_send_record  where id=#{id} and is_delete = 0 limit 1 
    </select>


    <insert id="insertThirdMsgSendRecord" parameterType="ThirdMsgSendRecord" useGeneratedKeys="true" keyProperty="id" >
        insert into third_msg_send_record(
            <if test="createTime != null">create_time, </if>
            <if test="updateTime != null">update_time, </if>
            <if test="msgType != null">msg_type, </if>
            <if test="headBgcolor != null">head_bgcolor, </if>
            <if test="headText != null">head_text, </if>
            <if test="msgTitle != null">msg_title, </if>
            <if test="msgContent != null">msg_content, </if>
            <if test="mediaId != null">media_id, </if>
            <if test="duration != null">duration, </if>
            <if test="msgUrl != null">msg_url, </if>
            <if test="picUrl != null">pic_url, </if>
            <if test="pcUrl != null">pc_url, </if>
            <if test="form != null">form, </if>
            <if test="richNum != null">rich_num, </if>
            <if test="richUnit != null">rich_unit, </if>
            <if test="fileCount != null">file_count, </if>
            <if test="author != null">author, </if>
            <if test="actionCardBtnOrientation != null">action_card_btn_orientation, </if>
            <if test="actionCardBtnList != null">action_card_btn_list, </if>
            <if test="staffId != null">staff_id, </if>
            <if test="status != null">status, </if>
            <if test="appId != null">app_id, </if>
            <if test="taskId != null">task_id, </if>
            <if test="remark != null">remark, </if>
            is_delete,
            gmt_create,
            gmt_modified
        )values(
            <if test="createTime != null">#{ createTime}, </if>
            <if test="updateTime != null">#{ updateTime}, </if>
            <if test="msgType != null">#{ msgType}, </if>
            <if test="headBgcolor != null">#{ headBgcolor}, </if>
            <if test="headText != null">#{ headText}, </if>
            <if test="msgTitle != null">#{ msgTitle}, </if>
            <if test="msgContent != null">#{ msgContent}, </if>
            <if test="mediaId != null">#{ mediaId}, </if>
            <if test="duration != null">#{ duration}, </if>
            <if test="msgUrl != null">#{ msgUrl}, </if>
            <if test="picUrl != null">#{ picUrl}, </if>
            <if test="pcUrl != null">#{ pcUrl}, </if>
            <if test="form != null">#{ form}, </if>
            <if test="richNum != null">#{ richNum}, </if>
            <if test="richUnit != null">#{ richUnit}, </if>
            <if test="fileCount != null">#{ fileCount}, </if>
            <if test="author != null">#{ author}, </if>
            <if test="actionCardBtnOrientation != null">#{ actionCardBtnOrientation}, </if>
            <if test="actionCardBtnList != null">#{ actionCardBtnList}, </if>
            <if test="staffId != null">#{ staffId}, </if>
            <if test="status != null">#{ status}, </if>
            <if test="appId != null">#{ appId}, </if>
            <if test="taskId != null">#{ taskId}, </if>
            <if test="remark != null">#{ remark}, </if>
            0,
            now(),
            now()
        )
    </insert>


    <update id="updateThirdMsgSendRecordById" parameterType="ThirdMsgSendRecord" >
        update
            third_msg_send_record
        <trim prefix="set" suffixOverrides=",">
            <if test="isDelete != null">is_delete = #{isDelete},</if>
            <if test="createTime != null">create_time = #{createTime},</if>
            <if test="updateTime != null">update_time = #{updateTime},</if>
            <if test="msgType != null">msg_type = #{msgType},</if>
            <if test="headBgcolor != null">head_bgcolor = #{headBgcolor},</if>
            <if test="headText != null">head_text = #{headText},</if>
            <if test="msgTitle != null">msg_title = #{msgTitle},</if>
            <if test="msgContent != null">msg_content = #{msgContent},</if>
            <if test="mediaId != null">media_id = #{mediaId},</if>
            <if test="duration != null">duration = #{duration},</if>
            <if test="msgUrl != null">msg_url = #{msgUrl},</if>
            <if test="picUrl != null">pic_url = #{picUrl},</if>
            <if test="pcUrl != null">pc_url = #{pcUrl},</if>
            <if test="form != null">form = #{form},</if>
            <if test="richNum != null">rich_num = #{richNum},</if>
            <if test="richUnit != null">rich_unit = #{richUnit},</if>
            <if test="fileCount != null">file_count = #{fileCount},</if>
            <if test="author != null">author = #{author},</if>
            <if test="actionCardBtnOrientation != null">action_card_btn_orientation = #{actionCardBtnOrientation},</if>
            <if test="actionCardBtnList != null">action_card_btn_list = #{actionCardBtnList},</if>
            <if test="staffId != null">staff_id = #{staffId},</if>
            <if test="status != null">status = #{status},</if>
            <if test="appId != null">app_id = #{appId},</if>
            <if test="taskId != null">task_id = #{taskId},</if>
            <if test="remark != null">remark = #{remark}</if>                
        </trim>
        ,gmt_modified = now()
        where id = #{id}
    </update>


    <update id="updateCoverThirdMsgSendRecordById" parameterType="ThirdMsgSendRecord" >
        update
            third_msg_send_record    
        set     
            is_delete = #{isDelete},
            create_time = #{createTime},
            update_time = #{updateTime},
            msg_type = #{msgType},
            head_bgcolor = #{headBgcolor},
            head_text = #{headText},
            msg_title = #{msgTitle},
            msg_content = #{msgContent},
            media_id = #{mediaId},
            duration = #{duration},
            msg_url = #{msgUrl},
            pic_url = #{picUrl},
            pc_url = #{pcUrl},
            form = #{form},
            rich_num = #{richNum},
            rich_unit = #{richUnit},
            file_count = #{fileCount},
            author = #{author},
            action_card_btn_orientation = #{actionCardBtnOrientation},
            action_card_btn_list = #{actionCardBtnList},
            staff_id = #{staffId},
            status = #{status},
            app_id = #{appId},
            task_id = #{taskId},
            remark = #{remark}                
        ,gmt_modified = now()
        where id = #{id}
    </update>


    <update id="deleteThirdMsgSendRecordById" parameterType="java.lang.Long">
        update third_msg_send_record set is_delete = 1 where id=#{id} limit 1  
    </update>

</mapper>

