<?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.fzm.mall.server.admin.message.mapper.SmsTemplateMapper">

    <!-- 通用查询映射结果 -->
    <resultMap id="BaseResultMap" type="com.fzm.mall.server.admin.message.model.SmsTemplate">
        <id column="id" property="id"/>
        <result column="template_name" property="templateName"/>
        <result column="template_content" property="templateContent"/>
        <result column="template_code" property="templateCode"/>
        <result column="remark" property="remark"/>
        <result column="status" property="status"/>
        <result column="reason" property="reason"/>
        <result column="create_time" property="createTime"/>
        <result column="update_time" property="updateTime"/>
    </resultMap>

    <select id="page" resultType="com.fzm.mall.server.admin.message.entity.vo.SmsTemplateVO">
        SELECT
        template_code,template_name,template_content,remark,create_time,status
        FROM
        sms_template
        <where>
            status != 0
            <if test="templateCode!=null and templateCode!=''">
                template_code = #{templateCode}
            </if>
            <if test="templateName!=null and templateName!=''">
                <bind name="templateName" value="'%' + templateName + '%'"/>
                AND
                template_name LIKE #{templateName}
            </if>
        </where>
        ORDER BY
        create_time
        DESC
    </select>
</mapper>
