<?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.SmsSendMapper">

    <!-- 通用查询映射结果 -->
    <resultMap id="BaseResultMap" type="com.fzm.mall.server.admin.message.model.SmsSend">
        <id column="id" property="id"/>
        <result column="sms_no" property="smsNo"/>
        <result column="addressee" property="addressee"/>
        <result column="template_code" property="templateCode"/>
        <result column="addressee_type" property="addresseeType"/>
        <result column="send_type" property="sendType"/>
        <result column="status" property="status"/>
        <result column="send_time" property="sendTime"/>
        <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.SmsSendVO">
        SELECT
        A.sms_no,B.template_content,A.addressee,A.send_time,A.status,A.addressee_type
        FROM
        sms_send A
        LEFT JOIN
        sms_template B
        ON
        A.template_code = B.template_code
        <where>
            A.status != 0
            <if test="smsNo!=null and smsNo!=''">
                A.sms_no = #{smsNo}
            </if>
            <if test="keyWord!=null and keyWord!=''">
                <bind name="keyWord" value="'%' + keyWord + '%'"/>
                AND
                B.template_content LIKE #{keyWord}
            </if>
        </where>
        ORDER BY
        create_time
        DESC
    </select>
</mapper>
