1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
<?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.testor.module.notice.dao.TSysNoticeDao">
<!-- 开启二级缓存 -->
<!-- <cache type="org.mybatis.caches.ehcache.LoggingEhcache"/> -->
<!-- 通用查询映射结果 -->
<resultMap id="BaseResultMap" type="com.testor.module.notice.model.domain.TSysNotice">
<id column="id" property="id"/>
<id column="content" property="content"/>
<id column="release_unit" property="releaseUnit"/>
<id column="receiver_obj" property="receiverObj"/>
<id column="is_read" property="isRead"/>
<id column="ref_id" property="refId"/>
<id column="level" property="level"/>
<id column="tenant_id" property="tenantId"/>
<id column="process_status" property="processStatus"/>
<id column="process_id" property="processId"/>
<id column="parent_id" property="parentId"/>
<id column="reject_opinion" property="rejectOpinion"/>
<id column="title" property="title"/>
<id column="release_time" property="releaseTime"/>
<id column="accept_obj" property="acceptObj"/>
<id column="receiver_type" property="receiverType"/>
<id column="org_id" property="orgId"/>
</resultMap>
<!-- 获取已读数据-->
<select id="getRead" parameterType="com.testor.module.notice.model.dto.TSysNoticeParam"
resultType="com.testor.module.notice.model.domain.TSysNotice">
select ne.*
from t_sys_notice ne
join t_sys_is_read r
on ne.id = r.article_id
where FIND_IN_SET (#{orgId},receiver_obj)
and ne.status != 1 and ne.status != 3
and ne.process_status = 5
and ne.process_status != 6
and r.user_id = #{loginUserId}
<if test="param.title!=null and param.title!=''">
AND ne.title LIKE CONCAT('%',#{param.title},'%')
</if>
<if test="param.isRead!=null and param.isRead!=''">
AND r.is_read = #{param.isRead}
</if>
<if test="startTime!=null and startTime!='' or endTime!=null and endTime !=''">
AND ne.release_time between #{startTime} and #{endTime}
</if>
<if test="list!=null and list!=''">
AND ne.level in
<foreach open="(" close=")" separator="," collection="list" item="item" index="index">
#{item}
</foreach>
</if>
order by release_time
</select>
<!-- 获取未读数据-->
<select id="getUnRead" parameterType="com.testor.module.notice.model.dto.TSysNoticeParam"
resultType="com.testor.module.notice.model.domain.TSysNotice">
select *
from t_sys_notice
where FIND_IN_SET (#{orgId},receiver_obj)
and id not in (select r.article_id
from t_sys_notice ne
join t_sys_is_read r
on ne.id = r.article_id
where r.is_read = '1'
and r.user_id = #{loginUserId})
and status != 1 and status != 3
and process_status = 5
and process_status != 6
<if test="param.title!=null and param.title!=''">
AND title LIKE CONCAT('%',#{param.title},'%')
</if>
<if test="startTime!=null and startTime!='' or endTime!=null and endTime !=''">
AND release_time between #{startTime} and #{endTime}
</if>
<if test="list!=null and list!=''">
AND level in
<foreach open="(" close=")" separator="," collection="list" item="item" index="index">
#{item}
</foreach>
</if>
order by release_time
</select>
<!-- 获取首页数据-->
<select id="getNewsAndNotice" parameterType="com.testor.module.notice.model.dto.TSysNoticeParam"
resultType="com.testor.module.notice.model.domain.TSysNotice">
select id ,title ,receiver_obj ,release_time,type from (
select id ,title , receiver_obj ,release_time, '新闻' as type from t_sys_news where process_status = '5' and status ='0'
union
select id ,title , receiver_obj ,release_time, '公告' as type from t_sys_notice where FIND_IN_SET (#{orgId},receiver_obj) and process_status = '5' and status ='0'
) aa order by release_time desc
</select>
</mapper>