yangys
2024-09-04 04c57331cf84c8f606c2838dcb6fe5463fb9b68c
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 #{beginTime}
                AND #{endTime}
            </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>