<?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="org.jeecg.modules.bytedance.advertise.mapper.BytedanceVideoSlogenInfoMapper">
    <select id="selectVideoSlogenReportByAccountIdAndTitle" resultType="java.util.HashMap">
        SELECT
            a.id,
            a.status,
            a.slogan,
            a.project_id AS projectId
        FROM
            ctop_bytedance_video_slogen_info a
            <where>
                <if test="projectIds!=null">
                    AND a.project_id IN
                    <foreach item="item" index="index" collection="projectIds"
                             open="(" separator="," close=")">
                        #{item}
                    </foreach>
                </if>
                <if test="status!=null">and a.status = #{status}</if>
                <if test="keyWord!=null and keyWord!=''">and a.slogan like concat('%',#{keyWord},'%')</if>
                <if test="startTime!=null and startTime != ''">and STR_TO_DATE(a.create_time,'%Y-%m-%d') &gt;=
                    STR_TO_DATE(#{startTime},'%Y-%m-%d')
                </if>
                <if test="endTime!=null and endTime!=''">and STR_TO_DATE(a.create_time,'%Y-%m-%d') &lt;=
                    STR_TO_DATE(#{endTime},'%Y-%m-%d')
                </if>
        </where>

    </select>

    <select id="getProjectByUserId" resultType="java.lang.String">
        select
            project.id
        from
            ctop_project_member member left join ctop_project project on project.id = member.project_id
        where
            member.user_id = #{userId}
    </select>


    <select id="getDataBySlogenAndProjectId" resultType="org.jeecg.modules.bytedance.advertise.entity.BytedanceVideoSlogenInfo">
    SELECT
        t1.*,t2.material_name
    FROM
        ctop_bytedance_video_slogen_info t1
    LEFT JOIN ctop_material_info t2 ON t1.video_code = t2.code
    AND t1.project_id = t2.project_id
    WHERE
        slogan =#{slogan} and t1.project_id = #{projectId}
    </select>
</mapper>