mirror of
https://github.com/continew-org/continew-admin.git
synced 2025-10-19 10:57:21 +08:00
fix(system/message): 修复查询用户未读消息错误
Closes #ID2803
This commit is contained in:
@@ -81,21 +81,15 @@ public class MessageDetailResp implements Serializable {
|
||||
@Schema(description = "通知用户", example = "[1,2]")
|
||||
private List<String> users;
|
||||
|
||||
/**
|
||||
* 是否已读
|
||||
*/
|
||||
@Schema(description = "是否已读", example = "true")
|
||||
private Boolean isRead;
|
||||
|
||||
/**
|
||||
* 读取时间
|
||||
*/
|
||||
@Schema(description = "读取时间", example = "2023-08-08 23:59:59", type = "string")
|
||||
private LocalDateTime readTime;
|
||||
|
||||
/**
|
||||
* 创建时间
|
||||
*/
|
||||
@Schema(description = "创建时间", example = "2023-08-08 08:08:08", type = "string")
|
||||
private LocalDateTime createTime;
|
||||
|
||||
/**
|
||||
* 是否已读
|
||||
*/
|
||||
@Schema(description = "是否已读", example = "true")
|
||||
private Boolean isRead;
|
||||
}
|
@@ -18,12 +18,12 @@
|
||||
t2.read_time IS NOT NULL AS isRead,
|
||||
t2.read_time AS readTime
|
||||
FROM sys_message AS t1
|
||||
LEFT JOIN sys_message_log AS t2 ON t2.message_id = t1.id
|
||||
LEFT JOIN sys_message_log AS t2 ON t2.message_id = t1.id <if test="query.userId != null">AND t2.user_id = #{query.userId}</if>
|
||||
<where>
|
||||
<if test="query.userId != null">
|
||||
<choose>
|
||||
<when test="_databaseId == 'mysql'">
|
||||
(t1.scope = 1 OR (t1.scope = 2 AND JSON_EXTRACT(t1.users, "$[0]") = CAST(#{query.userId} AS CHAR)))
|
||||
(t1.scope = 1 OR (t1.scope = 2 AND JSON_CONTAINS(t1.users, CONCAT('"', #{query.userId}, '"'))))
|
||||
</when>
|
||||
<when test="_databaseId == 'pgsql'">
|
||||
(t1.scope = 1 OR (t1.scope = 2 AND t1.users::jsonb @> jsonb_build_array(#{query.userId}::text)))
|
||||
@@ -52,11 +52,8 @@
|
||||
t1.path,
|
||||
t1.scope,
|
||||
t1.users,
|
||||
t1.create_time,
|
||||
t2.read_time IS NOT NULL AS isRead,
|
||||
t2.read_time AS readTime
|
||||
t1.create_time
|
||||
FROM sys_message AS t1
|
||||
LEFT JOIN sys_message_log AS t2 ON t2.message_id = t1.id
|
||||
WHERE t1.id = #{id}
|
||||
</select>
|
||||
|
||||
|
Reference in New Issue
Block a user