ThreestepHistoryMapper.xml
5.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
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
<?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.business.mapper.ThreestepHistoryMapper">
<resultMap type="ThreestepHistory" id="ThreestepHistoryResult">
<result property="id" column="id" />
<result property="name" column="name" />
<result property="projectType" column="project_type" />
<result property="type" column="type" />
<result property="place" column="place" />
<result property="reason" column="reason" />
<result property="status" column="status" />
<result property="objectId" column="object_id" />
<result property="createBy" column="create_by" />
<result property="createTime" column="create_time" />
<result property="person" column="person" />
<result property="personNumber" column="person_number" />
<result property="person1" column="person1" />
<result property="person1Number" column="person1_number" />
</resultMap>
<sql id="selectThreestepHistoryVo">
select id, name, project_type,type, place, reason, status, object_id, create_by, create_time, person, person_number, person1, person1_number from threestep_history
</sql>
<select id="selectThreestepHistoryList" parameterType="ThreestepHistory" resultMap="ThreestepHistoryResult">
<include refid="selectThreestepHistoryVo"/>
<where>
<if test="name != null and name != ''"> and name like concat('%', #{name}, '%')</if>
<if test="place != null and place != ''"> and place = #{place}</if>
<if test="type != -1"> and type = #{type}</if>
<if test="status != null and status != ''"> and status = #{status}</if>
</where>
</select>
<select id="selectThreestepHistoryById" parameterType="Long" resultMap="ThreestepHistoryResult">
<include refid="selectThreestepHistoryVo"/>
where id = #{id}
</select>
<insert id="insertThreestepHistory" parameterType="ThreestepHistory" useGeneratedKeys="true" keyProperty="id">
insert into threestep_history
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="name != null">name,</if>
<if test="type != null">type,</if>
<if test="projectType != null">project_type,</if>
<if test="place != null">place,</if>
<if test="reason != null">reason,</if>
<if test="status != null">status,</if>
<if test="objectId != null">object_id,</if>
<if test="createBy != null">create_by,</if>
<if test="createTime != null">create_time,</if>
<if test="person != null">person,</if>
<if test="personNumber != null">person_number,</if>
<if test="person1 != null">person1,</if>
<if test="person1Number != null">person1_number,</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="name != null">#{name},</if>
<if test="type != null">#{type},</if>
<if test="projectType != null">#{projectType},</if>
<if test="place != null">#{place},</if>
<if test="reason != null">#{reason},</if>
<if test="status != null">#{status},</if>
<if test="objectId != null">#{objectId},</if>
<if test="createBy != null">#{createBy},</if>
<if test="createTime != null">#{createTime},</if>
<if test="person != null">#{person},</if>
<if test="personNumber != null">#{personNumber},</if>
<if test="person1 != null">#{person1},</if>
<if test="person1Number != null">#{person1Number},</if>
</trim>
</insert>
<update id="updateThreestepHistory" parameterType="ThreestepHistory">
update threestep_history
<trim prefix="SET" suffixOverrides=",">
<if test="name != null">name = #{name},</if>
<if test="type != null">type = #{type},</if>
<if test="projectType != null">project_type = #{projectType},</if>
<if test="place != null">place = #{place},</if>
<if test="reason != null">reason = #{reason},</if>
<if test="status != null">status = #{status},</if>
<if test="objectId != null">object_id = #{objectId},</if>
<if test="createBy != null">create_by = #{createBy},</if>
<if test="createTime != null">create_time = #{createTime},</if>
<if test="person != null">person = #{person},</if>
<if test="personNumber != null">person_number = #{personNumber},</if>
<if test="person1 != null">person1 = #{person1},</if>
<if test="person1Number != null">person1_number = #{person1Number},</if>
</trim>
where id = #{id}
</update>
<delete id="deleteThreestepHistoryById" parameterType="Long">
delete from threestep_history where id = #{id}
</delete>
<delete id="deleteThreestepHistoryByIds" parameterType="String">
delete from threestep_history where id in
<foreach item="id" collection="array" open="(" separator="," close=")">
#{id}
</foreach>
</delete>
</mapper>