forked from opentiny/tiny-engine-backend-java
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathComponentLibraryMapper.xml
423 lines (411 loc) · 16 KB
/
ComponentLibraryMapper.xml
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
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
<?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.tinyengine.it.mapper.ComponentLibraryMapper">
<!-- 通用设置 -->
<!-- 通用查询列 -->
<sql id="Base_Column_List">
id
, version, `name`, package, registry, framework, description, script, css, bundle, dependencies, `others`, thumbnail, `public`, is_started, is_official, is_default, created_by, last_updated_by, created_time, last_updated_time,
tenant_id, renter_id, site_id
</sql>
<!-- 通用条件列 -->
<sql id="ComponentLibraryByCondition">
<if test="version!=null and version!=''">
AND version = #{version}
</if>
<if test="name!=null and name!=''">
AND `name` = #{name}
</if>
<if test="packageName!=null and packageName!=''">
AND package = #{packageName}
</if>
<if test="registry!=null and registry!=''">
AND registry = #{registry}
</if>
<if test="description!=null and description!=''">
AND description = #{description}
</if>
<if test="framework!=null and framework!=''">
AND framework = #{framework}
</if>
<if test="script!=null and script!=''">
AND script = #{script}
</if>
<if test="css!=null and css!=''">
AND css = #{css}
</if>
<if test="bundle!=null and bundle!=''">
AND bundle = #{bundle}
</if>
<if test="others!=null and others!=''">
AND `others` = #{others}
</if>
<if test="thumbnail!=null and thumbnail!=''">
AND thumbnail = #{thumbnail}
</if>
<if test="publicStatus!=null and publicStatus!=''">
AND `public` = #{publicStatus}
</if>
<if test="isStarted!=null and isStarted!=''">
AND is_started = #{isStarted}
</if>
<if test="isOfficial!=null and isOfficial!=''">
AND is_official = #{isOfficial}
</if>
<if test="isDefault!=null and isDefault!=''">
AND is_default = #{isDefault}
</if>
<if test="createdBy!=null and createdBy!=''">
AND created_by = #{createdBy}
</if>
<if test="lastUpdatedBy!=null and lastUpdatedBy!=''">
AND last_updated_by = #{lastUpdatedBy}
</if>
<if test="createdTime!=null and createdTime!=''">
AND created_time = #{createdTime}
</if>
<if test="lastUpdatedTime!=null and lastUpdatedTime!=''">
AND last_updated_time = #{lastUpdatedTime}
</if>
<if test="tenantId!=null and tenantId!=''">
AND tenant_id = #{tenantId}
</if>
<if test="renterId!=null and renterId!=''">
AND renter_id = #{renterId}
</if>
<if test="siteId!=null and siteId!=''">
AND site_id = #{siteId}
</if>
</sql>
<!-- 通用设置列 -->
<sql id="ComponentLibrarySetColumns">
<if test="version!=null and version!=''">
version = #{version},
</if>
<if test="name!=null and name!=''">
`name` = #{name},
</if>
<if test="packageName!=null and packageName!=''">
`package` = #{packageName},
</if>
<if test="registry!=null and registry!=''">
registry = #{registry},
</if>
<if test="description!=null and description!=''">
description = #{description},
</if>
<if test="framework!=null and framework!=''">
framework = #{framework},
</if>
<if test="script!=null and script!=''">
script = #{script},
</if>
<if test="css!=null and css!=''">
css = #{css},
</if>
<if test="bundle!=null and bundle!=''">
bundle = #{bundle},
</if>
<if test="others!=null and others!=''">
`others` = #{others},
</if>
<if test="thumbnail!=null and thumbnail!=''">
thumbnail = #{thumbnail},
</if>
<if test="publicStatus!=null and publicStatus!=''">
`public` = #{publicStatus},
</if>
<if test="isStarted!=null and isStarted!=''">
is_started = #{isStarted},
</if>
<if test="isOfficial!=null and isOfficial!=''">
is_official = #{isOfficial},
</if>
<if test="isDefault!=null and isDefault!=''">
is_default = #{isDefault},
</if>
<if test="createdBy!=null and createdBy!=''">
created_by = #{createdBy},
</if>
<if test="lastUpdatedBy!=null and lastUpdatedBy!=''">
last_updated_by = #{lastUpdatedBy},
</if>
<if test="createdTime!=null and createdTime!=''">
created_time = #{createdTime},
</if>
<if test="lastUpdatedTime!=null and lastUpdatedTime!=''">
last_updated_time = #{lastUpdatedTime},
</if>
<if test="tenantId!=null and tenantId!=''">
tenant_id = #{tenantId},
</if>
<if test="renterId!=null and renterId!=''">
renter_id = #{renterId},
</if>
<if test="siteId!=null and siteId!=''">
site_id = #{siteId},
</if>
</sql>
<!-- 通用查询映射结果 -->
<resultMap id="ComponentLibraryMap" type="com.tinyengine.it.model.entity.ComponentLibrary">
<id column="id" property="id"/>
<result column="version" property="version"/>
<result column="name" property="name"/>
<result column="package" property="packageName"/>
<result column="registry" property="registry"/>
<result column="description" property="description"/>
<result column="framework" property="framework"/>
<result column="script" property="script"/>
<result column="css" property="css"/>
<result column="bundle" property="bundle"/>
<result column="dependencies" property="dependencies"/>
<result column="others" property="others"/>
<result column="thumbnail" property="thumbnail"/>
<result column="is_official" property="isOfficial"/>
<result column="is_default" property="isDefault"/>
<result column="is_started" property="isStarted"/>
<result column="created_by" property="createdBy"/>
<result column="last_updated_by" property="lastUpdatedBy"/>
<result column="created_time" property="createdTime"/>
<result column="last_updated_time" property="lastUpdatedTime"/>
<result column="tenant_id" property="tenantId"/>
<result column="renter_id" property="renterId"/>
<result column="site_id" property="siteId"/>
<collection property="components" ofType="com.tinyengine.it.model.entity.Component">
<id column="componentId" property="id"/>
<result column="componentVersion" property="version"/>
<result column="componentName" property="name"/>
<result column="name_en" property="component"/>
<result column="icon" property="icon"/>
<result column="componentDescription" property="description"/>
<result column="doc_url" property="docUrl"/>
<result column="screenshot" property="screenshot"/>
<result column="tags" property="tags"/>
<result column="keywords" property="keywords"/>
<result column="dev_mode" property="devMode"/>
<result column="npm" property="npm"/>
<result column="group" property="group"/>
<result column="category" property="category"/>
<result column="priority" property="priority"/>
<result column="snippets" property="snippets"/>
<result column="schema_fragment" property="schemaFragment"/>
<result column="configure" property="configure"/>
<result column="componentPublic" property="publicStatus"/>
<result column="componentFramework" property="framework"/>
<result column="isOfficial" property="isOfficial"/>
<result column="isDefault" property="isDefault"/>
<result column="tiny_reserved" property="isTinyReserved"/>
<result column="component_metadata" property="componentMetadata"/>
<result column="library_id" property="libraryId"/>
<result column="componentCreatedBy" property="createdBy"/>
<result column="componentLastUpdatedBy" property="lastUpdatedBy"/>
<result column="componentCreatedTime" property="createdTime"/>
<result column="componentLastUpdatedTime" property="lastUpdatedTime"/>
<result column="componentTenantId" property="tenantId"/>
<result column="componentRenterId" property="renterId"/>
<result column="componentSiteId" property="siteId"/>
</collection>
</resultMap>
<!-- 查询表t_component_library所有数据 -->
<select id="queryAllComponentLibrary" resultMap="ComponentLibraryMap">
SELECT
CL.id,
CL.version,
CL.`name`,
CL.package,
CL.registry,
CL.framework,
CL.description,
CL.script,
CL.css,
CL.bundle,
CL.dependencies,
CL.`others`,
CL.thumbnail,
CL.`public`,
CL.is_started,
CL.is_official,
CL.is_default,
CL.created_by,
CL.last_updated_by,
CL.created_time,
CL.last_updated_time,
CL.tenant_id,
CL.renter_id,
CL.site_id,
C.id AS componentId,
C.version AS componentVersion,
C.name AS componentName,
C.name_en,
C.icon,
C.description AS componentDescription,
C.doc_url,
C.screenshot,
C.tags,
C.keywords,
C.dev_mode,
C.npm,
C.`group`,
C.category,
C.priority,
C.snippets,
C.schema_fragment,
C.configure,
C.`public` AS componentPublic,
C.framework AS componentFramework,
C.is_official AS isOfficial,
C.is_default AS isDefault,
C.tiny_reserved,
C.component_metadata,
C.library_id,
C.created_by AS componentCreatedBy,
C.last_updated_by AS componentLastUpdatedBy,
C.created_time AS componentCreatedTime,
C.last_updated_time AS componentLastUpdatedTime,
C.tenant_id AS componentTenantId,
C.renter_id AS componentRenterId,
C.site_id AS componentSiteId
FROM t_component_library CL
LEFT JOIN t_component C ON CL.id = C.library_id
</select>
<!-- 根据主键id查询表t_component_library信息 -->
<select id="queryComponentLibraryById" resultMap="ComponentLibraryMap">
SELECT
CL.id,
CL.version,
CL.`name`,
CL.package,
CL.registry,
CL.framework,
CL.description,
CL.script,
CL.css,
CL.bundle,
CL.dependencies,
CL.`others`,
CL.thumbnail,
CL.`public`,
CL.is_started,
CL.is_official,
CL.is_default,
CL.created_by,
CL.last_updated_by,
CL.created_time,
CL.last_updated_time,
CL.tenant_id,
CL.renter_id,
CL.site_id,
C.id AS componentId,
C.version AS componentVersion,
C.name AS componentName,
C.name_en,
C.icon,
C.description AS componentDescription,
C.doc_url,
C.screenshot,
C.tags,
C.keywords,
C.dev_mode,
C.npm,
C.`group`,
C.category,
C.priority,
C.snippets,
C.schema_fragment,
C.configure,
C.`public` AS componentPublic,
C.framework AS componentFramework,
C.is_official AS isOfficial,
C.is_default AS isDefault,
C.tiny_reserved,
C.component_metadata,
C.library_id,
C.created_by AS componentCreatedBy,
C.last_updated_by AS componentLastUpdatedBy,
C.created_time AS componentCreatedTime,
C.last_updated_time AS componentLastUpdatedTime,
C.tenant_id AS componentTenantId,
C.site_id AS componentSiteId
FROM t_component_library CL
LEFT JOIN t_component C ON CL.id = C.library_id
<where>
<if test="id != null">
AND CL.id = #{id}
</if>
</where>
</select>
<!-- 根据条件查询表t_component_library数据 -->
<select id="queryComponentLibraryByCondition" resultMap="ComponentLibraryMap">
SELECT
<include refid="Base_Column_List"/>
FROM t_component_library
WHERE 1=1
<include refid="ComponentLibraryByCondition"/>
</select>
<!-- 根据主键id删除表t_component_library数据 -->
<delete id="deleteComponentLibraryById">
DELETE
FROM t_component_library
WHERE id = #{id}
</delete>
<!-- 根据主键id更新表t_component_library数据 -->
<update id="updateComponentLibraryById" parameterType="com.tinyengine.it.model.entity.ComponentLibrary">
UPDATE t_component_library
<set>
<include refid="ComponentLibrarySetColumns"/>
</set>
WHERE id=#{id}
</update>
<!-- 新增表t_component_library数据 -->
<insert id="createComponentLibrary" useGeneratedKeys="true" keyProperty="id"
parameterType="com.tinyengine.it.model.entity.ComponentLibrary">
INSERT INTO t_component_library ( id
, version
, `name`
, package
, registry
, framework
, description
, script
, css
, bundle
, dependencies
, `others`
, thumbnail
, `public`
, is_started
, is_official
, is_default
, created_by
, last_updated_by
, created_time
, last_updated_time
, tenant_id
, renter_id
, site_id)
VALUES ( #{id}
, #{version}
, #{name}
, #{packageName}
, #{registry}
, #{framework}
, #{description}
, #{script}
, #{css}
, #{bundle}
, #{dependencies}
, #{others}
, #{thumbnail}
, #{publicStatus}
, #{isStarted}
, #{isOfficial}
, #{isDefault}
, #{createdBy}
, #{lastUpdatedBy}
, #{createdTime}
, #{lastUpdatedTime}
, #{tenantId}
, #{renterId}
, #{siteId})
</insert>
</mapper>