43f377d8446a094cc6911423543d359e2a3bfb7d.svn-base
2.3 KB
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
97
98
99
100
101
102
103
<?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.thinkgem.jeesite.modules.oa.dao.OaNotifyRecordDao">
<sql id="oaNotifyRecordColumns">
a.ID AS "id",
a.OA_NOTIFY_ID AS "oaNotify.id",
a.USER_ID AS "user.id",
a.READ_FLAG AS "readFlag",
a.READ_DATE AS "readDate",
u.name AS "user.name",
o.name AS "user.office.name"
</sql>
<sql id="oaNotifyRecordJoins">
JOIN sys_user u ON u.id = a.user_id
JOIN sys_office o ON o.id = u.office_id
</sql>
<select id="get" resultType="OaNotifyRecord">
SELECT
<include refid="oaNotifyRecordColumns"/>
FROM oa_notify_record a
<include refid="oaNotifyRecordJoins"/>
WHERE a.id = #{id}
</select>
<select id="findList" resultType="OaNotifyRecord">
SELECT
<include refid="oaNotifyRecordColumns"/>
FROM oa_notify_record a
<include refid="oaNotifyRecordJoins"/>
WHERE 1=1
<if test="oaNotify != null and oaNotify.id != null and oaNotify.id != ''">
AND oa_notify_id = #{oaNotify.id}
</if>
ORDER BY a.read_flag ASC
</select>
<select id="findAllList" resultType="OaNotifyRecord">
SELECT
<include refid="oaNotifyRecordColumns"/>
FROM oa_notify_record a
<include refid="oaNotifyRecordJoins"/>
WHERE 1=1
ORDER BY a.read_flag ASC
</select>
<insert id="insert">
INSERT INTO oa_notify_record(
ID,
OA_NOTIFY_ID,
USER_ID,
READ_FLAG,
READ_DATE
) VALUES (
#{id},
#{oaNotify.id},
#{user.id},
#{readFlag},
#{readDate}
)
</insert>
<insert id="insertAll" parameterType="List">
INSERT INTO oa_notify_record(
ID,
OA_NOTIFY_ID,
USER_ID,
READ_FLAG,
READ_DATE
)
<foreach collection="list" item="e" separator=" UNION ALL ">
SELECT
#{e.id},
#{e.oaNotify.id},
#{e.user.id},
#{e.readFlag},
#{e.readDate}
FROM dual
</foreach>
</insert>
<update id="update">
UPDATE oa_notify_record SET
READ_FLAG = #{readFlag},
READ_DATE = #{readDate}
WHERE OA_NOTIFY_ID = #{oaNotify.id}
AND USER_ID = #{user.id}
AND READ_FLAG != '1'
</update>
<delete id="delete">
UPDATE FROM oa_notify_record
WHERE id = #{id}
</delete>
<delete id="deleteByOaNotifyId">
DELETE FROM oa_notify_record
WHERE oa_notify_id = #{oaNotifyId}
</delete>
</mapper>