1、站内信相关查询移除redis中查询状态,改为已读后新增一条message_readinfo,相关方法逻辑修改,移除无用方法;2、全局GlobalExceptionHandler捕获BindException时丢出错误值而不是堆栈异常;

This commit is contained in:
gaoqr
2024-07-16 10:51:07 +08:00
parent aa09d8e96c
commit 0e3a2a33d2
14 changed files with 249 additions and 276 deletions
@@ -0,0 +1,55 @@
<?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="com.cf.imes.module.system.dal.mysql.notify.NotifyMessageMapper">
<resultMap id="messageMap" type="com.cf.imes.module.system.dal.dataobject.notify.NotifyMessageDO">
<result property="templateParams" column="template_params" javaType="java.util.Map" typeHandler="com.baomidou.mybatisplus.extension.handlers.JacksonTypeHandler"/>
</resultMap>
<select id="getMyMyNotifyMessage" resultMap="messageMap">
select distinct m.*,
coalesce(r.id is not null, true) as readStatus
, r.read_time readTime
from system_notify_message m
left join system_notify_message_readinfo r on r.message_id = m.id
<where>
<if test="reqVo.readStatus != null and reqVo.readStatus">
r.id is not null
</if>
<if test="reqVo.readStatus != null and !reqVo.readStatus">
r.id is null
</if>
<if test="reqVo.createTime != null">
and m.create_time between #{reqVo.createTime[0]} and #{reqVo.createTime[1]}
</if>
<if test="reqVo.userType != null">
and m.user_type = #{reqVo.userType}
</if>
<if test="reqVo.templateCode != null and reqVo.templateCode != ''">
and m.template_code = #{reqVo.templateCode}
</if>
<if test="reqVo.templateType != null">
and m.template_type = #{reqVo.templateType}
</if>
and m.user_id in (#{reqVo.userId},0)
</where>
order by m.id desc
</select>
<select id="getUnreadNotifyMessageCount" resultType="java.lang.Integer">
select count(distinct m.id)
from system_notify_message m
left join system_notify_message_readinfo r on r.message_id = m.id
where r.id is null
and m.user_id in (#{userId}, 0)
and m.user_type = #{userType}
</select>
<select id="getUnreadNotifyMessageIds" resultType="java.lang.Long">
select m.id
from system_notify_message m
left join system_notify_message_readinfo r on r.message_id = m.id
where r.id is null
and m.user_id in (#{userId}, 0)
and m.user_type = #{userType}
</select>
</mapper>