<?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.ktg.iscs.mapper.IsMailNotifyConfigMapper">

    <select id="getIsMailNotifyConfigPage" resultType="com.ktg.iscs.domain.IsMailNotifyConfig">
        select c.*, t.template_name
            from is_mail_notify_config c
            left join is_mail_template t on t.template_code = c.template_code
        <where>
            <if test="isMailNotifyConfig.name != null and isMailNotifyConfig.name.trim != ''">
                and c.name like concat('%',#{isMailNotifyConfig.name},'%')
            </if>
            <if test="isMailNotifyConfig.templateCode != null and isMailNotifyConfig.templateCode.trim != ''">
                and c.template_code like concat('%',#{isMailNotifyConfig.templateCode},'%')
            </if>
            <if test="isMailNotifyConfig.templateName != null and isMailNotifyConfig.templateName.trim != ''">
                and t.template_name like concat('%',#{isMailNotifyConfig.templateName},'%')
            </if>
        </where>
        order by c.create_time desc
    </select>
</mapper>
