Skip to content

Commit abcd445

Browse files
authored
fix: Fix page create and componet library mapper (opentiny#246)
* feat: Service extends IService * fix: Modify unit testing * fix: Modify web config * feat: Add JsonUtils and modify related methods * feat: Add JsonUtils and modify related methods * fix: Modify code format * fix: Fix block update bug * fix: Fix page create and componet library mapper
1 parent ad25aba commit abcd445

File tree

8 files changed

+119
-158
lines changed

8 files changed

+119
-158
lines changed

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

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,5 +28,4 @@ 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;
3030

31-
ALTER TABLE t_component_library ADD app_id int NULL;
3231

base/src/main/java/com/tinyengine/it/controller/PageController.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,6 @@
2929
import io.swagger.v3.oas.annotations.responses.ApiResponse;
3030
import io.swagger.v3.oas.annotations.tags.Tag;
3131
import jakarta.servlet.http.HttpServletRequest;
32-
import jakarta.validation.Valid;
3332

3433
import org.springframework.beans.factory.annotation.Autowired;
3534
import org.springframework.validation.annotation.Validated;
@@ -115,7 +114,7 @@ public Result<Page> getPageById(@PathVariable Integer id) throws Exception {
115114
/**
116115
* 创建页面
117116
*
118-
* @param page the page
117+
* @param request the request
119118
* @return result
120119
* @throws Exception the exception
121120
*/
@@ -128,7 +127,8 @@ public Result<Page> getPageById(@PathVariable Integer id) throws Exception {
128127
})
129128
@SystemControllerLog(description = "创建页面")
130129
@PostMapping("/pages/create")
131-
public Result<Page> createPage(@Valid @RequestBody Page page) throws Exception {
130+
public Result<Page> createPage(HttpServletRequest request) throws IOException {
131+
Page page = JsonUtils.decode(request.getInputStream(), Page.class);
132132
if (page.getIsPage()) {
133133
// 创建页面
134134
return pageService.createPage(page);

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

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,7 @@ public class Component extends BaseEntity {
4747
private Map<String, String> name;
4848

4949
@Schema(name = "component", description = "组件")
50+
@TableField(value = "name_en")
5051
private String component;
5152

5253
@Schema(name = "icon", description = "组件图标")
@@ -75,6 +76,7 @@ public class Component extends BaseEntity {
7576
private Map<String, Object> npm;
7677

7778
@Schema(name = "group", description = "分组")
79+
@TableField(value = "`group`")
7880
private String group;
7981

8082
@Schema(name = "category", description = "分类")
@@ -98,9 +100,11 @@ public class Component extends BaseEntity {
98100

99101
@JsonProperty("public")
100102
@Schema(name = "public", description = "公开状态:0,1,2")
103+
@TableField(value = "public")
101104
private Integer publicStatus;
102105

103106
@Schema(name = "framework", description = "技术栈")
107+
@TableField(value = "framework")
104108
private String framework;
105109

106110
@Schema(name = "isOfficial", description = "标识官方组件")
@@ -110,6 +114,7 @@ public class Component extends BaseEntity {
110114
private Boolean isDefault;
111115

112116
@Schema(name = "isTinyReserved", description = "是否tiny自有")
117+
@TableField(value = "tiny_reserved")
113118
private Boolean isTinyReserved;
114119

115120
@JsonProperty("component_metadata")

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

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,10 +45,12 @@ public class ComponentLibrary extends BaseEntity {
4545
private String name;
4646

4747
@Schema(name = "appId", description = "关联应用id")
48+
@TableField(value = "app_id")
4849
private Integer appId;
4950

5051
@JsonProperty("package")
5152
@Schema(name = "package", description = "包名")
53+
@TableField(value = "package")
5254
private String packageName;
5355

5456
@Schema(name = "registry", description = "注册")
@@ -82,17 +84,22 @@ public class ComponentLibrary extends BaseEntity {
8284

8385
@JsonProperty("public")
8486
@Schema(name = "public", description = "公开状态:0,1,2")
87+
@TableField(value = "public")
8588
private Integer publicStatus;
8689

8790
@Schema(name = "isStarted", description = "标识启用")
91+
@TableField(value = "is_started")
8892
private Boolean isStarted;
8993

9094
@Schema(name = "isOfficial", description = "标识官方组件")
95+
@TableField(value = "is_official")
9196
private Boolean isOfficial;
9297

9398
@Schema(name = "isDefault", description = "标识默认组件")
99+
@TableField(value = "is_default")
94100
private Boolean isDefault;
95101

96102
@Schema(name = "components", description = "组件库组件")
103+
@TableField(exist = false)
97104
private List<Component> components;
98105
}

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

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -52,12 +52,14 @@ public class PageHistory {
5252
private String name;
5353

5454
@Schema(name = "page", description = "关联page表Id")
55+
@TableField(value = "ref_id")
5556
private Integer page;
5657

5758
@Schema(name = "version", description = "版本")
5859
private String version;
5960

6061
@Schema(name = "app", description = "关联app表Id")
62+
@TableField(value = "app_id")
6163
private Integer app;
6264

6365
@Schema(name = "route", description = "页面路由")
@@ -74,6 +76,7 @@ public class PageHistory {
7476
@Schema(name = "parentId", description = "父文件夹id")
7577
private String parentId;
7678

79+
@TableField(value = "`group`")
7780
private String group;
7881

7982
@Schema(name = "depth", description = "*页面/文件夹深度,更改层级时服务端校验用(校验可有可无)*")

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@
4040
public class Tenant {
4141
@Schema(name = "id", description = "主键id")
4242
@TableId(value = "id", type = IdType.AUTO)
43-
private Integer id;
43+
private String id;
4444

4545
@Schema(name = "nameCn", description = "组织唯一代码")
4646
private String orgCode;

0 commit comments

Comments
 (0)