<?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="cn.com.ctop.kuaishou.modules.document.mapper.AuditRejectedResubmitMapper">


    <select id="getCreativeList" resultType="cn.com.ctop.kuaishou.modules.batch.entity.KuaiShouCreative" >
        select * from ctop_kuaishou_creative t where t.status=#{status}
         <if test="date!=null and date !=''">
             and DATE_FORMAT(t.creative_create_time,'%Y-%m-%d')=#{date}
         </if>
    </select>

    <select id="getRejectThesaurusListByStatus" resultType="String">
        select phrase from ctop_reject_reason_thesaurus where type=#{status}
    </select>

    <update id="updateCreativeResubmit">
        update ctop_kuaishou_creative set resubmit=#{status} where creative_id=#{creativeId}
    </update>

    <update id="updateCreativeResubmitSize">
        update ctop_kuaishou_creative set submit_size=submit_size+1
        <if test="copyWriterId !=null and copyWriterId!=''">
            ,copy_writer_id=#{copyWriterId}
        </if>
        where creative_id=#{creativeId}
    </update>

    <insert id="saveCopyWriterCenter">
        replace into ctop_document_library_center (creative_id,copy_writer_id,create_time) values (#{creativeId},#{copyWriterId},#{date})
    </insert>
</mapper>