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
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
<?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.SmsTemplateMapper">
 
    <!--自定义列表查询-->
    <select id="selectSmsTemplatePage" resultType="cn.gistack.alerts.sms.vo.SmsTemplateVO">
        select * from sm_sms_template where is_deleted = 0
        <if test="smsTemplate.templateName!=null and smsTemplate.templateName!=''">
            and template_name like concat(concat('%',#{smsTemplate.templateName}),'%')
        </if>
        <if test="smsTemplate.templateId!=null and smsTemplate.templateId!=''">
            and template_id like concat(concat('%',#{smsTemplate.templateId}),'%')
        </if>
        <if test="smsTemplate.noticeType!=null and smsTemplate.noticeType!=''">
            and notice_type = #{smsTemplate.noticeType}
        </if>
        <if test="smsTemplate.type!=null and smsTemplate.type!=''">
            and type = #{smsTemplate.type}
        </if>
        <if test="smsTemplate.smsType!=null">
            and sms_type = #{smsTemplate.smsType}
        </if>
        <if test="smsTemplate.noticeMode!=null and smsTemplate.noticeMode!=''">
            and notice_mode = #{smsTemplate.noticeMode}
        </if>
    </select>
 
    <!--查询当前任务未接通的人员信息(包含水库编号)-MYSQL-->
    <select id="getNotConnectPatrolPersonList" resultType="java.util.Map">
        select ctc.callee_number as userPhone,ctc.task_id as taskId,ctc.call_id callId,
            TRIM(BOTH '"' FROM JSON_EXTRACT(ctc.call_task_callee_content,'$."$水库编码$"')) as waterCode,
            TRIM(BOTH '"' FROM JSON_EXTRACT(ctc.call_task_callee_content,'$."$水库名称$"')) as waterName,
            TRIM(BOTH '"' FROM JSON_EXTRACT(ctc.call_task_callee_content,'$."$用户名$"')) as userName
        from call_task_callee ctc left join call_task_result ctr on ctc.call_id = ctr.call_id
        where 1=1
        and ctr.call_result!='200000'
        <choose>
            <when test="taskIdList != null and taskIdList.size()>0">
                and ctc.task_id in
                <foreach collection="taskIdList" item="id" separator ="," open="("  close=")">
                    #{id}
                </foreach>
            </when>
            <otherwise>
                and ctc.task_id in ('')
            </otherwise>
        </choose>
        <if test="callId!=null and callId!=''">
            and ctc.call_id = #{callId}
        </if>
    </select>
 
    <!--查询符合当前时间外呼任务id集合-->
    <select id="getTaskIdListByTime" resultType="java.lang.String">
        select task_id from sm_call_sms_notice_task
        where 1=1
        and date_format(start_time,'%Y-%m-%d %H:%i:%s') &lt;= #{time}
        and date_format(end_time,'%Y-%m-%d %H:%i:%s') >= #{time}
    </select>
 
    <!--获取短信类型树(当为告警是显示告警规则名称)-->
    <select id="getSmsTypeTree" resultType="cn.gistack.common.node.TreeNode">
        select dict_key as id, parent_id as parentId, dict_value as name, 1 as level from YWXT.blade_dict_biz
        WHERE 1=1
        and code = 'SMS_TYPE' and parent_id > 0 and is_sealed = 0 and is_deleted = 0
        union all
        select id,'2' as parentId ,rule_name as name,2 as level from YWXT.sm_alarm_rule
        where 1=1 and is_deleted = 0
    </select>
</mapper>