mirror of
https://github.com/continew-org/continew-admin.git
synced 2025-10-19 10:57:21 +08:00
@@ -16,6 +16,7 @@
|
|||||||
|
|
||||||
package top.continew.admin.system.controller;
|
package top.continew.admin.system.controller;
|
||||||
|
|
||||||
|
import cn.hutool.core.collection.CollUtil;
|
||||||
import io.swagger.v3.oas.annotations.Operation;
|
import io.swagger.v3.oas.annotations.Operation;
|
||||||
import io.swagger.v3.oas.annotations.Parameter;
|
import io.swagger.v3.oas.annotations.Parameter;
|
||||||
import io.swagger.v3.oas.annotations.enums.ParameterIn;
|
import io.swagger.v3.oas.annotations.enums.ParameterIn;
|
||||||
@@ -81,8 +82,8 @@ public class UserMessageController {
|
|||||||
@GetMapping("/{id}")
|
@GetMapping("/{id}")
|
||||||
public MessageDetailResp getMessage(@PathVariable Long id) {
|
public MessageDetailResp getMessage(@PathVariable Long id) {
|
||||||
MessageDetailResp detail = messageService.get(id);
|
MessageDetailResp detail = messageService.get(id);
|
||||||
CheckUtils.throwIf(detail == null || (NoticeScopeEnum.USER.equals(detail.getScope()) && !detail.getUsers()
|
CheckUtils.throwIf(detail == null || (NoticeScopeEnum.USER.equals(detail.getScope()) && !CollUtil
|
||||||
.contains(UserContextHolder.getUserId().toString())), "消息不存在或无权限访问");
|
.contains(detail.getUsers(), UserContextHolder.getUserId().toString())), "消息不存在或无权限访问");
|
||||||
messageService.readMessage(Collections.singletonList(id), UserContextHolder.getUserId());
|
messageService.readMessage(Collections.singletonList(id), UserContextHolder.getUserId());
|
||||||
detail.setIsRead(true);
|
detail.setIsRead(true);
|
||||||
return detail;
|
return detail;
|
||||||
|
@@ -2,6 +2,11 @@
|
|||||||
"http://mybatis.org/dtd/mybatis-3-mapper.dtd" >
|
"http://mybatis.org/dtd/mybatis-3-mapper.dtd" >
|
||||||
<mapper namespace="top.continew.admin.system.mapper.MessageMapper">
|
<mapper namespace="top.continew.admin.system.mapper.MessageMapper">
|
||||||
|
|
||||||
|
<resultMap id="messageDetailMap" type="top.continew.admin.system.model.resp.message.MessageDetailResp">
|
||||||
|
<id column="id" property="id" />
|
||||||
|
<result property="users" column="users" typeHandler="com.baomidou.mybatisplus.extension.handlers.JacksonTypeHandler" />
|
||||||
|
</resultMap>
|
||||||
|
|
||||||
<select id="selectMessagePage" resultType="top.continew.admin.system.model.resp.message.MessageResp">
|
<select id="selectMessagePage" resultType="top.continew.admin.system.model.resp.message.MessageResp">
|
||||||
SELECT
|
SELECT
|
||||||
t1.id,
|
t1.id,
|
||||||
@@ -9,7 +14,6 @@
|
|||||||
t1.type,
|
t1.type,
|
||||||
t1.path,
|
t1.path,
|
||||||
t1.scope,
|
t1.scope,
|
||||||
t1.users,
|
|
||||||
t1.create_time,
|
t1.create_time,
|
||||||
t2.read_time IS NOT NULL AS isRead,
|
t2.read_time IS NOT NULL AS isRead,
|
||||||
t2.read_time AS readTime
|
t2.read_time AS readTime
|
||||||
@@ -39,7 +43,7 @@
|
|||||||
ORDER BY t1.create_time DESC
|
ORDER BY t1.create_time DESC
|
||||||
</select>
|
</select>
|
||||||
|
|
||||||
<select id="selectMessageById" resultType="top.continew.admin.system.model.resp.message.MessageDetailResp">
|
<select id="selectMessageById" resultMap="messageDetailMap">
|
||||||
SELECT
|
SELECT
|
||||||
t1.id,
|
t1.id,
|
||||||
t1.title,
|
t1.title,
|
||||||
|
Reference in New Issue
Block a user