|
|
@@ -0,0 +1,171 @@
|
|
|
1
|
+<?xml version="1.0" encoding="UTF-8" ?>
|
|
|
2
|
+<!DOCTYPE mapper
|
|
|
3
|
+ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|
|
4
|
+ "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
|
|
5
|
+<mapper namespace="com.sundot.airport.system.mapper.BasePerformanceIndicatorMapper">
|
|
|
6
|
+
|
|
|
7
|
+ <resultMap type="BasePerformanceIndicator" id="BasePerformanceIndicatorResult">
|
|
|
8
|
+ <result property="tenantId" column="tenant_id"/>
|
|
|
9
|
+ <result property="revision" column="revision"/>
|
|
|
10
|
+ <result property="createBy" column="create_by"/>
|
|
|
11
|
+ <result property="createTime" column="create_time"/>
|
|
|
12
|
+ <result property="updateBy" column="update_by"/>
|
|
|
13
|
+ <result property="updateTime" column="update_time"/>
|
|
|
14
|
+ <result property="remark" column="remark"/>
|
|
|
15
|
+ <result property="id" column="id"/>
|
|
|
16
|
+ <result property="type" column="type"/>
|
|
|
17
|
+ <result property="code" column="code"/>
|
|
|
18
|
+ <result property="name" column="name"/>
|
|
|
19
|
+ <result property="parentId" column="parent_id"/>
|
|
|
20
|
+ <result property="ancestors" column="ancestors"/>
|
|
|
21
|
+ <result property="level" column="level"/>
|
|
|
22
|
+ <result property="orderNum" column="order_num"/>
|
|
|
23
|
+ <result property="score" column="score"/>
|
|
|
24
|
+ <result property="unit" column="unit"/>
|
|
|
25
|
+ </resultMap>
|
|
|
26
|
+
|
|
|
27
|
+ <sql id="selectBasePerformanceIndicatorVo">
|
|
|
28
|
+ select tenant_id,
|
|
|
29
|
+ revision,
|
|
|
30
|
+ create_by,
|
|
|
31
|
+ create_time,
|
|
|
32
|
+ update_by,
|
|
|
33
|
+ update_time,
|
|
|
34
|
+ remark,
|
|
|
35
|
+ id,
|
|
|
36
|
+ type,
|
|
|
37
|
+ code,
|
|
|
38
|
+ name,
|
|
|
39
|
+ parent_id,
|
|
|
40
|
+ ancestors,
|
|
|
41
|
+ level,
|
|
|
42
|
+ order_num,
|
|
|
43
|
+ score,
|
|
|
44
|
+ unit
|
|
|
45
|
+ from base_performance_indicator
|
|
|
46
|
+ </sql>
|
|
|
47
|
+
|
|
|
48
|
+ <select id="selectBasePerformanceIndicatorList" parameterType="BasePerformanceIndicator"
|
|
|
49
|
+ resultMap="BasePerformanceIndicatorResult">
|
|
|
50
|
+ <include refid="selectBasePerformanceIndicatorVo"/>
|
|
|
51
|
+ <where>
|
|
|
52
|
+ <if test="tenantId != null and tenantId != ''">and tenant_id = #{tenantId}</if>
|
|
|
53
|
+ <if test="revision != null ">and revision = #{revision}</if>
|
|
|
54
|
+ <if test="type != null and type != ''">and type = #{type}</if>
|
|
|
55
|
+ <if test="code != null and code != ''">and code = #{code}</if>
|
|
|
56
|
+ <if test="name != null and name != ''">and name like concat('%', #{name}, '%')</if>
|
|
|
57
|
+ <if test="parentId != null ">and parent_id = #{parentId}</if>
|
|
|
58
|
+ <if test="ancestors != null and ancestors != ''">and ancestors = #{ancestors}</if>
|
|
|
59
|
+ <if test="level != null ">and level = #{level}</if>
|
|
|
60
|
+ <if test="orderNum != null ">and order_num = #{orderNum}</if>
|
|
|
61
|
+ <if test="score != null ">and score = #{score}</if>
|
|
|
62
|
+ <if test="unit != null and unit != ''">and unit = #{unit}</if>
|
|
|
63
|
+ </where>
|
|
|
64
|
+ </select>
|
|
|
65
|
+
|
|
|
66
|
+ <select id="selectBasePerformanceIndicatorById" parameterType="Long" resultMap="BasePerformanceIndicatorResult">
|
|
|
67
|
+ <include refid="selectBasePerformanceIndicatorVo"/>
|
|
|
68
|
+ where id = #{id}
|
|
|
69
|
+ </select>
|
|
|
70
|
+
|
|
|
71
|
+ <insert id="insertBasePerformanceIndicator" parameterType="BasePerformanceIndicator" useGeneratedKeys="true"
|
|
|
72
|
+ keyProperty="id">
|
|
|
73
|
+ insert into base_performance_indicator
|
|
|
74
|
+ <trim prefix="(" suffix=")" suffixOverrides=",">
|
|
|
75
|
+ <if test="tenantId != null">tenant_id,</if>
|
|
|
76
|
+ <if test="revision != null">revision,</if>
|
|
|
77
|
+ <if test="createBy != null">create_by,</if>
|
|
|
78
|
+ <if test="createTime != null">create_time,</if>
|
|
|
79
|
+ <if test="updateBy != null">update_by,</if>
|
|
|
80
|
+ <if test="updateTime != null">update_time,</if>
|
|
|
81
|
+ <if test="remark != null">remark,</if>
|
|
|
82
|
+ <if test="type != null and type != ''">type,</if>
|
|
|
83
|
+ <if test="code != null">code,</if>
|
|
|
84
|
+ <if test="name != null and name != ''">name,</if>
|
|
|
85
|
+ <if test="parentId != null">parent_id,</if>
|
|
|
86
|
+ <if test="ancestors != null and ancestors != ''">ancestors,</if>
|
|
|
87
|
+ <if test="level != null">level,</if>
|
|
|
88
|
+ <if test="orderNum != null">order_num,</if>
|
|
|
89
|
+ <if test="score != null">score,</if>
|
|
|
90
|
+ <if test="unit != null">unit,</if>
|
|
|
91
|
+ </trim>
|
|
|
92
|
+ <trim prefix="values (" suffix=")" suffixOverrides=",">
|
|
|
93
|
+ <if test="tenantId != null">#{tenantId},</if>
|
|
|
94
|
+ <if test="revision != null">#{revision},</if>
|
|
|
95
|
+ <if test="createBy != null">#{createBy},</if>
|
|
|
96
|
+ <if test="createTime != null">#{createTime},</if>
|
|
|
97
|
+ <if test="updateBy != null">#{updateBy},</if>
|
|
|
98
|
+ <if test="updateTime != null">#{updateTime},</if>
|
|
|
99
|
+ <if test="remark != null">#{remark},</if>
|
|
|
100
|
+ <if test="type != null and type != ''">#{type},</if>
|
|
|
101
|
+ <if test="code != null">#{code},</if>
|
|
|
102
|
+ <if test="name != null and name != ''">#{name},</if>
|
|
|
103
|
+ <if test="parentId != null">#{parentId},</if>
|
|
|
104
|
+ <if test="ancestors != null and ancestors != ''">#{ancestors},</if>
|
|
|
105
|
+ <if test="level != null">#{level},</if>
|
|
|
106
|
+ <if test="orderNum != null">#{orderNum},</if>
|
|
|
107
|
+ <if test="score != null">#{score},</if>
|
|
|
108
|
+ <if test="unit != null">#{unit},</if>
|
|
|
109
|
+ </trim>
|
|
|
110
|
+ </insert>
|
|
|
111
|
+
|
|
|
112
|
+ <update id="updateBasePerformanceIndicator" parameterType="BasePerformanceIndicator">
|
|
|
113
|
+ update base_performance_indicator
|
|
|
114
|
+ <trim prefix="SET" suffixOverrides=",">
|
|
|
115
|
+ <if test="tenantId != null">tenant_id = #{tenantId},</if>
|
|
|
116
|
+ <if test="revision != null">revision = #{revision},</if>
|
|
|
117
|
+ <if test="createBy != null">create_by = #{createBy},</if>
|
|
|
118
|
+ <if test="createTime != null">create_time = #{createTime},</if>
|
|
|
119
|
+ <if test="updateBy != null">update_by = #{updateBy},</if>
|
|
|
120
|
+ <if test="updateTime != null">update_time = #{updateTime},</if>
|
|
|
121
|
+ <if test="remark != null">remark = #{remark},</if>
|
|
|
122
|
+ <if test="type != null and type != ''">type = #{type},</if>
|
|
|
123
|
+ <if test="code != null">code = #{code},</if>
|
|
|
124
|
+ <if test="name != null and name != ''">name = #{name},</if>
|
|
|
125
|
+ <if test="parentId != null">parent_id = #{parentId},</if>
|
|
|
126
|
+ <if test="ancestors != null and ancestors != ''">ancestors = #{ancestors},</if>
|
|
|
127
|
+ <if test="level != null">level = #{level},</if>
|
|
|
128
|
+ <if test="orderNum != null">order_num = #{orderNum},</if>
|
|
|
129
|
+ <if test="score != null">score = #{score},</if>
|
|
|
130
|
+ <if test="unit != null">unit = #{unit},</if>
|
|
|
131
|
+ </trim>
|
|
|
132
|
+ where id = #{id}
|
|
|
133
|
+ </update>
|
|
|
134
|
+
|
|
|
135
|
+ <delete id="deleteBasePerformanceIndicatorById" parameterType="Long">
|
|
|
136
|
+ delete
|
|
|
137
|
+ from base_performance_indicator
|
|
|
138
|
+ where id = #{id}
|
|
|
139
|
+ </delete>
|
|
|
140
|
+
|
|
|
141
|
+ <delete id="deleteBasePerformanceIndicatorByIds" parameterType="String">
|
|
|
142
|
+ delete from base_performance_indicator where id in
|
|
|
143
|
+ <foreach item="id" collection="array" open="(" separator="," close=")">
|
|
|
144
|
+ #{id}
|
|
|
145
|
+ </foreach>
|
|
|
146
|
+ </delete>
|
|
|
147
|
+
|
|
|
148
|
+ <select id="selectChildrenById" parameterType="Long" resultMap="BasePerformanceIndicatorResult">
|
|
|
149
|
+ select *
|
|
|
150
|
+ from base_performance_indicator
|
|
|
151
|
+ where find_in_set(#{id}, ancestors)
|
|
|
152
|
+ </select>
|
|
|
153
|
+
|
|
|
154
|
+ <update id="updateChildren" parameterType="java.util.List">
|
|
|
155
|
+ update base_performance_indicator set ancestors =
|
|
|
156
|
+ <foreach collection="list" item="item" index="index"
|
|
|
157
|
+ separator=" " open="case id" close="end">
|
|
|
158
|
+ when #{item.id} then #{item.ancestors}
|
|
|
159
|
+ </foreach>,
|
|
|
160
|
+ level =
|
|
|
161
|
+ <foreach collection="list" item="item" index="index"
|
|
|
162
|
+ separator=" " open="case id" close="end">
|
|
|
163
|
+ when #{item.id} then #{item.level}
|
|
|
164
|
+ </foreach>
|
|
|
165
|
+ where id in
|
|
|
166
|
+ <foreach collection="list" item="item" index="index"
|
|
|
167
|
+ separator="," open="(" close=")">
|
|
|
168
|
+ #{item.id}
|
|
|
169
|
+ </foreach>
|
|
|
170
|
+ </update>
|
|
|
171
|
+</mapper>
|