xieb
2023-10-19 1dd5d8f8a616f5cf3caa7828d46989c7d3dcafc4
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
<?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="cn.gistack.alerts.sms.mapper.SmsResultMapper">
 
    <!--自定义分页列表查询-->
    <select id="selectSmsResultPage" resultType="cn.gistack.alerts.sms.vo.SmsResultVO">
        select ssr.*,
        sar.rule_name as ruleName,
        sst.content templateContent,sst.sms_type as smsType
        from sm_sms_result ssr
        left join sm_sms_template sst on sst.template_id = ssr.template_id and sst.is_deleted = 0
        left join YWXT.sm_alarm_rule_detail sard on sard.template_id = sst.id
        left join YWXT.sm_alarm_rule sar on sar.id = sard.alarm_rule_id
        where 1=1 and ssr.is_deleted = 0
        <if test="smsResult.templateId!=null and smsResult.templateId!=''">
            and ssr.template_id = #{smsResult.templateId}
        </if>
        <if test="smsResult.resCode==0">
            and ssr.res_code =0
        </if>
        <if test="smsResult.resCode==1">
            and ssr.res_code !=0
        </if>
        <if test="smsResult.templateContent!=null and smsResult.templateContent!=''">
            and sst.content like concat('%',#{smsResult.templateContent},'%')
        </if>
        <if test="smsResult.startTime!=null and smsResult.startTime!=''">
            and date_format(ssr.create_time,'%Y-%m-%d') >= #{smsResult.startTime}
        </if>
        <if test="smsResult.endTime!=null and smsResult.endTime!=''">
            and date_format(ssr.create_time,'%Y-%m-%d') &lt;= #{smsResult.endTime}
        </if>
        <if test="smsResult.smsType!=null and smsResult.smsType!=''">
            and sst.sms_type = #{smsResult.smsType}
        </if>
        <if test="list!=null and list.size()>0">
            and sst.template_id in
            <foreach collection="list" item="id" separator ="," open="("  close=")">
                #{id}
            </foreach>
        </if>
        order by id desc
    </select>
 
</mapper>