cloudroam
2024-12-29 2390d668f77641f9b62e1e210d855df87ee7d390
src/main/resources/mapper/sms/SmsTaskMapper.xml
@@ -2,20 +2,34 @@
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.mzl.flower.mapper.SmsTaskMapper">
    <!-- 通用查询映射结果 -->
    <resultMap id="BaseResultMap" type="com.mzl.flower.entity.SmsTaskDO">
        <id column="id" property="id" />
        <result column="deleted" property="deleted" />
        <result column="create_by" property="createBy" />
        <result column="create_time" property="createTime" />
        <result column="update_by" property="updateBy" />
        <result column="update_time" property="updateTime" />
        <result column="name" property="name" />
        <result column="sms_template_id" property="smsTemplateId" />
        <result column="type" property="type" />
        <result column="file_url" property="fileUrl" />
        <result column="phones" property="phones" />
        <result column="num" property="num" />
    </resultMap>
    <select id="queryPage" resultType="com.mzl.flower.dto.response.sms.SmsTaskVO">
        SELECT
        t.* ,st.`name` as sms_template_name,st.description as sms_template_desc
        FROM
        t_sms_task t
        LEFT JOIN t_sms_template st ON t.sms_template_id = st.id
        where t.deleted= 0
        <if test="dto.name != null and dto.name != ''">
            and t.name like concat('%', #{dto.name}, '%')
        </if>
        <if test="dto.smsTemplateName != null and dto.smsTemplateName != ''">
            and st.name like concat('%', #{dto.smsTemplateName}, '%')
        </if>
        <if test="dto.status != null and dto.status != ''">
            and t.status =  #{dto.status}
        </if>
        <if test="dto.startDate!=null ">
            <![CDATA[
               AND t.create_time >= #{dto.startDate}
            ]]>
        </if>
        <if test="dto.endDate!=null ">
            <![CDATA[
               AND t.create_time <= #{dto.endDate}
            ]]>
        </if>
    </select>
</mapper>