ProjectsValueMapper.xml
4.11 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
109
110
111
112
113
<?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.project.demo.mapper.ProjectsValueMapper">
<resultMap id="projectsValueMap" type="com.project.demo.domain.ProjectsValue">
<result column="survey_category" property="surveyCategory" />
<result column="cillection_point_num" property="cillectionPointNum" />
<result column="scene_name" property="sceneName" />
<result column="enviroment" property="enviroment" />
<result column="present_situation" property="presentSituation" />
<result column="planning_intention" property="planningIntention" />
<result column="planned_implementation_time" property="plannedImplementationTime" />
<result column="project_id" property="projectId" />
</resultMap>
<insert id="saveProjectsValue" parameterType="com.project.demo.domain.ProjectsValue">
insert into projects_value
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="surveyCategory != null">
survey_category,
</if>
<if test="cillectionPointNum != null">
cillection_point_num,
</if>
<if test="sceneName != null">
scene_name,
</if>
<if test="enviroment != null">
enviroment,
</if>
<if test="presentSituation != null">
present_situation,
</if>
<if test="plannedImplementationTime != null">
planned_implementation_time,
</if>
<if test="projectId != null">
project_id,
</if>
<if test="planningIntention != null">
planning_intention,
</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="surveyCategory != null">
#{surveyCategory},
</if>
<if test="cillectionPointNum != null">
#{cillectionPointNum},
</if>
<if test="sceneName != null">
#{sceneName},
</if>
<if test="enviroment != null">
#{enviroment},
</if>
<if test="presentSituation != null">
#{presentSituation},
</if>
<if test="plannedImplementationTime != null">
#{plannedImplementationTime},
</if>
<if test="projectId != null">
#{projectId},
</if>
<if test="planningIntention != null">
#{planningIntention},
</if>
</trim>
</insert>
<select id="findByProjectsId" resultMap="projectsValueMap">
SELECT
*
FROM projects_value
where project_id = #{id}
</select>
<update id="updateVal" parameterType="com.project.demo.domain.ProjectsValue">
UPDATE projects_value
<set>
<if test="params.cillectionPointNum != null">
cillection_point_num=#{params.cillectionPointNum},
</if>
<if test="params.surveyCategory != null">
survey_category=#{params.surveyCategory},
</if>
<if test="params.sceneName != null">
scene_name =#{params.sceneName},
</if>
<if test="params.enviroment != null">
enviroment=#{params.enviroment},
</if>
<if test="params.presentSituation != null">
present_situation=#{params.presentSituation},
</if>
<if test="params.planningIntention != null">
planning_intention=#{params.planningIntention},
</if>
<if test="params.plannedImplementationTime != null">
planned_implementation_time=#{params.plannedImplementationTime}
</if>
</set>
WHERE project_id = -1
<if test="params.projectId != null">
OR project_id = #{params.projectId}
</if>
</update>
</mapper>