u
This commit is contained in:
1 parent
28678fb4df
commit
a6dbe24dd4
43 files changed
+2285
-206
No files matched your search
@@ -46,4 +46,21 @@
|
||||
</if>
|
||||
</select>
|
||||
|
||||
<update id="incrementUnreadAndUpdateLastMessage">
|
||||
UPDATE b_im_friend
|
||||
SET
|
||||
b_last_message_id = #{lastMessageId},
|
||||
b_unread_count = b_unread_count + 1,
|
||||
b_update_time = GETDATE()
|
||||
WHERE b_user_id = #{userId} and b_friend_id = #{friendId}
|
||||
</update>
|
||||
|
||||
<update id="decreaseUnreadCount">
|
||||
UPDATE b_im_friend
|
||||
SET
|
||||
b_unread_count = 0,
|
||||
b_update_time = GETDATE()
|
||||
WHERE b_user_id = #{userId} and b_friend_id = #{friendId}
|
||||
</update>
|
||||
|
||||
</mapper>
|
||||
+16
-18
@@ -8,28 +8,25 @@
|
||||
<select id="selectGroup" resultType="cn.link56.im.model.vo.QueryGroupVO">
|
||||
SELECT *
|
||||
FROM (
|
||||
SELECT
|
||||
g.b_id AS groupId,
|
||||
g.b_name AS groupName,
|
||||
g.b_avatar AS groupAvatar,
|
||||
gu.b_unread_count AS unreadCount,
|
||||
SELECT
|
||||
g.b_id AS groupId,
|
||||
g.b_name AS groupName,
|
||||
g.b_avatar AS groupAvatar,
|
||||
gu.b_unread_count AS unreadCount,
|
||||
|
||||
m.b_id AS lastMessageId,
|
||||
m.b_send_time AS lastMessageTime,
|
||||
m.b_type AS lastMessageType,
|
||||
m.b_content AS lastMessageContent,
|
||||
m.b_id AS lastMessageId,
|
||||
m.b_send_time AS lastMessageTime,
|
||||
m.b_type AS lastMessageType,
|
||||
m.b_content AS lastMessageContent,
|
||||
|
||||
u.b_id AS lastMessageSenderId,
|
||||
u.b_name AS lastMessageSenderName,
|
||||
u.b_avatar AS lastMessageSenderAvatar,
|
||||
u.b_id AS lastMessageSenderId,
|
||||
u.b_name AS lastMessageSenderName,
|
||||
|
||||
ROW_NUMBER() OVER (
|
||||
ORDER BY
|
||||
<if test="id != null and id != 0">
|
||||
CASE WHEN g.b_id = #{id} THEN 0 ELSE 1 END,
|
||||
</if>
|
||||
ROW_NUMBER() OVER (
|
||||
ORDER BY
|
||||
CASE WHEN #{id} IS NOT NULL AND #{id} != 0 AND g.b_id = #{id} THEN 0 ELSE 1 END,
|
||||
m.b_send_time DESC
|
||||
) AS rn
|
||||
) AS rn
|
||||
FROM b_im_group g
|
||||
INNER JOIN b_im_group_user gu ON g.b_id = gu.b_group_id
|
||||
LEFT JOIN b_im_group_message m ON gu.b_last_message_id = m.b_id
|
||||
@@ -43,6 +40,7 @@
|
||||
</select>
|
||||
|
||||
|
||||
|
||||
<select id="selectGroupTotal" resultType="java.lang.Long">
|
||||
SELECT COUNT(DISTINCT g.b_id)
|
||||
FROM b_im_group g
|
||||
|
||||
+30
@@ -0,0 +1,30 @@
|
||||
<?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.link56.im.mapper.ImGroupMessageMapper">
|
||||
|
||||
<select id="selectGroupMessages" resultType="cn.link56.im.model.vo.QueryGroupMessageVO">
|
||||
SELECT TOP (#{pageSize})
|
||||
gm.b_id AS id,
|
||||
gm.b_group_id AS groupId,
|
||||
gm.b_sender_id AS senderId,
|
||||
u.b_name AS senderName,
|
||||
u.b_avatar AS senderAvatar,
|
||||
gm.b_content AS content,
|
||||
gm.b_type AS type,
|
||||
gm.b_send_time AS sendTime
|
||||
FROM b_im_group_message gm
|
||||
LEFT JOIN b_company_user u ON gm.b_sender_id = u.b_id
|
||||
WHERE gm.b_group_id = #{groupId}
|
||||
<if test="beforeTimestamp != null and beforeId != null">
|
||||
AND (
|
||||
gm.b_send_time < #{beforeTimestamp}
|
||||
OR (gm.b_send_time = #{beforeTimestamp} AND gm.b_id < #{beforeId})
|
||||
)
|
||||
</if>
|
||||
ORDER BY gm.b_send_time DESC, gm.b_id DESC
|
||||
</select>
|
||||
|
||||
</mapper>
|
||||
+27
@@ -0,0 +1,27 @@
|
||||
<?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.link56.im.mapper.ImGroupUserMapper">
|
||||
|
||||
<select id="selectGroupUsers" resultType="cn.link56.im.model.vo.QueryGroupUserVO" parameterType="map">
|
||||
SELECT
|
||||
gu.b_group_id AS groupId,
|
||||
cu.b_id AS userId,
|
||||
cu.b_avatar AS userAvatar,
|
||||
cu.b_name AS userName
|
||||
FROM
|
||||
b_im_group_user gu
|
||||
INNER JOIN
|
||||
b_company_user cu
|
||||
ON gu.b_user_id = cu.b_id
|
||||
WHERE
|
||||
gu.b_group_id = #{groupId}
|
||||
<if test="userName != null and userName != ''">
|
||||
AND cu.b_name LIKE '%' + #{userName} + '%'
|
||||
</if>
|
||||
</select>
|
||||
|
||||
|
||||
</mapper>
|
||||
+32
@@ -0,0 +1,32 @@
|
||||
<?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.link56.im.mapper.ImPrivateMessageMapper">
|
||||
|
||||
<select id="selectPrivateMessages" resultType="cn.link56.im.model.vo.QueryPrivateMessageVO">
|
||||
SELECT TOP (#{pageSize})
|
||||
b_id AS id,
|
||||
b_sender_id AS senderId,
|
||||
b_receiver_id AS receiverId,
|
||||
b_content AS content,
|
||||
b_type AS type,
|
||||
b_send_time AS sendTime
|
||||
FROM b_im_private_message
|
||||
WHERE
|
||||
(
|
||||
(b_sender_id = #{userId} AND b_receiver_id = #{friendId})
|
||||
OR
|
||||
(b_sender_id = #{friendId} AND b_receiver_id = #{userId})
|
||||
)
|
||||
<if test="beforeTimestamp != null and beforeId != null">
|
||||
AND (
|
||||
b_send_time < #{beforeTimestamp}
|
||||
OR (b_send_time = #{beforeTimestamp} AND b_id < #{beforeId})
|
||||
)
|
||||
</if>
|
||||
ORDER BY b_send_time DESC, b_id DESC
|
||||
</select>
|
||||
|
||||
</mapper>
|
||||
+5
-4
@@ -23,11 +23,12 @@
|
||||
<update id="decreaseCommentCount">
|
||||
UPDATE b_post_stat
|
||||
SET
|
||||
b_comment_count = b_comment_count - #{count},
|
||||
b_comment_count = CASE
|
||||
WHEN b_comment_count - #{count} < 0 THEN 0
|
||||
ELSE b_comment_count - #{count}
|
||||
END,
|
||||
b_update_time = GETDATE()
|
||||
WHERE b_post_id = #{postId}
|
||||
AND b_comment_count >= #{count}
|
||||
</update>
|
||||
|
||||
|
||||
</mapper>
|
||||
</mapper>
|
||||
Reference in new issue
Block a user