diff --git a/db/0pigxx_boot.sql b/db/0pigxx_boot.sql index 49e64227f..7b8e7c472 100644 --- a/db/0pigxx_boot.sql +++ b/db/0pigxx_boot.sql @@ -422,7 +422,6 @@ INSERT INTO `sys_i18n` VALUES (18, 'router.documentExtension', '文档扩展', ' INSERT INTO `sys_i18n` VALUES (19, 'router.fileManagement', '文件管理', 'File Management', 'admin', '2023-02-24 10:28:44', '', NULL, '0'); INSERT INTO `sys_i18n` VALUES (20, 'router.platformDevelopment', '开发平台', 'Platform Development', 'admin', '2023-02-24 10:29:28', '', NULL, '0'); INSERT INTO `sys_i18n` VALUES (21, 'router.dataSourceManagement', '数据源管理', 'Data Source Management', 'admin', '2023-02-24 10:30:33', 'admin', '2023-03-06 14:33:20', '0'); -INSERT INTO `sys_i18n` VALUES (22, 'router.formDesign', '表单设计', 'Form Design', 'admin', '2023-02-24 10:31:33', 'admin', '2023-03-06 14:33:28', '0'); INSERT INTO `sys_i18n` VALUES (23, 'router.appManagement', 'APP管理', 'App Management', 'admin', '2023-02-24 10:33:22', '', NULL, '0'); INSERT INTO `sys_i18n` VALUES (24, 'router.customerManagement', '客户管理', 'Customer Management', 'admin', '2023-02-24 10:35:30', '', NULL, '0'); INSERT INTO `sys_i18n` VALUES (25, 'router.appRole', 'APP角色', 'App Role', 'admin', '2023-02-24 10:36:17', '', NULL, '0'); @@ -774,7 +773,6 @@ INSERT INTO `sys_menu` VALUES (7804,'删除','app_appContacts_del',NULL,NULL,780 INSERT INTO `sys_menu` VALUES (7805,'导入导出','app_appContacts_export',NULL,NULL,7800,NULL,'1',1,'0',NULL,'1','admin','2025-05-29 17:30:31',' ',NULL,'0',1); INSERT INTO `sys_menu` VALUES (9000,'开发平台',NULL,'/gen',NULL,-1,'iconfont icon-DevOps','1',9,'0','0','0','','2019-08-12 09:35:16','admin','2025-01-26 22:38:09','0',1); INSERT INTO `sys_menu` VALUES (9005,'数据源管理',NULL,'/gen/datasource/index',NULL,9000,'iconfont icon-shujuyuanguanli','1',0,'0',NULL,'0','','2019-08-12 09:42:11','admin','2025-01-26 22:26:51','0',1); -INSERT INTO `sys_menu` VALUES (9006,'表单设计',NULL,'/gen/design/index',NULL,9000,'iconfont icon-AIshiyanshi','0',2,'0','0','0','','2019-08-16 10:08:56','admin','2023-02-23 14:06:50','0',1); INSERT INTO `sys_menu` VALUES (9007,'生成页面',NULL,'/gen/gener/index',NULL,9000,'iconfont icon-tongzhi4','0',1,'0','0','0','admin','2023-02-20 09:58:23','admin','2023-02-20 14:41:43','0',1); INSERT INTO `sys_menu` VALUES (9050,'元数据管理',NULL,'/gen/metadata',NULL,9000,'iconfont icon-yuanshujuguanli','1',9,'0','0','0','','2018-07-27 01:13:21','admin','2023-02-23 19:55:10','0',1); INSERT INTO `sys_menu` VALUES (9051,'模板管理',NULL,'/gen/template/index',NULL,9050,'iconfont icon-mti-mobanguanli','1',5,'0','0','0','admin','2023-02-21 11:22:54','admin','2023-02-23 19:56:03','0',1); @@ -1193,7 +1191,6 @@ INSERT INTO `sys_role_menu` VALUES (1, 7804); INSERT INTO `sys_role_menu` VALUES (1, 7805); INSERT INTO `sys_role_menu` VALUES (1, 9000); INSERT INTO `sys_role_menu` VALUES (1, 9005); -INSERT INTO `sys_role_menu` VALUES (1, 9006); INSERT INTO `sys_role_menu` VALUES (1, 9007); INSERT INTO `sys_role_menu` VALUES (1, 9050); INSERT INTO `sys_role_menu` VALUES (1, 9051); @@ -2613,29 +2610,6 @@ INSERT INTO `gen_field_type` (`id`, `column_type`, `attr_type`, `package_name`, INSERT INTO `gen_field_type` (`id`, `column_type`, `attr_type`, `package_name`, `default_form_type`, `default_query_form_type`, `create_time`, `create_by`, `update_time`, `update_by`, `del_flag`) VALUES (49,'bytea','String',NULL,'textarea','text','2026-04-07 20:47:09',NULL,'2026-04-07 20:47:09',NULL,'0'); COMMIT; --- ---------------------------- --- Table structure for gen_form_conf --- ---------------------------- -DROP TABLE IF EXISTS `gen_form_conf`; -CREATE TABLE `gen_form_conf` ( - `id` bigint NOT NULL COMMENT 'ID', - `ds_name` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL COMMENT '数据库名称', - `table_name` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL COMMENT '表名称', - `form_info` text CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '表单信息', - `create_time` datetime DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间', - `update_time` datetime DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '修改时间', - `del_flag` char(1) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT '0', - `tenant_id` bigint DEFAULT NULL COMMENT '所属租户', - PRIMARY KEY (`id`) USING BTREE, - KEY `table_name` (`table_name`) USING BTREE -) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci COMMENT='表单配置'; - --- ---------------------------- --- Records of gen_form_conf --- ---------------------------- -BEGIN; -COMMIT; - -- ---------------------------- -- Table structure for gen_group -- ---------------------------- diff --git a/db/2pigxx.sql b/db/2pigxx.sql index 1a6683b70..4004f39cf 100644 --- a/db/2pigxx.sql +++ b/db/2pigxx.sql @@ -418,7 +418,6 @@ INSERT INTO `sys_i18n` VALUES (18, 'router.documentExtension', '文档扩展', ' INSERT INTO `sys_i18n` VALUES (19, 'router.fileManagement', '文件管理', 'File Management', 'admin', '2023-02-24 10:28:44', '', NULL, '0'); INSERT INTO `sys_i18n` VALUES (20, 'router.platformDevelopment', '开发平台', 'Platform Development', 'admin', '2023-02-24 10:29:28', '', NULL, '0'); INSERT INTO `sys_i18n` VALUES (21, 'router.dataSourceManagement', '数据源管理', 'Data Source Management', 'admin', '2023-02-24 10:30:33', 'admin', '2023-03-06 14:33:20', '0'); -INSERT INTO `sys_i18n` VALUES (22, 'router.formDesign', '表单设计', 'Form Design', 'admin', '2023-02-24 10:31:33', 'admin', '2023-03-06 14:33:28', '0'); INSERT INTO `sys_i18n` VALUES (23, 'router.appManagement', 'APP管理', 'App Management', 'admin', '2023-02-24 10:33:22', '', NULL, '0'); INSERT INTO `sys_i18n` VALUES (24, 'router.customerManagement', '客户管理', 'Customer Management', 'admin', '2023-02-24 10:35:30', '', NULL, '0'); INSERT INTO `sys_i18n` VALUES (25, 'router.appRole', 'APP角色', 'App Role', 'admin', '2023-02-24 10:36:17', '', NULL, '0'); @@ -757,7 +756,6 @@ INSERT INTO `sys_menu` VALUES (7804,'删除','app_appContacts_del',NULL,NULL,780 INSERT INTO `sys_menu` VALUES (7805,'导入导出','app_appContacts_export',NULL,NULL,7800,NULL,'1',1,'0',NULL,'1','admin','2025-05-29 17:30:31',' ',NULL,'0',1); INSERT INTO `sys_menu` VALUES (9000,'开发平台',NULL,'/gen',NULL,-1,'iconfont icon-DevOps','1',9,'0','0','0','','2019-08-12 09:35:16','admin','2025-01-26 22:38:09','0',1); INSERT INTO `sys_menu` VALUES (9005,'数据源管理',NULL,'/gen/datasource/index',NULL,9000,'iconfont icon-shujuyuanguanli','1',0,'0',NULL,'0','','2019-08-12 09:42:11','admin','2025-01-26 22:26:51','0',1); -INSERT INTO `sys_menu` VALUES (9006,'表单设计',NULL,'/gen/design/index',NULL,9000,'iconfont icon-AIshiyanshi','0',2,'0','0','0','','2019-08-16 10:08:56','admin','2023-02-23 14:06:50','0',1); INSERT INTO `sys_menu` VALUES (9007,'生成页面',NULL,'/gen/gener/index',NULL,9000,'iconfont icon-tongzhi4','0',1,'0','0','0','admin','2023-02-20 09:58:23','admin','2023-02-20 14:41:43','0',1); INSERT INTO `sys_menu` VALUES (9050,'元数据管理',NULL,'/gen/metadata',NULL,9000,'iconfont icon-yuanshujuguanli','1',9,'0','0','0','','2018-07-27 01:13:21','admin','2023-02-23 19:55:10','0',1); INSERT INTO `sys_menu` VALUES (9051,'模板管理',NULL,'/gen/template/index',NULL,9050,'iconfont icon-mti-mobanguanli','1',5,'0','0','0','admin','2023-02-21 11:22:54','admin','2023-02-23 19:56:03','0',1); @@ -1178,7 +1176,6 @@ INSERT INTO `sys_role_menu` VALUES (1, 7804); INSERT INTO `sys_role_menu` VALUES (1, 7805); INSERT INTO `sys_role_menu` VALUES (1, 9000); INSERT INTO `sys_role_menu` VALUES (1, 9005); -INSERT INTO `sys_role_menu` VALUES (1, 9006); INSERT INTO `sys_role_menu` VALUES (1, 9007); INSERT INTO `sys_role_menu` VALUES (1, 9050); INSERT INTO `sys_role_menu` VALUES (1, 9051); diff --git a/db/8pigxx_codegen.sql b/db/8pigxx_codegen.sql index 5e5c35fe5..00c4d35f0 100644 --- a/db/8pigxx_codegen.sql +++ b/db/8pigxx_codegen.sql @@ -107,29 +107,6 @@ INSERT INTO `gen_field_type` (`id`, `column_type`, `attr_type`, `package_name`, INSERT INTO `gen_field_type` (`id`, `column_type`, `attr_type`, `package_name`, `default_form_type`, `default_query_form_type`, `create_time`, `create_by`, `update_time`, `update_by`, `del_flag`) VALUES (49,'bytea','String',NULL,'textarea','text','2026-04-07 20:47:09',NULL,'2026-04-07 20:47:09',NULL,'0'); COMMIT; --- ---------------------------- --- Table structure for gen_form_conf --- ---------------------------- -DROP TABLE IF EXISTS `gen_form_conf`; -CREATE TABLE `gen_form_conf` ( - `id` bigint NOT NULL COMMENT 'ID', - `ds_name` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL COMMENT '数据库名称', - `table_name` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL COMMENT '表名称', - `form_info` text CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '表单信息', - `create_time` datetime DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间', - `update_time` datetime DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '修改时间', - `del_flag` char(1) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT '0', - `tenant_id` bigint DEFAULT NULL COMMENT '所属租户', - PRIMARY KEY (`id`) USING BTREE, - KEY `table_name` (`table_name`) USING BTREE -) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci COMMENT='表单配置'; - --- ---------------------------- --- Records of gen_form_conf --- ---------------------------- -BEGIN; -COMMIT; - -- ---------------------------- -- Table structure for gen_group -- ---------------------------- diff --git a/pigx-visual/pigx-codegen/src/main/java/com/pig4cloud/pigx/codegen/controller/GenFormConfController.java b/pigx-visual/pigx-codegen/src/main/java/com/pig4cloud/pigx/codegen/controller/GenFormConfController.java deleted file mode 100755 index 379cd6b9c..000000000 --- a/pigx-visual/pigx-codegen/src/main/java/com/pig4cloud/pigx/codegen/controller/GenFormConfController.java +++ /dev/null @@ -1,104 +0,0 @@ -/* - * Copyright (c) 2018-2026, lengleng All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * - * Redistributions of source code must retain the above copyright notice, - * this list of conditions and the following disclaimer. - * Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * Neither the name of the pig4cloud.com developer nor the names of its - * contributors may be used to endorse or promote products derived from - * this software without specific prior written permission. - * Author: lengleng (wangiegie@gmail.com) - */ - -package com.pig4cloud.pigx.codegen.controller; - -import com.baomidou.mybatisplus.core.toolkit.Wrappers; -import com.baomidou.mybatisplus.extension.plugins.pagination.Page; -import com.pig4cloud.pigx.codegen.entity.GenFormConf; -import com.pig4cloud.pigx.codegen.service.GenFormConfService; -import com.pig4cloud.pigx.common.core.util.R; -import com.pig4cloud.pigx.common.log.annotation.SysLog; -import io.swagger.v3.oas.annotations.Operation; -import io.swagger.v3.oas.annotations.tags.Tag; -import lombok.RequiredArgsConstructor; -import org.springframework.web.bind.annotation.*; - -/** - * 表单管理 - * - * @author lengleng - * @date 2019-08-12 15:55:35 - */ -@RestController -@RequiredArgsConstructor -@RequestMapping("/form") -@Tag(description = "form", name = "表单管理") -public class GenFormConfController { - - private final GenFormConfService genRecordService; - - /** - * 分页查询 - * @param page 分页对象 - * @param formConf 生成记录 - * @return - */ - @Operation(description = "分页查询", summary = "分页查询") - @GetMapping("/page") - public R getGenFormConfPage(Page page, GenFormConf formConf) { - return R.ok(genRecordService.page(page, Wrappers.query(formConf))); - } - - /** - * 通过id查询生成记录 - * @param id id - * @return R - */ - @Operation(description = "通过id查询", summary = "通过id查询") - @GetMapping("/{id}") - public R getById(@PathVariable("id") Long id) { - return R.ok(genRecordService.getById(id)); - } - - /** - * 新增生成记录 - * @param formConf 生成记录 - * @return R - */ - @Operation(description = "新增生成记录", summary = "新增生成记录") - @PostMapping - public R save(@RequestBody GenFormConf formConf) { - genRecordService.save(formConf); - return R.ok(formConf); - } - - /** - * 修改生成记录 - * @param formConf 生成记录 - * @return R - */ - @Operation(description = "修改生成记录", summary = "修改生成记录") - @SysLog("修改生成记录") - @PutMapping - public R updateById(@RequestBody GenFormConf formConf) { - return R.ok(genRecordService.updateById(formConf)); - } - - /** - * 通过id删除生成记录 - * @param id id - * @return R - */ - @Operation(description = "通过id删除生成记录", summary = "通过id删除生成记录") - @SysLog("通过id删除生成记录") - @DeleteMapping("/{id}") - public R removeById(@PathVariable Long id) { - return R.ok(genRecordService.removeById(id)); - } - -} diff --git a/pigx-visual/pigx-codegen/src/main/java/com/pig4cloud/pigx/codegen/controller/GeneratorController.java b/pigx-visual/pigx-codegen/src/main/java/com/pig4cloud/pigx/codegen/controller/GeneratorController.java index 01d07c3b3..17f9f44d4 100755 --- a/pigx-visual/pigx-codegen/src/main/java/com/pig4cloud/pigx/codegen/controller/GeneratorController.java +++ b/pigx-visual/pigx-codegen/src/main/java/com/pig4cloud/pigx/codegen/controller/GeneratorController.java @@ -33,7 +33,6 @@ import org.springframework.web.bind.annotation.ResponseBody; import org.springframework.web.bind.annotation.RestController; import java.io.ByteArrayOutputStream; -import java.nio.charset.StandardCharsets; import java.util.List; import java.util.Map; import java.util.zip.ZipOutputStream; @@ -117,34 +116,4 @@ public class GeneratorController { return generatorService.preview(tableId); } - /** - * 获取表单设计器初始化数据 - * @param dsName 数据源名称 - * @param tableName 表名称 - * @return json string - */ - @SneakyThrows - @GetMapping("/vform") - public String vform(String dsName, String tableName) { - return generatorService.vform(dsName, tableName); - } - - /** - * 获取表单设计器初始化数据 - * @param formId 表单ID - * @return json string - */ - @SneakyThrows - @GetMapping("/vform/sfc") - public void vformSfc(Long formId, HttpServletResponse response) { - String result = generatorService.vformSfc(formId); - - byte[] data = result.getBytes(StandardCharsets.UTF_8); - response.reset(); - response.setHeader(HttpHeaders.CONTENT_DISPOSITION, "attachment; filename=form.vue"); - response.setContentLength(data.length); - response.setContentType("application/octet-stream; charset=UTF-8"); - IoUtil.write(response.getOutputStream(), false, data); - } - } diff --git a/pigx-visual/pigx-codegen/src/main/java/com/pig4cloud/pigx/codegen/entity/GenFormConf.java b/pigx-visual/pigx-codegen/src/main/java/com/pig4cloud/pigx/codegen/entity/GenFormConf.java deleted file mode 100755 index 337cfc4cb..000000000 --- a/pigx-visual/pigx-codegen/src/main/java/com/pig4cloud/pigx/codegen/entity/GenFormConf.java +++ /dev/null @@ -1,94 +0,0 @@ -/* - * Copyright (c) 2018-2026, lengleng All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * - * Redistributions of source code must retain the above copyright notice, - * this list of conditions and the following disclaimer. - * Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * Neither the name of the pig4cloud.com developer nor the names of its - * contributors may be used to endorse or promote products derived from - * this software without specific prior written permission. - * Author: lengleng (wangiegie@gmail.com) - */ - -package com.pig4cloud.pigx.codegen.entity; - -import com.baomidou.mybatisplus.annotation.*; -import com.baomidou.mybatisplus.extension.activerecord.Model; -import com.pig4cloud.pigx.common.core.util.TenantTable; -import io.swagger.v3.oas.annotations.media.Schema; -import lombok.Data; -import lombok.EqualsAndHashCode; - -import java.time.LocalDateTime; - -/** - * 生成记录 - * - * @author lengleng - * @date 2019-08-12 15:55:35 - */ -@Data -@TenantTable -@TableName("gen_form_conf") -@EqualsAndHashCode(callSuper = true) -@Schema(description = "生成记录") -public class GenFormConf extends Model { - - private static final long serialVersionUID = 1L; - - /** - * ID - */ - @TableId(type = IdType.ASSIGN_ID) - @Schema(description = "ID") - private Long id; - - /** - * 数据源名称 - */ - @Schema(description = "数据源名称") - private String dsName; - - /** - * 表名称 - */ - @Schema(description = "表名称") - private String tableName; - - /** - * 表单信息 - */ - @Schema(description = "表单信息") - private String formInfo; - - /** - * 创建时间 - */ - @TableField(fill = FieldFill.INSERT) - private LocalDateTime createTime; - - /** - * 修改时间 - */ - @TableField(fill = FieldFill.UPDATE) - private LocalDateTime updateTime; - - /** - * 0-正常,1-删除 - */ - @TableLogic - @TableField(fill = FieldFill.INSERT) - private String delFlag; - - /** - * 所属租户 - */ - @Schema(description = "所属租户", hidden = true) - private Long tenantId; - -} diff --git a/pigx-visual/pigx-codegen/src/main/java/com/pig4cloud/pigx/codegen/mapper/GenFormConfMapper.java b/pigx-visual/pigx-codegen/src/main/java/com/pig4cloud/pigx/codegen/mapper/GenFormConfMapper.java deleted file mode 100755 index da218e8e1..000000000 --- a/pigx-visual/pigx-codegen/src/main/java/com/pig4cloud/pigx/codegen/mapper/GenFormConfMapper.java +++ /dev/null @@ -1,33 +0,0 @@ -/* - * Copyright (c) 2018-2026, lengleng All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * - * Redistributions of source code must retain the above copyright notice, - * this list of conditions and the following disclaimer. - * Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * Neither the name of the pig4cloud.com developer nor the names of its - * contributors may be used to endorse or promote products derived from - * this software without specific prior written permission. - * Author: lengleng (wangiegie@gmail.com) - */ - -package com.pig4cloud.pigx.codegen.mapper; - -import com.pig4cloud.pigx.codegen.entity.GenFormConf; -import com.pig4cloud.pigx.common.data.datascope.PigxBaseMapper; -import org.apache.ibatis.annotations.Mapper; - -/** - * 生成记录 - * - * @author lengleng - * @date 2019-08-12 15:55:35 - */ -@Mapper -public interface GenFormConfMapper extends PigxBaseMapper { - -} diff --git a/pigx-visual/pigx-codegen/src/main/java/com/pig4cloud/pigx/codegen/service/GenFormConfService.java b/pigx-visual/pigx-codegen/src/main/java/com/pig4cloud/pigx/codegen/service/GenFormConfService.java deleted file mode 100755 index a450e56ae..000000000 --- a/pigx-visual/pigx-codegen/src/main/java/com/pig4cloud/pigx/codegen/service/GenFormConfService.java +++ /dev/null @@ -1,42 +0,0 @@ -/* - * Copyright (c) 2018-2026, lengleng All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * - * Redistributions of source code must retain the above copyright notice, - * this list of conditions and the following disclaimer. - * Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * Neither the name of the pig4cloud.com developer nor the names of its - * contributors may be used to endorse or promote products derived from - * this software without specific prior written permission. - * Author: lengleng (wangiegie@gmail.com) - */ - -package com.pig4cloud.pigx.codegen.service; - -import cn.hutool.json.JSONObject; -import com.baomidou.mybatisplus.extension.service.IService; -import com.pig4cloud.pigx.codegen.entity.GenFormConf; - -import java.util.List; -import java.util.Map; - -/** - * 表单管理 - * - * @author lengleng - * @date 2019-08-12 15:55:35 - */ -public interface GenFormConfService extends IService { - - /** - * 解析 form json - * @param formInfo json - * @return 字段 - */ - Map> parse(String formInfo); - -} diff --git a/pigx-visual/pigx-codegen/src/main/java/com/pig4cloud/pigx/codegen/service/GeneratorService.java b/pigx-visual/pigx-codegen/src/main/java/com/pig4cloud/pigx/codegen/service/GeneratorService.java index 60eb9469a..d9d0ab22e 100644 --- a/pigx-visual/pigx-codegen/src/main/java/com/pig4cloud/pigx/codegen/service/GeneratorService.java +++ b/pigx-visual/pigx-codegen/src/main/java/com/pig4cloud/pigx/codegen/service/GeneratorService.java @@ -50,23 +50,6 @@ public interface GeneratorService { */ void generatorCode(Long tableId); - /** - * 获取表单设计器需要的 JSON - * - * @param dsName 数据源名称 - * @param tableName 表名称 - * @return json string - */ - String vform(String dsName, String tableName); - - /** - * 获取表单设计器需要的 JSON - * - * @param formId 数据源名称 - * @return json string - */ - String vformSfc(Long formId); - /** * 同步路由和菜单 * diff --git a/pigx-visual/pigx-codegen/src/main/java/com/pig4cloud/pigx/codegen/service/impl/GenFormConfServiceImpl.java b/pigx-visual/pigx-codegen/src/main/java/com/pig4cloud/pigx/codegen/service/impl/GenFormConfServiceImpl.java deleted file mode 100755 index a7894712a..000000000 --- a/pigx-visual/pigx-codegen/src/main/java/com/pig4cloud/pigx/codegen/service/impl/GenFormConfServiceImpl.java +++ /dev/null @@ -1,105 +0,0 @@ -/* - * Copyright (c) 2018-2026, lengleng All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * - * Redistributions of source code must retain the above copyright notice, - * this list of conditions and the following disclaimer. - * Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * Neither the name of the pig4cloud.com developer nor the names of its - * contributors may be used to endorse or promote products derived from - * this software without specific prior written permission. - * Author: lengleng (wangiegie@gmail.com) - */ -package com.pig4cloud.pigx.codegen.service.impl; - -import cn.hutool.core.util.RandomUtil; -import cn.hutool.json.JSONArray; -import cn.hutool.json.JSONObject; -import cn.hutool.json.JSONUtil; -import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; -import com.pig4cloud.pigx.codegen.entity.GenFormConf; -import com.pig4cloud.pigx.codegen.mapper.GenFormConfMapper; -import com.pig4cloud.pigx.codegen.service.GenFormConfService; -import com.pig4cloud.pigx.codegen.util.VFormConfigConsts; -import com.pig4cloud.pigx.codegen.util.VFormTypeEnum; -import org.springframework.stereotype.Service; - -import java.util.*; - -/** - * 表单管理 - * - * @author lengleng - * @date 2019-08-12 15:55:35 - */ -@Service -public class GenFormConfServiceImpl extends ServiceImpl implements GenFormConfService { - - /** - * 表单解析方法 - * @param formInfo json - * @return 字段列表 - */ - @Override - public Map> parse(String formInfo) { - JSONObject jsonObject = JSONUtil.parseObj(formInfo); - Map> resultMap = new LinkedHashMap<>(); - parseForm(jsonObject, resultMap); - return resultMap; - } - - /** - * 解析 form config - * @param json 表单配置 - * @param resultMap 返回结果 - */ - private void parseForm(JSONObject json, Map> resultMap) { - JSONArray widgetList = json.getJSONArray(VFormConfigConsts.widgetList); - String groupKey = json.getStr(VFormConfigConsts.groupKey, RandomUtil.randomString(5)); - widgetList.stream().map(o -> (JSONObject) o).forEach(jsonObject -> { - String type = jsonObject.getStr(VFormConfigConsts.type); - if (VFormTypeEnum.GRID.getType().equals(type)) { - parseGrid(jsonObject, resultMap); - } - else if (VFormTypeEnum.GRID_COL.getType().equals(type)) { - parseForm(jsonObject, resultMap); - } - else { - int span = Optional.ofNullable(json.getJSONObject(VFormConfigConsts.options)) - .map(options -> options.getInt(VFormConfigConsts.span, 24)) - .orElse(24); - - jsonObject.set(VFormConfigConsts.span, span); - - List jsonObjects = resultMap.computeIfAbsent(groupKey, k -> new ArrayList<>()); - jsonObjects.add(jsonObject); - } - }); - } - - /** - * 解析 grid 容器 - * @param jsonObject 入参 - * @param resultMap 结果 - */ - private void parseGrid(JSONObject jsonObject, Map> resultMap) { - JSONArray cols = jsonObject.getJSONArray(VFormConfigConsts.cols); - String key = jsonObject.getStr(VFormConfigConsts.key); - cols.stream().map(o -> (JSONObject) o).forEach(col -> { - String colType = col.getStr(VFormConfigConsts.type); - if (VFormTypeEnum.GRID_COL.getType().equals(colType)) { - col.set(VFormConfigConsts.groupKey, key); - parseForm(col, resultMap); - } - - if (VFormTypeEnum.GRID.getType().equals(colType)) { - parseGrid(col, resultMap); - } - }); - } - -} diff --git a/pigx-visual/pigx-codegen/src/main/java/com/pig4cloud/pigx/codegen/service/impl/GeneratorServiceImpl.java b/pigx-visual/pigx-codegen/src/main/java/com/pig4cloud/pigx/codegen/service/impl/GeneratorServiceImpl.java index e8577cfdf..78ae80ed2 100755 --- a/pigx-visual/pigx-codegen/src/main/java/com/pig4cloud/pigx/codegen/service/impl/GeneratorServiceImpl.java +++ b/pigx-visual/pigx-codegen/src/main/java/com/pig4cloud/pigx/codegen/service/impl/GeneratorServiceImpl.java @@ -25,20 +25,16 @@ import cn.hutool.core.map.MapUtil; import cn.hutool.core.text.NamingCase; import cn.hutool.core.util.BooleanUtil; import cn.hutool.core.util.StrUtil; -import cn.hutool.json.JSONObject; -import com.baomidou.mybatisplus.core.toolkit.Wrappers; import com.pig4cloud.pigx.admin.api.entity.SysMenu; import com.pig4cloud.pigx.admin.api.entity.SysRouteConf; import com.pig4cloud.pigx.admin.api.feign.RemoteMenuService; import com.pig4cloud.pigx.admin.api.feign.RemoteRouteConfService; import com.pig4cloud.pigx.codegen.config.PigxCodeGenDefaultProperties; -import com.pig4cloud.pigx.codegen.entity.GenFormConf; import com.pig4cloud.pigx.codegen.entity.GenTable; import com.pig4cloud.pigx.codegen.entity.GenTableColumnEntity; import com.pig4cloud.pigx.codegen.entity.GenTemplateEntity; import com.pig4cloud.pigx.codegen.service.*; import com.pig4cloud.pigx.codegen.util.DataModelConstants; -import com.pig4cloud.pigx.codegen.util.GeneratorStyleEnum; import com.pig4cloud.pigx.codegen.util.VelocityKit; import com.pig4cloud.pigx.codegen.util.vo.GroupVO; import com.pig4cloud.pigx.common.core.constant.enums.MenuTypeEnum; @@ -74,8 +70,6 @@ public class GeneratorServiceImpl implements GeneratorService { private final GenTableColumnService columnService; - private final GenFormConfService formConfService; - private final GenFieldTypeService fieldTypeService; private final GenTableService tableService; @@ -208,67 +202,6 @@ public class GeneratorServiceImpl implements GeneratorService { } } - /** - * 获取表单设计器需要的 JSON 方法 - * - * @param dsName 数据源名称 - * @param tableName 表名称 - * @return JSON 字符串 - */ - @SneakyThrows - @Override - public String vform(String dsName, String tableName) { - // 查询表的元数据 - GenTable genTable = tableService.queryOrBuildTable(dsName, tableName); - - // 获取数据模型 - Map dataModel = getDataModel(genTable.getId()); - - // 获取模板信息,Lambda 表达式简化代码 - GenTemplateEntity genTemplateEntity = genTemplateService - .getOneOpt(Wrappers.lambdaQuery() - .likeRight(GenTemplateEntity::getTemplateName, GeneratorStyleEnum.VFORM_JSON.getDesc()) - .orderByDesc(GenTemplateEntity::getCreateTime), false) - .orElseThrow(() -> new CheckedException("模板不存在")); - // 渲染模板并返回结果 - return VelocityKit.renderStr(genTemplateEntity.getTemplateCode(), dataModel); - } - - /** - * 获取sfc vue - * - * @param id 表单配置 ID - * @return JSON 字符串 - */ - @SneakyThrows - @Override - public String vformSfc(Long id) { - // 获取表单配置信息 - GenFormConf formConf = formConfService.getById(id); - - // 查询表的元数据 - GenTable genTable = tableService.queryOrBuildTable(formConf.getDsName(), formConf.getTableName()); - - // 获取数据模型 - Map dataModel = getDataModel(genTable.getId()); - - // 解析组件列表 - Map> resultMap = formConfService.parse(formConf.getFormInfo()); - - // 遍历 widgetList - dataModel.put("resultMap", resultMap); - - // 获取模板信息 查询模板中最新的 vform.json 文件 - GenTemplateEntity genTemplateEntity = genTemplateService - .getOneOpt(Wrappers.lambdaQuery() - .likeRight(GenTemplateEntity::getTemplateName, GeneratorStyleEnum.VFORM_VUE.getDesc()) - .orderByDesc(GenTemplateEntity::getCreateTime), false) - .orElseThrow(() -> new CheckedException("模板不存在")); - - // 渲染模板并返回结果 - return VelocityKit.renderStr(genTemplateEntity.getTemplateCode(), dataModel); - } - /** * 同步路由和菜单 * diff --git a/pigx-visual/pigx-codegen/src/main/java/com/pig4cloud/pigx/codegen/util/GeneratorStyleEnum.java b/pigx-visual/pigx-codegen/src/main/java/com/pig4cloud/pigx/codegen/util/GeneratorStyleEnum.java deleted file mode 100644 index 0990c0d55..000000000 --- a/pigx-visual/pigx-codegen/src/main/java/com/pig4cloud/pigx/codegen/util/GeneratorStyleEnum.java +++ /dev/null @@ -1,29 +0,0 @@ -package com.pig4cloud.pigx.codegen.util; - -import lombok.Getter; -import lombok.RequiredArgsConstructor; - -/** - * 代码生成主题 - * - * @author 冷冷 - */ -@Getter -@RequiredArgsConstructor -public enum GeneratorStyleEnum { - - VFORM_JSON(1L, "vform.json"), - - VFORM_VUE(2L, "vform.vue"); - - /** - * 对应模板ID - */ - private final Long templateId; - - /** - * 描述 - */ - private final String desc; - -} diff --git a/pigx-visual/pigx-codegen/src/main/java/com/pig4cloud/pigx/codegen/util/VFormConfigConsts.java b/pigx-visual/pigx-codegen/src/main/java/com/pig4cloud/pigx/codegen/util/VFormConfigConsts.java deleted file mode 100644 index 9172a99c1..000000000 --- a/pigx-visual/pigx-codegen/src/main/java/com/pig4cloud/pigx/codegen/util/VFormConfigConsts.java +++ /dev/null @@ -1,25 +0,0 @@ -package com.pig4cloud.pigx.codegen.util; - -/** - * vform 的通用变量 - * - * @author lengleng - * @date 2023/6/5 - */ -public interface VFormConfigConsts { - - String widgetList = "widgetList"; - - String groupKey = "groupKey"; - - String type = "type"; - - String options = "options"; - - String span = "span"; - - String cols = "cols"; - - String key = "key"; - -} diff --git a/pigx-visual/pigx-codegen/src/main/java/com/pig4cloud/pigx/codegen/util/VFormTypeEnum.java b/pigx-visual/pigx-codegen/src/main/java/com/pig4cloud/pigx/codegen/util/VFormTypeEnum.java deleted file mode 100644 index b1713edfa..000000000 --- a/pigx-visual/pigx-codegen/src/main/java/com/pig4cloud/pigx/codegen/util/VFormTypeEnum.java +++ /dev/null @@ -1,22 +0,0 @@ -package com.pig4cloud.pigx.codegen.util; - -import lombok.Getter; -import lombok.RequiredArgsConstructor; - -/** - * vfrom 字段类型 - * - * @author lengleng - * @date 2023/6/5 - */ -@Getter -@RequiredArgsConstructor -public enum VFormTypeEnum { - - GRID("grid"), - - GRID_COL("grid-col"); - - private final String type; - -} diff --git a/pigx-visual/pigx-codegen/src/main/resources/mapper/GenFormConfMapper.xml b/pigx-visual/pigx-codegen/src/main/resources/mapper/GenFormConfMapper.xml deleted file mode 100755 index 5e1439fd8..000000000 --- a/pigx-visual/pigx-codegen/src/main/resources/mapper/GenFormConfMapper.xml +++ /dev/null @@ -1,33 +0,0 @@ - - - - - - - - - - - - - - - - - -