yangys
2024-04-04 2cf2921440e7473ae50796c2cb688f609b3a7995
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
<?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.qianwen.smartman.modules.notify.mapper.NotifyHistoryEntityMapper">
 
    <select id="listPage" resultType="com.qianwen.smartman.modules.notify.entity.NotifyHistoryEntity">
        SELECT
        nh.id,
        nh.context_data as contextData,
        nh.notify_type,
        bn.business_name AS businessName,
        nh.state,
        nh.create_time,
        nt.template,
        nt.NAME AS templateName,
        nh.provider,
        nh.template_id AS templateId,
        nh.create_time AS notifyTime
        FROM
        blade_notify_history nh
        LEFT JOIN blade_notify_template nt ON nh.template_id = nt.id
        LEFT JOIN blade_business_notify bn ON bn.notify_template_id = nt.id
        <where>
            <if test="beginTime != null and endTime != null">
                nh.create_time BETWEEN TO_DATE(#{beginTime},'yyyy-mm-dd hh24:mi:ss')
                AND TO_DATE(#{endTime},'yyyy-mm-dd hh24:mi:ss')
            </if>
            <if test="keyword !=null and keyword != ''">
                <choose>
                    <when test="keyword == '调试'">
                        AND nh.template_id is null
                    </when>
                    <otherwise>
                        AND bn.business_name LIKE CONCAT(#{keyword},'%')
                    </otherwise>
                </choose>
            </if>
            <if test="state !=null and state != ''">
                AND nh.state = #{state}
            </if>
        </where>
        ORDER BY nh.create_time DESC
    </select>
</mapper>