<?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.batch.mapper.KuaishouTemplateMapper">

    <select id="getJsonArrByAccountId" resultType="com.alibaba.fastjson.JSONObject">
        SELECT
            t1.account_id AS 'accountId',
            t1.template_id AS 'templateId',
            t1.template_name AS 'templateName',
            t1.unit_count AS 'unitCount',
            t2.platform_os AS 'platformOs'
        FROM
            ctop_kuaishou_template t1
                LEFT JOIN ctop_kuaishou_template_target t2 ON t1.template_id = t2.template_id
        WHERE
            t1.account_id = #{accountId}
        <if test="platformOs != null">
            AND t2.platform_os = #{platformOs}
        </if>
    </select>

</mapper>