OtherDataMapper.xml
3.89 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
<?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.other.mapper.OtherDataMapper">
<resultMap type="OtherData" id="OtherDataResult">
<result property="id" column="id" />
<result property="place" column="place" />
<result property="type" column="type" />
<result property="context" column="context" />
<result property="time" column="time" />
<result property="people" column="people" />
<result property="attach" column="attach" />
<result property="createBy" column="create_by" />
<result property="createTime" column="create_time" />
<result property="updateTime" column="update_time" />
</resultMap>
<sql id="selectOtherDataVo">
select id, place, type, context, time, people, attach, create_by, create_time, update_time from other_data
</sql>
<select id="selectOtherDataList" parameterType="OtherData" resultMap="OtherDataResult">
<include refid="selectOtherDataVo"/>
<where>
<if test="place != null and place != ''"> and place = #{place}</if>
<if test="time != null "> and time = #{time}</if>
</where>
</select>
<select id="selectOtherDataById" parameterType="Long" resultMap="OtherDataResult">
<include refid="selectOtherDataVo"/>
where id = #{id}
</select>
<insert id="insertOtherData" parameterType="OtherData" useGeneratedKeys="true" keyProperty="id">
insert into other_data
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="place != null">place,</if>
<if test="type != null">type,</if>
<if test="context != null">context,</if>
<if test="time != null">time,</if>
<if test="people != null">people,</if>
<if test="attach != null">attach,</if>
<if test="createBy != null">create_by,</if>
<if test="createTime != null">create_time,</if>
<if test="updateTime != null">update_time,</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="place != null">#{place},</if>
<if test="type != null">#{type},</if>
<if test="context != null">#{context},</if>
<if test="time != null">#{time},</if>
<if test="people != null">#{people},</if>
<if test="attach != null">#{attach},</if>
<if test="createBy != null">#{createBy},</if>
<if test="createTime != null">#{createTime},</if>
<if test="updateTime != null">#{updateTime},</if>
</trim>
</insert>
<update id="updateOtherData" parameterType="OtherData">
update other_data
<trim prefix="SET" suffixOverrides=",">
<if test="place != null">place = #{place},</if>
<if test="type != null">type = #{type},</if>
<if test="context != null">context = #{context},</if>
<if test="time != null">time = #{time},</if>
<if test="people != null">people = #{people},</if>
<if test="attach != null">attach = #{attach},</if>
<if test="createBy != null">create_by = #{createBy},</if>
<if test="createTime != null">create_time = #{createTime},</if>
<if test="updateTime != null">update_time = #{updateTime},</if>
</trim>
where id = #{id}
</update>
<delete id="deleteOtherDataById" parameterType="Long">
delete from other_data where id = #{id}
</delete>
<delete id="deleteOtherDataByIds" parameterType="String">
delete from other_data where id in
<foreach item="id" collection="array" open="(" separator="," close=")">
#{id}
</foreach>
</delete>
</mapper>