CustomerServiceMessageMapper.xml
6.38 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
<?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.com.glsx.dj.weapp.mapper.CustomerServiceMessageMapper" >
<resultMap id="BaseResultMap" type="cn.com.glsx.dj.weapp.model.CustomerServiceMessage" >
<!--
WARNING - @mbg.generated
-->
<id column="id" property="id" jdbcType="INTEGER" />
<result column="account_id" property="accountId" jdbcType="INTEGER" />
<result column="merchant_id" property="merchantId" jdbcType="INTEGER" />
<result column="send_type" property="sendType" jdbcType="CHAR" />
<result column="send_status" property="sendStatus" jdbcType="CHAR" />
<result column="message_status" property="messageStatus" jdbcType="CHAR" />
<result column="message_type" property="messageType" jdbcType="VARCHAR" />
<result column="message_cover" property="messageCover" jdbcType="VARCHAR" />
<result column="message_content" property="messageContent" jdbcType="VARCHAR" />
<result column="avatar_url" property="avatarUrl" jdbcType="VARCHAR" />
<result column="created_by" property="createdBy" jdbcType="VARCHAR" />
<result column="created_date" property="createdDate" jdbcType="TIMESTAMP" />
<result column="updated_by" property="updatedBy" jdbcType="VARCHAR" />
<result column="updated_date" property="updatedDate" jdbcType="TIMESTAMP" />
<result column="deleted_flag" property="deletedFlag" jdbcType="CHAR" />
</resultMap>
<resultMap id="DTOResultMap" type="cn.com.glsx.dj.weapp.dto.CustomerServiceMessageDTO" extends="BaseResultMap">
<result column="avatar_url" property="avatarUrl" jdbcType="VARCHAR" />
<result column="nick_name" property="nickName" jdbcType="VARCHAR" />
<result column="phone" property="phone" jdbcType="VARCHAR" />
<result column="message_content_new" property="messageContentNew" jdbcType="VARCHAR" />
<result column="message_type_new" property="messageTypeNew" jdbcType="VARCHAR" />
<result column="unread_count" property="unreadCount" jdbcType="VARCHAR" />
</resultMap>
<sql id="Base_Column_List" >
<!--
WARNING - @mbg.generated
-->
id, account_id, merchant_id, send_type, send_status, message_status, message_type, message_cover, message_content,avatar_url,
created_by, created_date, updated_by, updated_date, deleted_flag
</sql>
<select id="countByMerchantId" parameterType="java.lang.Integer" resultType="java.lang.Integer" >
select count(*) from dj_weapp_customer_service_message
WHERE message_status='N' AND deleted_flag='N' and send_type='C'
AND merchant_id = #{merchantId,jdbcType=INTEGER}
</select>
<select id="getByAccountId" resultMap="DTOResultMap">
select
a.id, a.account_id, a.merchant_id, a.send_type, a.message_status, a.message_type, a.message_cover, a.message_content, a.avatar_url, a.created_date, a.created_by,
b.avatar_url,b.nick_name,b.phone,b.message_type_new,b.message_content_new,b.unread_count
from dj_weapp_customer_service_message a
LEFT JOIN dj_weapp_customer_service_message_catalog b on a.merchant_id=b.merchant_id
where a.account_id=b.account_id and a.account_id = #{accountId} and a.merchant_id = #{merchantId} and a.deleted_flag = 'N' and b.deleted_flag='N' order by a.created_date
</select>
<select id="getUnreadByAccountId" resultMap="DTOResultMap">
select
a.id, a.account_id, a.merchant_id, a.send_type, a.message_status, a.message_type, a.message_cover, a.message_content, a.avatar_url, a.created_date, a.created_by,
b.avatar_url,b.nick_name,b.phone,b.message_type_new,b.message_content_new,b.unread_count
from dj_weapp_customer_service_message a
LEFT JOIN dj_weapp_customer_service_message_catalog b on a.merchant_id=b.merchant_id
where a.account_id=b.account_id and a.account_id = #{record.accountId}
and a.send_type=#{record.sendType} and a.merchant_id = #{record.merchantId}
and a.deleted_flag = 'N' and a.message_status='N' and b.deleted_flag='N' order by a.created_date
</select>
<select id="getByMerchantId" parameterType="java.lang.Integer"
resultMap="BaseResultMap">
select
<include refid="Base_Column_List" />
from dj_weapp_customer_service_message
where merchant_id = #{merchantId} and deleted_flag = 'N'
</select>
<select id="getMerchantByUnread" resultMap="BaseResultMap">
select
<include refid="Base_Column_List" />
from dj_weapp_customer_service_message a
where message_status= #{status} and send_type=#{type} and deleted_flag = 'N'
</select>
<update id="updateByAccountId" parameterType="cn.com.glsx.dj.weapp.model.CustomerServiceMessage" >
update dj_weapp_customer_service_message
<set >
<if test="record.merchantId != null" >
merchant_id = #{record.merchantId,jdbcType=INTEGER},
</if>
<if test="record.sendType != null" >
send_type = #{record.sendType,jdbcType=CHAR},
</if>
<if test="record.sendStatus != null" >
send_status = #{record.sendStatus,jdbcType=CHAR},
</if>
<if test="record.messageStatus != null" >
message_status = #{record.messageStatus,jdbcType=CHAR},
</if>
<if test="record.messageType != null" >
message_type = #{record.messageType,jdbcType=VARCHAR},
</if>
<if test="record.messageCover != null" >
message_cover = #{record.messageCover,jdbcType=VARCHAR},
</if>
<if test="record.messageContent != null" >
message_content = #{record.messageContent,jdbcType=VARCHAR},
</if>
<if test="record.avatarUrl != null" >
avatar_url = #{record.avatarUrl,jdbcType=VARCHAR},
</if>
<if test="record.createdBy != null" >
created_by = #{record.createdBy,jdbcType=VARCHAR},
</if>
<if test="record.createdDate != null" >
created_date = #{record.createdDate,jdbcType=TIMESTAMP},
</if>
<if test="record.updatedBy != null" >
updated_by = #{record.updatedBy,jdbcType=VARCHAR},
</if>
<if test="record.updatedDate != null" >
updated_date = #{record.updatedDate,jdbcType=TIMESTAMP},
</if>
<if test="record.deletedFlag != null" >
deleted_flag = #{record.deletedFlag,jdbcType=CHAR},
</if>
</set>
where account_id = #{record.accountId,jdbcType=INTEGER} and send_type=#{record.sendType,jdbcType=CHAR}
and merchant_id = #{record.merchantId,jdbcType=INTEGER} and deleted_flag='N'
</update>
</mapper>