- 将 Account 组件中的 Text 导入移动到顶部 - 移除 App.tsx 中的 expo-updates 相关代码 - 添加 PackageUpdates 相关组件和 hooks - 更新应用名称从 "CMVR 物资管理" 为 "车研物资" - 添加应用图标和自适应图标配置 - 更新 Android 权限配置,添加 REQUEST_INSTALL_PACKAGES 权限 - 修改堆栈导航数据结构,支持路由参数传递 - 添加阅读尺寸偏好设置功能 - 重构登录界面为独立组件 LoginView - 添加文件库界面组件 FileLibrary - 更新状态栏样式逻辑 - 调整 Tab 栏样式和尺寸 - 集成包更新和应用更新对话框 - 修复导入语句顺序和类型引用 - 优化业务列表组件的路由参数处理 - 添加作用域参数用于 API 请求区分
101 lines
4.2 KiB
XML
101 lines
4.2 KiB
XML
<?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.ruoyi.system.mapper.SysNoticeReadMapper">
|
||
<select id="selectPublishedPage" resultType="SysNotice">
|
||
select n.notice_id as noticeId, n.notice_title as noticeTitle, n.notice_type as noticeType,
|
||
n.create_time as createTime, n.create_by as createBy,
|
||
case when r.notice_id is not null then true else false end as isRead
|
||
from sys_notice n
|
||
left join sys_notice_read r on r.notice_id = n.notice_id and r.user_id = #{userId}
|
||
where n.status = '0'
|
||
<if test="beforeId != null">and n.notice_id < #{beforeId}</if>
|
||
<if test="keyword != null and keyword != ''">and locate(#{keyword}, n.notice_title) > 0</if>
|
||
<if test="unreadOnly">and r.notice_id is null</if>
|
||
order by n.notice_id desc limit #{limit}
|
||
</select>
|
||
|
||
<resultMap type="SysNoticeRead" id="SysNoticeReadResult">
|
||
<id property="readId" column="read_id" />
|
||
<result property="noticeId" column="notice_id" />
|
||
<result property="userId" column="user_id" />
|
||
<result property="readTime" column="read_time" />
|
||
</resultMap>
|
||
|
||
<!-- 新增已读记录 -->
|
||
<insert id="insertNoticeRead" parameterType="SysNoticeRead">
|
||
insert ignore into sys_notice_read (notice_id, user_id, read_time)
|
||
values (#{noticeId}, #{userId}, sysdate())
|
||
</insert>
|
||
|
||
<!-- 查询未读数量:正常状态公告 减去 当前用户已读数 -->
|
||
<select id="selectUnreadCount" resultType="int">
|
||
select count(*) from sys_notice n
|
||
where n.status = '0' and not exists (select 1 from sys_notice_read r where r.notice_id = n.notice_id and r.user_id = #{userId})
|
||
</select>
|
||
|
||
<!-- 查询是否已读 -->
|
||
<select id="selectIsRead" resultType="int">
|
||
select count(*) from sys_notice_read where notice_id = #{noticeId} and user_id = #{userId}
|
||
</select>
|
||
|
||
<!-- 查询带已读状态的公告列表(直接在SQL中限制条数) -->
|
||
<select id="selectNoticeListWithReadStatus" resultType="SysNotice">
|
||
select
|
||
n.notice_id as noticeId,
|
||
n.notice_title as noticeTitle,
|
||
n.notice_type as noticeType,
|
||
n.status,
|
||
n.create_by as createBy,
|
||
n.create_time as createTime,
|
||
case when r.notice_id is not null then true else false end as isRead
|
||
from sys_notice n
|
||
left join sys_notice_read r
|
||
on r.notice_id = n.notice_id and r.user_id = #{userId}
|
||
where n.status = '0'
|
||
order by n.notice_id desc
|
||
limit #{limit}
|
||
</select>
|
||
|
||
<!-- 批量标记已读 -->
|
||
<insert id="insertNoticeReadBatch">
|
||
insert ignore into sys_notice_read (notice_id, user_id, read_time)
|
||
values
|
||
<foreach collection="noticeIds" item="noticeId" separator=",">
|
||
(#{noticeId}, #{userId}, sysdate())
|
||
</foreach>
|
||
</insert>
|
||
|
||
<!-- 删除公告时清理已读记录 -->
|
||
<delete id="deleteByNoticeIds">
|
||
delete from sys_notice_read where notice_id in
|
||
<foreach collection="noticeIds" item="noticeId" open="(" separator="," close=")">
|
||
#{noticeId}
|
||
</foreach>
|
||
</delete>
|
||
|
||
<!-- 查询已阅读某公告的用户列表,支持按登录名/用户名模糊筛选 -->
|
||
<select id="selectReadUsersByNoticeId" resultType="java.util.Map">
|
||
select
|
||
u.user_id as userId,
|
||
u.user_name as userName,
|
||
u.nick_name as nickName,
|
||
d.dept_name as deptName,
|
||
u.phonenumber as phonenumber,
|
||
r.read_time as readTime
|
||
from sys_notice_read r
|
||
inner join sys_user u on u.user_id = r.user_id and u.del_flag = '0'
|
||
left join sys_dept d on d.dept_id = u.dept_id
|
||
where r.notice_id = #{noticeId}
|
||
<if test="searchValue != null and searchValue != ''">
|
||
and (
|
||
u.user_name like concat('%', #{searchValue}, '%')
|
||
or u.nick_name like concat('%', #{searchValue}, '%')
|
||
)
|
||
</if>
|
||
order by r.read_time desc
|
||
</select>
|
||
|
||
</mapper>
|