WorkReportMapper.xml
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
<?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.report.mapper.WorkReportMapper">
<resultMap type="WorkReport" id="WorkReportResult">
<result property="id" column="id" />
<result property="weeklyTitle" column="weekly_title" />
<result property="writer" column="writer" />
<result property="writeTime" column="write_time" />
<result property="reportContent" column="report_content" />
</resultMap>
<sql id="selectWorkReportVo">
select id, weekly_title, writer, write_time, report_content from work_report
</sql>
<select id="selectWorkReportList" parameterType="WorkReport" resultMap="WorkReportResult">
<include refid="selectWorkReportVo"/>
<where>
<if test="weeklyTitle != null and weeklyTitle != ''"> and weekly_title = #{weeklyTitle}</if>
</where>
</select>
<select id="selectWorkReportById" parameterType="Long" resultMap="WorkReportResult">
<include refid="selectWorkReportVo"/>
where id = #{id}
</select>
<insert id="insertWorkReport" parameterType="WorkReport" useGeneratedKeys="true" keyProperty="id">
insert into work_report
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="weeklyTitle != null and weeklyTitle != ''">weekly_title,</if>
<if test="writer != null and writer != ''">writer,</if>
<if test="writeTime != null">write_time,</if>
<if test="reportContent != null and reportContent != ''">report_content,</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="weeklyTitle != null and weeklyTitle != ''">#{weeklyTitle},</if>
<if test="writer != null and writer != ''">#{writer},</if>
<if test="writeTime != null">#{writeTime},</if>
<if test="reportContent != null and reportContent != ''">#{reportContent},</if>
</trim>
</insert>
<update id="updateWorkReport" parameterType="WorkReport">
update work_report
<trim prefix="SET" suffixOverrides=",">
<if test="weeklyTitle != null and weeklyTitle != ''">weekly_title = #{weeklyTitle},</if>
<if test="writer != null and writer != ''">writer = #{writer},</if>
<if test="writeTime != null">write_time = #{writeTime},</if>
<if test="reportContent != null and reportContent != ''">report_content = #{reportContent},</if>
</trim>
where id = #{id}
</update>
<delete id="deleteWorkReportById" parameterType="Long">
delete from work_report where id = #{id}
</delete>
<delete id="deleteWorkReportByIds" parameterType="String">
delete from work_report where id in
<foreach item="id" collection="array" open="(" separator="," close=")">
#{id}
</foreach>
</delete>
</mapper>