Skip to content

Commit a9a9e92

Browse files
committed
fix: Add app_i field to the t_component_library table
1 parent d840667 commit a9a9e92

File tree

8 files changed

+23
-2
lines changed

8 files changed

+23
-2
lines changed

app/src/main/resources/sql/h2/create_all_tables_ddl_v1.h2.sql

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -651,6 +651,7 @@ create table `t_component_library`
651651
`id` int not null auto_increment comment '主键id',
652652
`version` varchar(255) not null comment '版本',
653653
`name` varchar(255) not null comment '名称',
654+
`app_id` int comment '关联应用id',
654655
`package` varchar(255) not null comment '包名',
655656
`registry` varchar(255) comment '注册',
656657
`framework` varchar(255) not null comment '技术栈',

app/src/main/resources/sql/h2/update_all_tables_ddl.sql

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,3 +27,5 @@ ALTER TABLE t_platform MODIFY tenant_id varchar(60) NULL;
2727
ALTER TABLE t_platform_history MODIFY tenant_id varchar(60) NULL;
2828
ALTER TABLE t_task_record MODIFY tenant_id varchar(60) NULL;
2929
ALTER TABLE t_user MODIFY tenant_id varchar(60) NULL;
30+
31+
ALTER TABLE t_component_library ADD app_id int NULL;

app/src/main/resources/sql/mysql/create_all_tables_ddl_v1.mysql.sql

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -651,6 +651,7 @@ create table `t_component_library`
651651
`id` int not null auto_increment comment '主键id',
652652
`version` varchar(255) not null comment '版本',
653653
`name` varchar(255) not null comment '名称',
654+
`app_id` int comment '关联应用id',
654655
`package` varchar(255) not null comment '包名',
655656
`registry` varchar(255) comment '注册',
656657
`framework` varchar(255) not null comment '技术栈',

app/src/main/resources/sql/mysql/update_all_tables_ddl.sql

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,3 +27,5 @@ ALTER TABLE t_platform MODIFY tenant_id varchar(60) NULL;
2727
ALTER TABLE t_platform_history MODIFY tenant_id varchar(60) NULL;
2828
ALTER TABLE t_task_record MODIFY tenant_id varchar(60) NULL;
2929
ALTER TABLE t_user MODIFY tenant_id varchar(60) NULL;
30+
31+
ALTER TABLE t_component_library ADD app_id int NULL;

base/src/main/java/com/tinyengine/it/common/handler/MyMetaObjectHandler.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,7 @@ public void insertFill(MetaObject metaObject) {
4141
this.setFieldValByName("createdBy", loginUserContext.getLoginUserId(), metaObject);
4242
this.setFieldValByName("lastUpdatedBy", loginUserContext.getLoginUserId(), metaObject);
4343
this.setFieldValByName("platformId", loginUserContext.getPlatformId(), metaObject);
44+
fillStrategy(metaObject, "tenantId", loginUserContext.getTenantId());
4445
}
4546

4647
@Override

base/src/main/java/com/tinyengine/it/model/entity/ComponentLibrary.java

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,9 @@ public class ComponentLibrary extends BaseEntity {
4444
@Schema(name = "name", description = "名称")
4545
private String name;
4646

47+
@Schema(name = "appId", description = "关联应用id")
48+
private Integer appId;
49+
4750
@JsonProperty("package")
4851
@Schema(name = "package", description = "包名")
4952
private String packageName;

base/src/main/resources/mappers/ComponentLibraryMapper.xml

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
<!-- 通用查询列 -->
88
<sql id="Base_Column_List">
99
id
10-
, 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,
10+
, version, `name`, app_id, 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,
1111
tenant_id, renter_id, site_id
1212
</sql>
1313

@@ -19,6 +19,9 @@
1919
<if test="name!=null and name!=''">
2020
AND `name` = #{name}
2121
</if>
22+
<if test="appId!=null">
23+
AND app_id = #{appId}
24+
</if>
2225
<if test="packageName!=null and packageName!=''">
2326
AND package = #{packageName}
2427
</if>
@@ -89,6 +92,9 @@
8992
<if test="name!=null and name!=''">
9093
`name` = #{name},
9194
</if>
95+
<if test="appId!=null">
96+
appId = #{appId},
97+
</if>
9298
<if test="packageName!=null and packageName!=''">
9399
`package` = #{packageName},
94100
</if>
@@ -156,6 +162,7 @@
156162
<id column="id" property="id"/>
157163
<result column="version" property="version"/>
158164
<result column="name" property="name"/>
165+
<result column="app_id" property="appId"/>
159166
<result column="package" property="packageName"/>
160167
<result column="registry" property="registry"/>
161168
<result column="description" property="description"/>
@@ -218,6 +225,7 @@
218225
CL.id,
219226
CL.version,
220227
CL.`name`,
228+
CL.app_id,
221229
CL.package,
222230
CL.registry,
223231
CL.framework,
@@ -282,6 +290,7 @@
282290
CL.id,
283291
CL.version,
284292
CL.`name`,
293+
Cl.app_id,
285294
CL.package,
286295
CL.registry,
287296
CL.framework,
@@ -372,6 +381,7 @@
372381
INSERT INTO t_component_library ( id
373382
, version
374383
, `name`
384+
, app_id
375385
, package
376386
, registry
377387
, framework
@@ -396,6 +406,7 @@
396406
VALUES ( #{id}
397407
, #{version}
398408
, #{name}
409+
, #{appId}
399410
, #{packageName}
400411
, #{registry}
401412
, #{framework}

base/src/test/java/com/tinyengine/it/common/handler/MyMetaObjectHandlerTest.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ void testInsertFill() throws NoSuchFieldException, IllegalAccessException {
3636
when(param.hasSetter("tenantId")).thenReturn(true);
3737
TestUtil.setPrivateValue(myMetaObjectHandler, "loginUserContext", new MockUserContext());
3838
myMetaObjectHandler.insertFill(param);
39-
verify(param, times(5)).hasSetter(anyString());
39+
verify(param, times(6)).hasSetter(anyString());
4040
}
4141

4242
@Test

0 commit comments

Comments
 (0)