<?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.bonus.canteen.core.notice.print.v2.mapper.NoticePrintTemplateSettingMapper">
    <select id="getTemplateSettingList" resultType="com.bonus.canteen.core.notice.print.v2.vo.NoticePrintTemplateSettingVO">
        SELECT t1.template_id,
               t1.setting_id,
               t1.column_id,
               t1.if_bold,
               t2.device_type,
               t2.column_group,
               t2.column_name,
               t2.column_value,
               t2.column_sample,
               t2.column_type,
               NULLIF(t1.sort, 999) sort,
               t3.setting_x,
               t3.setting_y,
               t3.setting_w,
               t3.setting_h,
               t3.setting_type,
               t3.setting_value
        FROM notice_print_template_setting t1
                 LEFT JOIN notice_print_column t2 ON t1.column_id = t2.column_id
                 LEFT JOIN notice_print_template_ext_setting t3 ON t1.setting_id = t3.setting_id
        WHERE t1.template_id = #{templateId}
        ORDER BY `sort`
    </select>

    <select id="getTemplateSettingListByTemplateIdList"
            resultType="com.bonus.canteen.core.notice.print.v2.vo.NoticePrintTemplateSettingVO">
        SELECT t1.template_id,
               t1.setting_id,
               t1.column_id,
               t1.if_bold,
               t2.device_type,
               t2.column_group,
               t2.column_name,
               t2.column_value,
               t2.column_sample,
               t2.column_type,
               IFNULL(t1.sort, 999) sort,
               t3.setting_x,
               t3.setting_y,
               t3.setting_w,
               t3.setting_h,
               t3.setting_type,
               t3.setting_value
        FROM notice_print_template_setting t1
                 LEFT JOIN notice_print_column t2 ON t1.column_id = t2.column_id
                 LEFT JOIN notice_print_template_ext_setting t3 ON t1.setting_id = t3.setting_id
        WHERE t1.template_id in
        <foreach collection="templateIdList" item="templateId" open="(" close=")" separator=",">
            #{templateId}
        </foreach>
        ORDER BY `sort`
    </select>
</mapper>
