WeeklyMapper.xml
3.43 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
<?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.trash.weekly.mapper.WeeklyMapper">
<resultMap type="PeriodicReport" id="PeriodicReportResult">
<result property="id" column="id" />
<result property="headline" column="headline" />
<result property="writer" column="writer" />
<result property="writeTime" column="write_time" />
<result property="content" column="content" />
<result property="begintime" column="beginTime" />
<result property="endtime" column="endTime" />
<result property="contentType" column="content_type" />
</resultMap>
<sql id="selectWeeklyVo">
select id, headline, writer, write_time, content, beginTime, endTime, content_type from periodic_report
</sql>
<select id="selectWeeklyList" parameterType="PeriodicReport" resultMap="PeriodicReportResult">
<include refid="selectWeeklyVo"/>
<where>
<if test="headline != null and headline != ''"> and headline = #{headline}</if>
and content_type = 2
</where>
</select>
<select id="selectWeeklyById" parameterType="Long" resultMap="PeriodicReportResult">
<include refid="selectWeeklyVo"/>
where id = #{id}
</select>
<insert id="insertWeekly" parameterType="PeriodicReport" useGeneratedKeys="true" keyProperty="id">
insert into periodic_report
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="headline != null">headline,</if>
<if test="writer != null">writer,</if>
<if test="writeTime != null">write_time,</if>
<if test="content != null">content,</if>
<if test="begintime != null">beginTime,</if>
<if test="endtime != null">endTime,</if>
content_type
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="headline != null">#{headline},</if>
<if test="writer != null">#{writer},</if>
<if test="writeTime != null">#{writeTime},</if>
<if test="content != null">#{content},</if>
<if test="begintime != null">#{begintime},</if>
<if test="endtime != null">#{endtime},</if>
2
</trim>
</insert>
<update id="updateWeekly" parameterType="PeriodicReport">
update periodic_report
<trim prefix="SET" suffixOverrides=",">
<if test="headline != null">headline = #{headline},</if>
<if test="writer != null">writer = #{writer},</if>
<if test="writeTime != null">write_time = #{writeTime},</if>
<if test="content != null">content = #{content},</if>
<if test="begintime != null">beginTime = #{begintime},</if>
<if test="endtime != null">endTime = #{endtime},</if>
<if test="contentType != null">content_type = #{contentType},</if>
</trim>
where id = #{id}
</update>
<delete id="deleteWeeklyById" parameterType="Long">
delete from periodic_report where id = #{id}
</delete>
<delete id="deleteWeeklyByIds" parameterType="String">
delete from periodic_report where id in
<foreach item="id" collection="array" open="(" separator="," close=")">
#{id}
</foreach>
</delete>
</mapper>