beansOfType = context.getBeansOfType(GeneratorMapper.class);
-
- // 根据数据类型选择mapper
- for (String key : beansOfType.keySet()) {
- if (StrUtil.containsIgnoreCase(key, dbConfType)) {
- return beansOfType.get(key);
- }
- }
-
- throw new IllegalArgumentException("dsName 不合法: " + dsName);
- }
-
}
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
index 1de308c33..ce9fac70d 100644
--- 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
@@ -12,9 +12,9 @@ import lombok.Getter;
@AllArgsConstructor
public enum GeneratorStyleEnum {
- VFORM_JSON(1L, "element-plus 风格"),
+ VFORM_JSON(1L, "vform.json"),
- VFORM_FORM(2L, "uview 风格");
+ VFORM_VUE(2L, "vform.vue");
/**
* 对应模板ID
diff --git a/pigx-visual/pigx-codegen/src/main/java/com/pig4cloud/pigx/codegen/util/GeneratorTypeEnum.java b/pigx-visual/pigx-codegen/src/main/java/com/pig4cloud/pigx/codegen/util/GeneratorTypeEnum.java
deleted file mode 100644
index 20902119a..000000000
--- a/pigx-visual/pigx-codegen/src/main/java/com/pig4cloud/pigx/codegen/util/GeneratorTypeEnum.java
+++ /dev/null
@@ -1,26 +0,0 @@
-package com.pig4cloud.pigx.codegen.util;
-
-import lombok.Getter;
-import lombok.RequiredArgsConstructor;
-
-/**
- * 代码生成方式 枚举
- *
- * @author 阿沐 babamu@126.com
- */
-@Getter
-@RequiredArgsConstructor
-public enum GeneratorTypeEnum {
-
- /**
- * zip压缩包 0
- */
- ZIP_DOWNLOAD("0"),
- /**
- * 自定义目录 1
- */
- CUSTOM_DIRECTORY("1");
-
- private final String value;
-
-}
diff --git a/pigx-visual/pigx-codegen/src/main/java/com/pig4cloud/pigx/codegen/util/vo/GenCreateTableVO.java b/pigx-visual/pigx-codegen/src/main/java/com/pig4cloud/pigx/codegen/util/vo/GenCreateTableVO.java
index 52b5935eb..e4935808b 100755
--- a/pigx-visual/pigx-codegen/src/main/java/com/pig4cloud/pigx/codegen/util/vo/GenCreateTableVO.java
+++ b/pigx-visual/pigx-codegen/src/main/java/com/pig4cloud/pigx/codegen/util/vo/GenCreateTableVO.java
@@ -17,10 +17,9 @@ package com.pig4cloud.pigx.codegen.util.vo;
*/
import io.swagger.v3.oas.annotations.media.Schema;
-import javax.validation.constraints.NotBlank;
import lombok.Data;
-import java.io.Serializable;
+import javax.validation.constraints.NotBlank;
import java.time.LocalDateTime;
/**
@@ -31,7 +30,7 @@ import java.time.LocalDateTime;
*/
@Data
@Schema(description = "自动创建表管理")
-public class GenCreateTableVO implements Serializable {
+public class GenCreateTableVO {
private static final long serialVersionUID = 1L;
diff --git a/pigx-visual/pigx-codegen/src/main/java/com/pig4cloud/pigx/codegen/util/vo/GenTemplateFileVO.java b/pigx-visual/pigx-codegen/src/main/java/com/pig4cloud/pigx/codegen/util/vo/GenTemplateFileVO.java
new file mode 100644
index 000000000..cd640bf69
--- /dev/null
+++ b/pigx-visual/pigx-codegen/src/main/java/com/pig4cloud/pigx/codegen/util/vo/GenTemplateFileVO.java
@@ -0,0 +1,37 @@
+package com.pig4cloud.pigx.codegen.util.vo;
+
+import lombok.Data;
+
+/**
+ * @author lengleng
+ * @date 2024/7/13
+ *
+ * CGTM 文件路径
+ *
+ * {
+ * "templateName": "Controller",
+ * "generatorPath": "${backendPath}/src/main/java/${packagePath}/${moduleName}/controller/${ClassName}Controller.java",
+ * "templateDesc": "后台Controller",
+ * "templateFile": "temps/Controller"
+ * },
+ */
+@Data
+public class GenTemplateFileVO {
+ /**
+ * 模板名称
+ */
+ private String templateName;
+ /**
+ * 路径
+ */
+ private String generatorPath;
+ /**
+ * 模板 desc
+ */
+ private String templateDesc;
+ /**
+ * 模板文件
+ */
+ private String templateFile;
+
+}
diff --git a/pigx-visual/pigx-codegen/src/main/java/com/pig4cloud/pigx/codegen/util/vo/GroupVo.java b/pigx-visual/pigx-codegen/src/main/java/com/pig4cloud/pigx/codegen/util/vo/GroupVO.java
similarity index 97%
rename from pigx-visual/pigx-codegen/src/main/java/com/pig4cloud/pigx/codegen/util/vo/GroupVo.java
rename to pigx-visual/pigx-codegen/src/main/java/com/pig4cloud/pigx/codegen/util/vo/GroupVO.java
index 23db2828e..cb404cf42 100644
--- a/pigx-visual/pigx-codegen/src/main/java/com/pig4cloud/pigx/codegen/util/vo/GroupVo.java
+++ b/pigx-visual/pigx-codegen/src/main/java/com/pig4cloud/pigx/codegen/util/vo/GroupVO.java
@@ -9,7 +9,7 @@ import lombok.Data;
import java.util.List;
@Data
-public class GroupVo {
+public class GroupVO {
/**
* id
diff --git a/pigx-visual/pigx-codegen/src/main/resources/application-dev.yml b/pigx-visual/pigx-codegen/src/main/resources/application-dev.yml
deleted file mode 100644
index 550751e58..000000000
--- a/pigx-visual/pigx-codegen/src/main/resources/application-dev.yml
+++ /dev/null
@@ -1,25 +0,0 @@
-# 数据源
-spring:
- redis:
- host: pigx-redis
- database: 9 #避免和微服务 PIGX 冲突
- datasource:
- type: com.alibaba.druid.pool.DruidDataSource
- druid:
- driver-class-name: com.mysql.cj.jdbc.Driver
- username: root
- password: root
- url: jdbc:mysql://pigx-mysql:3306/pigxx_boot_codegen?characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=false&useJDBCCompliantTimezoneShift=true&useLegacyDatetimeCode=false&serverTimezone=GMT%2B8&allowMultiQueries=true&allowPublicKeyRetrieval=true
- web:
- resources:
- static-locations: classpath:/static/,classpath:/views/
-
-# 租户表维护
-pigx:
- tenant:
- column: tenant_id
- tables:
- - gen_datasource_conf
- - gen_form_conf
- - gen_template
- - gen_group
diff --git a/pigx-visual/pigx-codegen/src/main/resources/mapper/GenGroupMapper.xml b/pigx-visual/pigx-codegen/src/main/resources/mapper/GenGroupMapper.xml
index 634d5fec6..b7c3fb1e2 100644
--- a/pigx-visual/pigx-codegen/src/main/resources/mapper/GenGroupMapper.xml
+++ b/pigx-visual/pigx-codegen/src/main/resources/mapper/GenGroupMapper.xml
@@ -3,7 +3,7 @@
-
+
diff --git a/pigx-visual/pigx-codegen/src/main/resources/mapper/GeneratorDB2Mapper.xml b/pigx-visual/pigx-codegen/src/main/resources/mapper/GeneratorDB2Mapper.xml
deleted file mode 100755
index 51d54cab8..000000000
--- a/pigx-visual/pigx-codegen/src/main/resources/mapper/GeneratorDB2Mapper.xml
+++ /dev/null
@@ -1,44 +0,0 @@
-
-
-
-
-
-
-
-
-
- SELECT 'db2' AS "dbType",
- COLNAME AS "columnName",
- TYPENAME AS "dataType",
- REMARKS AS "comments",
- TYPENAME AS "columnType"
- FROM SYSCAT.COLUMNS
- WHERE TABSCHEMA = (SELECT CURRENT_SCHEMA
- FROM SYSIBM.SYSDUMMY1
- )
- and TABNAME = #{tableName}
-
-
-
-
-
-
-
diff --git a/pigx-visual/pigx-codegen/src/main/resources/mapper/GeneratorDmMapper.xml b/pigx-visual/pigx-codegen/src/main/resources/mapper/GeneratorDmMapper.xml
deleted file mode 100755
index 0b06e793e..000000000
--- a/pigx-visual/pigx-codegen/src/main/resources/mapper/GeneratorDmMapper.xml
+++ /dev/null
@@ -1,70 +0,0 @@
-
-
-
-
-
-
-
-
- SELECT
- 'dm' AS "dbType",
- TEMP.COLUMN_NAME AS "columnName",
- TEMP.data_type AS "columnType",
- TEMP.data_type AS "dataType",
- TEMP.comments AS "comments",
- CASE
- TEMP.constraint_type
- WHEN 'P' THEN
- 'PRI'
- WHEN 'C' THEN
- 'UNI' ELSE''
- END "columnKey"
- FROM
- (
- SELECT
- col.column_id,
- col.COLUMN_NAME,
- col.data_type,
- colc.comments,
- uc.constraint_type,
- ROW_NUMBER ( ) OVER (
- PARTITION BY col.COLUMN_NAME
- ORDER BY
- uc.constraint_type DESC
- ) AS row_flg
- FROM
- user_tab_columns col
- LEFT JOIN user_col_comments colc ON colc.TABLE_NAME = col.TABLE_NAME
- AND colc.COLUMN_NAME = col.
- COLUMN_NAME LEFT JOIN user_cons_columns ucc ON ucc.TABLE_NAME = col.TABLE_NAME
- AND ucc.COLUMN_NAME = col.
- COLUMN_NAME LEFT JOIN user_constraints uc ON uc.CONSTRAINT_NAME = ucc.CONSTRAINT_NAME
- WHERE
- col.TABLE_NAME = #{tableName}
- ) TEMP
- WHERE
- TEMP.row_flg = 1
- ORDER BY
- TEMP.column_id
-
-
-
-
-
-
-
diff --git a/pigx-visual/pigx-codegen/src/main/resources/mapper/GeneratorHighGoMapper.xml b/pigx-visual/pigx-codegen/src/main/resources/mapper/GeneratorHighGoMapper.xml
deleted file mode 100755
index 95f9321db..000000000
--- a/pigx-visual/pigx-codegen/src/main/resources/mapper/GeneratorHighGoMapper.xml
+++ /dev/null
@@ -1,65 +0,0 @@
-
-
-
-
-
-
-
-
-
- SELECT
- 'highgo' AS "dbType",
- pa.attname AS "columnName",
- pg_type.typname AS "columnType",
- pg_type.typname AS "dataType",
- col_description ( pa.attrelid, pa.attnum ) AS "comments",
- (
- CASE
- pcon.contype
- WHEN 'p' THEN
- 'PRI' ELSE''
- END
- ) AS "columnKey"
- FROM
- pg_class AS pc,
- pg_attribute AS pa
- INNER JOIN pg_type ON pg_type.oid = pa.atttypid
- LEFT JOIN pg_constraint pcon ON pa.attnum = pcon.conkey[1]
- AND pa.attrelid = pcon.conrelid
- WHERE
- pc.relname = #{ tableName }
- AND pa.attrelid = pc.oid
- AND pa.attnum > 0
-
-
-
-
-
-
diff --git a/pigx-visual/pigx-codegen/src/main/resources/mapper/GeneratorMssqlMapper.xml b/pigx-visual/pigx-codegen/src/main/resources/mapper/GeneratorMssqlMapper.xml
deleted file mode 100755
index 3e3b6ed10..000000000
--- a/pigx-visual/pigx-codegen/src/main/resources/mapper/GeneratorMssqlMapper.xml
+++ /dev/null
@@ -1,86 +0,0 @@
-
-
-
-
-
-
-
-
- SELECT
- 'mssql' AS dbType,
- CAST ( b.NAME AS NVARCHAR ( 500 ) ) AS columnName,
- CAST ( sys.types.NAME AS NVARCHAR ( 500 ) ) AS dataType,
- CAST ( sys.types.NAME AS NVARCHAR ( 500 ) ) AS columnType,
- CAST ( c.VALUE AS NVARCHAR ( 500 ) ) AS comments,
- (
- SELECT
- CASE
- COUNT
- ( 1 )
- WHEN 1 THEN
- 'PRI' ELSE ''
- END
- FROM
- syscolumns,
- sysobjects,
- sysindexes,
- sysindexkeys,
- systypes
- WHERE
- syscolumns.xusertype = systypes.xusertype
- AND syscolumns.id = object_id( A.NAME )
- AND sysobjects.xtype = 'PK'
- AND sysobjects.parent_obj = syscolumns.id
- AND sysindexes.id = syscolumns.id
- AND sysobjects.NAME = sysindexes.NAME
- AND sysindexkeys.id = syscolumns.id
- AND sysindexkeys.indid = sysindexes.indid
- AND syscolumns.colid = sysindexkeys.colid
- AND syscolumns.NAME = B.NAME
- ) AS columnKey,
- '' AS extra
- FROM
- (
- SELECT
- name,
- object_id
- FROM
- sys.tables UNION ALL
- SELECT
- name,
- object_id
- FROM
- sys.views
- ) a
- INNER JOIN sys.COLUMNS b ON b.object_id = a.object_id
- LEFT JOIN sys.types ON b.user_type_id = sys.types.user_type_id
- LEFT JOIN sys.extended_properties c ON c.major_id = b.object_id
- AND c.minor_id = b.column_id
- WHERE a.NAME = #{tableName} and sys.types.NAME != 'sysname'
-
-
-
-
-
-
-
diff --git a/pigx-visual/pigx-codegen/src/main/resources/mapper/GeneratorMySqlMapper.xml b/pigx-visual/pigx-codegen/src/main/resources/mapper/GeneratorMySqlMapper.xml
deleted file mode 100755
index 832acb45c..000000000
--- a/pigx-visual/pigx-codegen/src/main/resources/mapper/GeneratorMySqlMapper.xml
+++ /dev/null
@@ -1,48 +0,0 @@
-
-
-
-
-
-
-
-
- SELECT
- column_name columnName,
- data_type dataType,
- column_comment comments,
- column_key columnKey,
- extra,
- is_nullable AS isNullable,
- column_type AS columnType
- FROM
- information_schema.COLUMNS
- WHERE
- table_name = #{tableName} and table_schema = (select database()) order by ordinal_position
-
-
-
-
-
-
-
diff --git a/pigx-visual/pigx-codegen/src/main/resources/mapper/GeneratorOracleMapper.xml b/pigx-visual/pigx-codegen/src/main/resources/mapper/GeneratorOracleMapper.xml
deleted file mode 100755
index 8489707e4..000000000
--- a/pigx-visual/pigx-codegen/src/main/resources/mapper/GeneratorOracleMapper.xml
+++ /dev/null
@@ -1,72 +0,0 @@
-
-
-
-
-
-
-
-
- SELECT
- 'oracle' AS "dbType",
- TEMP.COLUMN_NAME AS "columnName",
- TEMP.data_type AS "columnType",
- TEMP.data_type AS "dataType",
- TEMP.comments AS "comments",
- CASE
- TEMP.constraint_type
- WHEN 'P' THEN
- 'PRI'
- WHEN 'C' THEN
- 'UNI' ELSE''
- END "columnKey"
- FROM
- (
- SELECT
- col.column_id,
- col.COLUMN_NAME,
- col.data_type,
- colc.comments,
- uc.constraint_type,
- ROW_NUMBER ( ) OVER (
- PARTITION BY col.COLUMN_NAME
- ORDER BY
- uc.constraint_type DESC
- ) AS row_flg
- FROM
- user_tab_columns col
- LEFT JOIN user_col_comments colc ON colc.TABLE_NAME = col.TABLE_NAME
- AND colc.COLUMN_NAME = col.
- COLUMN_NAME LEFT JOIN user_cons_columns ucc ON ucc.TABLE_NAME = col.TABLE_NAME
- AND ucc.COLUMN_NAME = col.
- COLUMN_NAME LEFT JOIN user_constraints uc ON uc.CONSTRAINT_NAME = ucc.CONSTRAINT_NAME
- WHERE
- col.TABLE_NAME = #{tableName}
- ) TEMP
- WHERE
- TEMP.row_flg = 1
- ORDER BY
- TEMP.column_id
-
-
-
-
-
-
-
diff --git a/pigx-visual/pigx-codegen/src/main/resources/mapper/GeneratorPostgresqlMapper.xml b/pigx-visual/pigx-codegen/src/main/resources/mapper/GeneratorPostgresqlMapper.xml
deleted file mode 100755
index 4fc7ce525..000000000
--- a/pigx-visual/pigx-codegen/src/main/resources/mapper/GeneratorPostgresqlMapper.xml
+++ /dev/null
@@ -1,57 +0,0 @@
-
-
-
-
-
-
-
-
-
- SELECT
- 'pg' AS "dbType",
- pa.attname AS "columnName",
- pg_type.typname AS "columnType",
- pg_type.typname AS "dataType",
- col_description ( pa.attrelid, pa.attnum ) AS "comments",
- (
- CASE
- pcon.contype
- WHEN 'p' THEN
- 'PRI' ELSE''
- END
- ) AS "columnKey"
- FROM
- pg_class AS pc,
- pg_attribute AS pa
- INNER JOIN pg_type ON pg_type.oid = pa.atttypid
- LEFT JOIN pg_constraint pcon ON pa.attnum = pcon.conkey[1]
- AND pa.attrelid = pcon.conrelid
- WHERE
- pc.relname = #{ tableName }
- AND pa.attrelid = pc.oid
- AND pa.attnum > 0
-
-
-
-
-
-
diff --git a/pigx-visual/pigx-codegen/src/main/resources/template/config.json b/pigx-visual/pigx-codegen/src/main/resources/template/config.json
deleted file mode 100644
index bfc7139d3..000000000
--- a/pigx-visual/pigx-codegen/src/main/resources/template/config.json
+++ /dev/null
@@ -1,12 +0,0 @@
-{
- "project": {
- "packageName": "com.pig4cloud.pigx",
- "version": "1.0.0",
- "backendPath": "pigx",
- "frontendPath": "pigx-ui"
- },
- "developer": {
- "author": "pig",
- "email": "sw@mail.pigx.vip"
- }
-}
diff --git a/pigx-visual/pigx-pay-platform/src/main/java/com/pig4cloud/pigx/pay/config/SequenceConfig.java b/pigx-visual/pigx-pay-platform/src/main/java/com/pig4cloud/pigx/pay/config/SequenceConfig.java
index 55ba4270b..66377072b 100644
--- a/pigx-visual/pigx-pay-platform/src/main/java/com/pig4cloud/pigx/pay/config/SequenceConfig.java
+++ b/pigx-visual/pigx-pay-platform/src/main/java/com/pig4cloud/pigx/pay/config/SequenceConfig.java
@@ -3,13 +3,11 @@ package com.pig4cloud.pigx.pay.config;
import cn.hutool.core.date.DateUtil;
import com.pig4cloud.pigx.common.data.tenant.TenantContextHolder;
import com.pig4cloud.pigx.common.sequence.builder.DbSeqBuilder;
-import com.pig4cloud.pigx.common.sequence.properties.SequenceDbProperties;
+import com.pig4cloud.pigx.common.sequence.properties.BaseSequenceProperties;
import com.pig4cloud.pigx.common.sequence.sequence.Sequence;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
-import javax.sql.DataSource;
-
/**
* @author lengleng
* @date 2019-05-26
@@ -21,29 +19,34 @@ public class SequenceConfig {
/**
* 订单流水号发号器
- * @param dataSource
- * @param properties
+ *
+ * @param properties 配置
* @return
*/
@Bean
- public Sequence paySequence(DataSource dataSource, SequenceDbProperties properties) {
+ public Sequence paySequence(BaseSequenceProperties properties) {
return DbSeqBuilder.create()
.bizName(() -> String.format("pay_%s_%s", TenantContextHolder.getTenantId(), DateUtil.today()))
- .dataSource(dataSource).step(properties.getStep()).retryTimes(properties.getRetryTimes())
- .tableName(properties.getTableName()).build();
+ .step(properties.getStep())
+ .retryTimes(properties.getDb().getRetryTimes())
+ .tableName(properties.getDb().getTableName())
+ .build();
}
/**
* 通道编号发号器
- * @param dataSource
- * @param properties
+ *
+ * @param properties 配置
* @return
*/
@Bean
- public Sequence channelSequence(DataSource dataSource, SequenceDbProperties properties) {
- return DbSeqBuilder.create().bizName(() -> String.format("channel_%s", TenantContextHolder.getTenantId()))
- .dataSource(dataSource).step(properties.getStep()).retryTimes(properties.getRetryTimes())
- .tableName(properties.getTableName()).build();
+ public Sequence channelSequence(BaseSequenceProperties properties) {
+ return DbSeqBuilder.create()
+ .bizName(() -> String.format("channel_%s", TenantContextHolder.getTenantId()))
+ .step(properties.getStep())
+ .retryTimes(properties.getDb().getRetryTimes())
+ .tableName(properties.getDb().getTableName())
+ .build();
}
}