NoticeMapper.xml
3.78 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
<?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.pc.system.notice.mapper.NoticeMapper">
<resultMap type="com.huaheng.pc.system.notice.domain.Notice" id="NoticeResult">
<result property="id" column="id" />
<result property="noticeTitle" column="noticeTitle" />
<result property="noticeType" column="noticeType" />
<result property="noticeContent" column="noticeContent" />
<result property="status" column="status" />
<result property="createBy" column="createBy" />
<result property="createTime" column="createTime" />
<result property="updateBy" column="updateBy" />
<result property="updateTime" column="updateTime" />
<result property="remark" column="remark" />
</resultMap>
<sql id="selectNoticeVo">
select id, noticeTitle, noticeType, noticeContent, status, createBy, createTime, updateBy, updateTime, remark from sys_notice
</sql>
<select id="selectNoticeById" parameterType="Integer" resultMap="NoticeResult">
<include refid="selectNoticeVo"/>
where id = #{id}
</select>
<select id="selectNoticeList" parameterType="com.huaheng.pc.system.notice.domain.Notice" resultMap="NoticeResult">
<include refid="selectNoticeVo"/>
<where>
<if test="noticeTitle != null and noticeTitle != ''">
AND noticeTitle like concat('%', #{noticeTitle}, '%')
</if>
<if test="noticeType != null and noticeType != ''">
AND noticeType = #{noticeType}
</if>
<if test="createBy != null and createBy != ''">
AND createBy like concat('%', #{createBy}, '%')
</if>
</where>
</select>
<insert id="insertNotice" parameterType="com.huaheng.pc.system.notice.domain.Notice">
insert into sys_notice (
<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>
createTime
)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.pc.system.notice.domain.Notice">
update sys_notice
<set>
<if test="noticeTitle != null and noticeTitle != ''">noticeTitle = #{noticeTitle}, </if>
<if test="noticeType != null and noticeType != ''">noticeType = #{noticeType}, </if>
<if test="noticeContent != null and noticeContent != ''">noticeContent = #{noticeContent}, </if>
<if test="status != null and status != ''">status = #{status}, </if>
<if test="updateBy != null and updateBy != ''">updateBy = #{updateBy},</if>
updateTime = sysdate()
</set>
where id = #{id}
</update>
<delete id="deleteNoticeByIds" parameterType="String">
delete from sys_notice where id in
<foreach item="id" collection="array" open="(" separator="," close=")">
#{id}
</foreach>
</delete>
</mapper>