TdCPushMsgSMapper.xml
5.82 KB
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
<?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.zteits.pay.mapper.smapper.TdCPushMsgSMapper">
<resultMap id="BaseResultMap" type="com.zteits.pay.domain.TdCPushMsg">
<id column="id" jdbcType="BIGINT" property="id"/>
<result column="cust_id" jdbcType="VARCHAR" property="custId"/>
<result column="msg_title" jdbcType="VARCHAR" property="msgTitle"/>
<result column="msg_content" jdbcType="VARCHAR" property="msgContent"/>
<result column="msg_type" jdbcType="INTEGER" property="msgType"/>
<result column="templete_id" jdbcType="VARCHAR" property="templeteId"/>
<result column="push_type" jdbcType="INTEGER" property="pushType"/>
<result column="return_type" jdbcType="INTEGER" property="returnType"/>
<result column="read_type" jdbcType="INTEGER" property="readType"/>
<result column="data_state" jdbcType="INTEGER" property="dataState"/>
<result column="create_empid" jdbcType="VARCHAR" property="createEmpid"/>
<result column="create_date" jdbcType="TIMESTAMP" property="createDate"/>
<result column="modfiy_empid" jdbcType="VARCHAR" property="modfiyEmpid"/>
<result column="modfiy_date" jdbcType="TIMESTAMP" property="modfiyDate"/>
<result column="out_msg_no" jdbcType="VARCHAR" property="outMsgNo"/>
</resultMap>
<sql id="Base_Column_List">
id, cust_id, msg_title, msg_content, msg_type, templete_id, push_type, return_type,
read_type, data_state, create_empid, create_date, modfiy_empid, modfiy_date, out_msg_no
</sql>
<!-- 推送消息中心首页,查询各消息类型的最新一条 -->
<select id="getLatestPushedMessages" parameterType="com.zteits.clouds.api.dto.pay.param.JPushMessageRequest"
resultType="com.zteits.pay.domain.JPushMessageDO">
SELECT B.msg_title title,
B.msg_content msgContent,
date_format(B.create_date, '%Y-%m-%d %H:%i:%s') msgTime,
B.msg_type msgType
FROM (select max(id) id
from td_c_push_msg b
where b.return_type = 1
and b.data_state = 1
and b.cust_id = #{custId}
group by b.msg_type) A
left join td_c_push_msg B on A.id =B.id
order by B.create_date desc
</select>
<!-- 推送消息中心-消息详情,查询某一消息的详情 -->
<select id="getPushedMessageDetails" parameterType="com.zteits.clouds.api.dto.pay.param.JPushMessageRequest"
resultType="com.zteits.pay.domain.JPushMessageDO">
select
msg_title title,
msg_content msgContent,
date_format(create_date, '%Y-%m-%d %H:%i:%s') msgTime,
msg_type msgType
from td_c_push_msg
where
msg_type=#{msgType}
<if test="custId != null and custId !=''">
and cust_id=#{custId}
</if>
and return_type=1
and data_state=1
order by create_date Desc
</select>
<!-- 消息中心-删除消息,删除出某一种消息的详情 -->
<delete id="deletePushedMessageDetails" parameterType="com.zteits.clouds.api.dto.pay.param.JPushMessageRequest">
delete
from td_c_push_msg
where
msg_type=#{msgType}
and cust_id=#{custId};
</delete>
<select id="queryParkOrderByCondition" parameterType="com.zteits.clouds.api.dto.pay.JPushMsgQueryRequest"
resultMap="BaseResultMap">
select
<include refid="Base_Column_List"/>
from td_c_push_msg
where cust_id=#{custId}
and msg_type=#{msgType}
and create_date = date(#{queryDate})
and data_state = 1
<if test="templeteIds != null and templeteIds.size > 0">
and templete_id in
<foreach collection="templeteIds" open="(" close=")" item="templeteId" separator=",">
#{templeteId}
</foreach>
</if>
</select>
<!-- 新版消息中心首页-查询未读消息条数 -->
<select id="countUnreadMessage" resultType="com.zteits.clouds.api.dto.pay.NewMessagePushDTO"
parameterType="com.zteits.clouds.api.dto.owner.param.QueryMessageRequest">
select
count(case when ap.msg_type=1 then 1 ELSE NULL
END) accountUnreads,
count(case when ap.msg_type=6 then 1 ELSE NULL
END) activityUnreads,
count(case when ap.msg_type in(2,3,4,5,7) then 1 ELSE NULL
END) systemUnreads,
count(case when ap.msg_type=9 then 1 ELSE NULL
END) questionUnreads
from td_c_push_msg ap
where data_state=1
and read_type = 0
and cust_id = #{custId,jdbcType=VARCHAR}
</select>
<!-- 新版消息中心-更新消息未读状态 -->
<update id="updateUnreadMessage" parameterType="com.zteits.clouds.api.dto.owner.param.QueryMessageRequest">
update
td_c_push_msg
set read_type = 1,
<if test="modfiyEmpid != null" >
modfiy_empid = #{modfiyEmpid,jdbcType=VARCHAR},
</if>
<if test="modfiyDate != null" >
modfiy_date = #{modfiyDate,jdbcType=TIMESTAMP}
</if>
where data_state=1
<if test="messageType == '1'.toString()" >
and msg_type = 1
</if>
<if test="messageType == '2'.toString()" >
and msg_type = 6
</if>
<if test="messageType == '4'.toString()" >
and msg_type = 9
</if>
<if test="messageType == '3'.toString()" >
and msg_type in (2,3,4,5,7)
</if>
and read_type = 0
and cust_id = #{custId,jdbcType=VARCHAR}
</update>
</mapper>