SysNoticeMapper.xml
4.41 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
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
<?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.huaheng.system.mapper.SysNoticeMapper">
<resultMap type="com.huaheng.system.domain.SysNotice" id="SysNoticeResult">
<result property="noticeId" column="notice_id"/>
<result property="noticeTitle" column="notice_title"/>
<result property="noticeType" column="notice_type"/>
<result property="noticeContent" column="notice_content"/>
<result property="status" column="status"/>
<result property="createBy" column="create_by"/>
<result property="createTime" column="create_time"/>
<result property="updateBy" column="update_by"/>
<result property="updateTime" column="update_time"/>
<result property="remark" column="remark"/>
</resultMap>
<sql id="selectNoticeVo">
select notice_id, notice_title, notice_type, notice_content, status, create_by, create_time, update_by,
update_time, remark
from sys_notice
</sql>
<select id="selectNoticeById" parameterType="Long" resultMap="SysNoticeResult">
<include refid="selectNoticeVo"/>
where notice_id = #{noticeId}
</select>
<select id="selectNoticeList" parameterType="com.huaheng.system.domain.SysNotice" resultMap="SysNoticeResult">
<include refid="selectNoticeVo"/>
<where>
<if test="noticeTitle != null and noticeTitle != ''">
AND notice_title like concat('%', #{noticeTitle}, '%')
</if>
<if test="noticeType != null and noticeType != ''">
AND notice_type = #{noticeType}
</if>
<if test="createBy != null and createBy != ''">
AND create_by like concat('%', #{createBy}, '%')
</if>
</where>
</select>
<insert id="insertNotice" parameterType="com.huaheng.system.domain.SysNotice">
insert into sys_notice (
<if test="noticeTitle != null and noticeTitle != '' ">
notice_title,
</if>
<if test="noticeType != null and noticeType != '' ">
notice_type,
</if>
<if test="noticeContent != null and noticeContent != '' ">
notice_content,
</if>
<if test="status != null and status != '' ">
status,
</if>
<if test="remark != null and remark != ''">
remark,
</if>
<if test="createBy != null and createBy != ''">
create_by,
</if>
create_time
)values(
<if test="noticeTitle != null and noticeTitle != ''">
#{noticeTitle},
</if>
<if test="noticeType != null and noticeType != ''">
#{noticeType},
</if>
<if test="noticeContent != null and noticeContent != ''">
#{noticeContent},
</if>
<if test="status != null and status != ''">
#{status},
</if>
<if test="remark != null and remark != ''">
#{remark},
</if>
<if test="createBy != null and createBy != ''">
#{createBy},
</if>
sysdate()
)
</insert>
<update id="updateNotice" parameterType="com.huaheng.system.domain.SysNotice">
update sys_notice
<set>
<if test="noticeTitle != null and noticeTitle != ''">
notice_title = #{noticeTitle},
</if>
<if test="noticeType != null and noticeType != ''">
notice_type = #{noticeType},
</if>
<if test="noticeContent != null">
notice_content = #{noticeContent},
</if>
<if test="status != null and status != ''">
status = #{status},
</if>
<if test="updateBy != null and updateBy != ''">
update_by = #{updateBy},
</if>
update_time = sysdate()
</set>
where notice_id = #{noticeId}
</update>
<delete id="deleteNoticeById" parameterType="Long">
delete from sys_notice where notice_id = #{noticeId}
</delete>
<delete id="deleteNoticeByIds" parameterType="Long">
delete from sys_notice where notice_id in
<foreach item="noticeId" collection="array" open="(" separator="," close=")">
#{noticeId}
</foreach>
</delete>
</mapper>