聊天结构优化

This commit is contained in:
SjS 2025-05-27 15:20:53 +08:00
parent 2238bf9138
commit 913a58c13b
4 changed files with 43 additions and 9 deletions

View File

@ -43,6 +43,10 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="query.receiverName != null "> and su_receive.nick_name like concat ('%',#{query.receiverName},'%')</if>
<if test="query.joinTime != null "> and bc.create_time &gt; #{query.joinTime}</if>
${query.params.dataScope}
${@com.ruoyi.framework.util.DataScopeUtil@create(query.scope)
.userSetAlias("bc.send_id")
.build()
}
</sql>
<select id="selectChatList" parameterType="ChatQuery" resultMap="ChatResult">

View File

@ -11,7 +11,4 @@ public class ChatMsgQuery extends ChatMsgVO{
@ApiModelProperty("拼桌ID列表")
private List<Long> chatIds;
@ApiModelProperty("消息是否被撤回")
private Boolean deleted;
}

View File

@ -1,7 +1,22 @@
package com.ruoyi.bst.chatMsg.domain;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import java.time.LocalDateTime;
@Data
public class ChatMsgVO extends ChatMsg{
@ApiModelProperty("接收人名称")
private String userName;
@ApiModelProperty("发送人名称")
private String sender;
@ApiModelProperty("消息接收时间")
private LocalDateTime receiveTime;
@ApiModelProperty("队伍名称")
private String teamName;
}

View File

@ -17,17 +17,35 @@
bcm.chat_id,
bcm.user_id,
bcm.is_read,
bcm.read_time
from bst_chat_msg bcm
bcm.read_time,
bc.create_time as receive_time,
bt.name as team_name,
su_sender.user_name as sender,
su_receiver.user_name as user_name
from <include refid="searchTables"/>
</sql>
<sql id="searchTables">
bst_chat_msg bcm
left join bst_chat bc on bcm.chat_id = bc.id
left join bst_team bt on bc.team_id = bt.id
left join sys_user su_sender on bc.send_id = su_sender.user_id
left join sys_user su_receiver on bcm.user_id = su_receiver.user_id
</sql>
<sql id="searchCondition">
<if test="query.chatId != null ">and chat_id = #{query.chatId}</if>
<if test="query.userId != null ">and user_id = #{query.userId}</if>
<if test="query.isRead != null ">and is_read = #{query.isRead}</if>
<if test="query.readTime != null ">and read_time = #{query.readTime}</if>
<if test="query.chatId != null ">and bcm.chat_id = #{query.chatId}</if>
<if test="query.userId != null ">and bcm.user_id = #{query.userId}</if>
<if test="query.isRead != null ">and bcm.is_read = #{query.isRead}</if>
<if test="query.readTime != null ">and bcm.read_time = #{query.readTime}</if>
<if test="query.sender != null ">and su_sender.user_name like concat ('%',#{query.sender},'%')</if>
<if test="query.userName != null ">and su_receiver.user_name like concat ('%',#{query.userName},'%')</if>
<if test="query.readTime != null ">and bcm.read_time = #{query.readTime}</if>
<if test="query.deleted != null ">and bc.deleted = #{query.deleted}</if>
${@com.ruoyi.framework.util.DataScopeUtil@create(query.scope)
.userSetAlias("bcm.user_id")
.build()
}
${query.params.dataScope}
</sql>