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
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
<?xml version="1.0" encoding="UTF-8"?>
<!--
~
~ Copyright (c) 2018-2025, lengleng All rights reserved.
~
~ Redistribution and use in source and binary forms, with or without
~ modification, are permitted provided that the following conditions are met:
~
~ Redistributions of source code must retain the above copyright notice,
~ this list of conditions and the following disclaimer.
~ Redistributions in binary form must reproduce the above copyright
~ notice, this list of conditions and the following disclaimer in the
~ documentation and/or other materials provided with the distribution.
~ Neither the name of the yifu4cloud.com developer nor the names of its
~ contributors may be used to endorse or promote products derived from
~ this software without specific prior written permission.
~ Author: lengleng (wangiegie@gmail.com)
~
-->
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.yifu.cloud.plus.v1.msg.mapper.MsgInfoMapper">
<resultMap id="msgInfoMap" type="com.yifu.cloud.plus.v1.msg.entity.MsgInfo">
<id property="id" column="ID"/>
<result property="orderId" column="ORDER_ID"/>
<result property="url" column="URL"/>
<result property="orderNo" column="ORDER_NO"/>
<result property="alertType" column="ALERT_TYPE"/>
<result property="createTime" column="CREATE_TIME"/>
<result property="readStatus" column="READ_STATUS"/>
<result property="alertUser" column="ALERT_USER"/>
<result property="domainName" column="DOMAIN_NAME"/>
</resultMap>
<sql id="Base_Column_List">
a.ID,
a.ORDER_ID,
a.URL,
a.ORDER_NO,
a.ALERT_TYPE,
a.CREATE_TIME,
a.READ_STATUS,
a.ALERT_USER,
a.DOMAIN_NAME
</sql>
<sql id="msgInfo_where">
<if test="msgInfo != null">
<if test="msgInfo.id != null and msgInfo.id.trim() != ''">
AND a.ID = #{msgInfo.id}
</if>
<if test="msgInfo.orderId != null and msgInfo.orderId.trim() != ''">
AND a.ORDER_ID = #{msgInfo.orderId}
</if>
<if test="msgInfo.url != null and msgInfo.url.trim() != ''">
AND a.URL = #{msgInfo.url}
</if>
<if test="msgInfo.orderNo != null and msgInfo.orderNo.trim() != ''">
AND a.ORDER_NO = #{msgInfo.orderNo}
</if>
<if test="msgInfo.alertType != null and msgInfo.alertType.trim() != ''">
AND a.ALERT_TYPE = #{msgInfo.alertType}
</if>
<if test="msgInfo.createTime != null">
AND a.CREATE_TIME = #{msgInfo.createTime}
</if>
<if test="msgInfo.readStatus != null and msgInfo.readStatus.trim() != ''">
AND a.READ_STATUS = #{msgInfo.readStatus}
</if>
<if test="msgInfo.alertUser != null and msgInfo.alertUser.trim() != ''">
AND a.ALERT_USER = #{msgInfo.alertUser}
</if>
</if>
</sql>
<!--msgInfo简单分页查询-->
<select id="getMsgInfoPage" resultMap="msgInfoMap">
SELECT
<include refid="Base_Column_List"/>
FROM msg_info a
<where>
1=1
<include refid="msgInfo_where"/>
</where>
</select>
<select id="getMsgInfo" resultMap="msgInfoMap">
SELECT
<include refid="Base_Column_List"/>
FROM msg_info a
<where>
1=1
<include refid="msgInfo_where"/>
</where>
</select>
<select id="getMsgByOrderId" resultMap="msgInfoMap">
SELECT
a.fd_3ac901ba3b9d3e domain_name,
p.fd_name ALERT_USER,
a.fd_3ac901c5184274 ORDER_NO,
a.fd_id ORDER_ID,
'0' as ALERT_TYPE
FROM
ekp_ea33075576149bb8a4f5 a
LEFT JOIN sys_org_element p on a.fd_3b0aff6781fa86 = p.fd_id
WHERE
a.fd_id = #{orderId} limit 1
</select>
<!-- 加急(2-3小时)|1 紧急(3-5小时)|4 常规(5-8小时)|7 -->
<select id="getMsgByTask" resultMap="msgInfoMap">
SELECT * from (
SELECT
b1.fd_3ac901ba3b9d3e domain_name,
o.fd_no ALERT_USER,
b1.fd_3ac901c5184274 ORDER_NO,
b1.fd_id ORDER_ID,
'1' AS ALERT_TYPE,
DATE_ADD(NOW(), INTERVAL 30 MINUTE) as 'date1',
IF(b1.fd_3b779ba2168eea = 1,DATE_ADD(a.fd_start_date,INTERVAL 3 HOUR),IF(b1.fd_3b779ba2168eea = 4,DATE_ADD(a.fd_start_date,INTERVAL 5 HOUR),DATE_ADD(a.fd_start_date,INTERVAL 8 HOUR))) as 'date2'
FROM
lbpm_workitem a
LEFT JOIN lbpm_node e ON e.fd_id = a.fd_node_id
LEFT JOIN lbpm_process p ON p.fd_id = e.fd_process_id
LEFT JOIN ekp_ea33075576149bb8a4f5 b1 ON p.fd_model_id = b1.fd_id
LEFT JOIN sys_org_element o ON o.fd_id = fd_expected_id
WHERE
e.fd_fact_node_id = 'N5'
AND b1.fd_id IS NOT NULL
) x
where x.date1 > date2
</select>
<select id="getMsgByTaskOne" resultMap="msgInfoMap">
SELECT
b1.fd_3ac901ba3b9d3e domain_name,
o.fd_no ALERT_USER,
b1.fd_3ac901c5184274 ORDER_NO,
b1.fd_id ORDER_ID,
'3' AS ALERT_TYPE,
b1.fd_3bddc3d6c8a734
FROM
ekp_ea33075576149bb8a4f5 b1
LEFT JOIN lbpm_process p ON p.fd_model_id = b1.fd_id
LEFT JOIN lbpm_node e ON p.fd_id = e.fd_process_id
LEFT JOIN lbpm_audit_note a ON p.fd_id=a.fd_process_id and a.fd_fact_node_id='N5'
LEFT JOIN sys_org_element o ON o.fd_id = b1.fd_3bf1511f1d618e
WHERE
b1.fd_3bddc3d6c8a734 = '待支出'
AND b1.fd_id IS NOT NULL and o.fd_id is not null
</select>
<delete id="deleteHandledMsg">
DELETE FROM msg_info where ALERT_TYPE ='0' and ORDER_NO not in (
SELECT
b1.fd_3ac901c5184274 ORDER_NO
FROM
lbpm_workitem a
LEFT JOIN lbpm_node e ON e.fd_id = a.fd_node_id
LEFT JOIN lbpm_process p ON p.fd_id = e.fd_process_id
LEFT JOIN ekp_ea33075576149bb8a4f5 b1 ON p.fd_model_id = b1.fd_id
WHERE
e.fd_fact_node_id = 'N5'
AND b1.fd_id IS NOT NULL
)
</delete>
</mapper>