<?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.njcn.gather.script.mapper.PqScriptMapper">


    <select id="selectScriptIsValueType" resultType="java.lang.Boolean">
        SELECT
            IF((SELECT CODE FROM sys_dict_data WHERE id = Value_Type) = 'Ratio', 'true', 'false')
        FROM
            pq_script
        where
            State=1
        and Id = #{scriptId}
    </select>
    <select id="getBoundCountByScriptIds" resultType="java.lang.Integer">
        SELECT COUNT(*) FROM ad_plan
        <if test="scriptIds !=null and scriptIds.size()!=0">
            <where>
                AND Script_Id in
                <foreach collection="scriptIds" item="item" open="(" separator="," close=")">
                    #{item}
                </foreach>
            </where>
        </if>
        AND State=1
    </select>
</mapper>

