feat(message): 添加公告创建时间字段并修复未读消息计数逻辑
- 在 AdminNoticeVo 中添加 createTime 字段,用于显示公告创建时间 - 在 UserNoticeMapper.xml 中添加 createTime 的 MyBatis映射 - 修复 UserNoticeServiceImpl 中 countUnread 方法的逻辑错误,改为正确计算未读消息数量
This commit is contained in:
parent
a33ac271ab
commit
78540a0416
@ -86,7 +86,7 @@ public class UserNoticeServiceImpl extends ServiceImpl<UserNoticeRepository, Use
|
|||||||
public Integer countUnread(UserDetailsImpl userDetails) {
|
public Integer countUnread(UserDetailsImpl userDetails) {
|
||||||
LambdaQueryWrapper<UserNotice> lambdaQueryWrapper = new LambdaQueryWrapper<>();
|
LambdaQueryWrapper<UserNotice> lambdaQueryWrapper = new LambdaQueryWrapper<>();
|
||||||
lambdaQueryWrapper.eq(UserNotice::getUserId, userDetails.getId())
|
lambdaQueryWrapper.eq(UserNotice::getUserId, userDetails.getId())
|
||||||
.eq(UserNotice::getIsRead, true);
|
.eq(UserNotice::getIsRead, false);
|
||||||
return Math.toIntExact(baseMapper.selectCount(lambdaQueryWrapper));
|
return Math.toIntExact(baseMapper.selectCount(lambdaQueryWrapper));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -3,6 +3,8 @@ package com.zsc.edu.gateway.modules.message.vo;
|
|||||||
import com.zsc.edu.gateway.modules.message.entity.NoticeType;
|
import com.zsc.edu.gateway.modules.message.entity.NoticeType;
|
||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
|
|
||||||
|
import java.time.LocalDateTime;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @author zhuang
|
* @author zhuang
|
||||||
*/
|
*/
|
||||||
@ -48,6 +50,10 @@ public class AdminNoticeVo {
|
|||||||
* 内容
|
* 内容
|
||||||
*/
|
*/
|
||||||
public String content;
|
public String content;
|
||||||
|
/**
|
||||||
|
* 创建时间
|
||||||
|
*/
|
||||||
|
public LocalDateTime createTime;
|
||||||
/**
|
/**
|
||||||
* 备注
|
* 备注
|
||||||
*/
|
*/
|
||||||
|
@ -33,6 +33,7 @@
|
|||||||
<result column="content" jdbcType="VARCHAR" property="content"/>
|
<result column="content" jdbcType="VARCHAR" property="content"/>
|
||||||
<result column="remark" jdbcType="VARCHAR" property="remark"/>
|
<result column="remark" jdbcType="VARCHAR" property="remark"/>
|
||||||
<result column="user_count" jdbcType="INTEGER" property="userCount"/>
|
<result column="user_count" jdbcType="INTEGER" property="userCount"/>
|
||||||
|
<result column="create_time" jdbcType="DATE" property="createTime"/>
|
||||||
<result column="read_count" jdbcType="INTEGER" property="readCount"/>
|
<result column="read_count" jdbcType="INTEGER" property="readCount"/>
|
||||||
</resultMap>
|
</resultMap>
|
||||||
<select id="selectByNoticeIdAndUserId" resultType="com.zsc.edu.gateway.modules.message.vo.UserNoticeVo"
|
<select id="selectByNoticeIdAndUserId" resultType="com.zsc.edu.gateway.modules.message.vo.UserNoticeVo"
|
||||||
|
Loading…
Reference in New Issue
Block a user