初始化
21
easyflow-starter/easyflow-starter-admin/pom.xml
Normal file
@@ -0,0 +1,21 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project xmlns="http://maven.apache.org/POM/4.0.0"
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
<parent>
|
||||
<groupId>tech.easyflow</groupId>
|
||||
<artifactId>easyflow-starter</artifactId>
|
||||
<version>${revision}</version>
|
||||
</parent>
|
||||
|
||||
<artifactId>easyflow-starter-admin</artifactId>
|
||||
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<groupId>tech.easyflow</groupId>
|
||||
<artifactId>easyflow-api-admin</artifactId>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
|
||||
</project>
|
||||
93
easyflow-starter/easyflow-starter-all/pom.xml
Normal file
@@ -0,0 +1,93 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
<parent>
|
||||
<groupId>tech.easyflow</groupId>
|
||||
<artifactId>easyflow-starter</artifactId>
|
||||
<version>${revision}</version>
|
||||
</parent>
|
||||
|
||||
|
||||
<name>easyflow-starter</name>
|
||||
<artifactId>easyflow-starter-all</artifactId>
|
||||
<packaging>jar</packaging>
|
||||
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<groupId>tech.easyflow</groupId>
|
||||
<artifactId>easyflow-api-admin</artifactId>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>tech.easyflow</groupId>
|
||||
<artifactId>easyflow-api-usercenter</artifactId>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>tech.easyflow</groupId>
|
||||
<artifactId>easyflow-api-public</artifactId>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>tech.easyflow</groupId>
|
||||
<artifactId>easyflow-module-job</artifactId>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>tech.easyflow</groupId>
|
||||
<artifactId>easyflow-module-ai</artifactId>
|
||||
<exclusions>
|
||||
<exclusion>
|
||||
<artifactId>slf4j-simple</artifactId>
|
||||
<groupId>org.slf4j</groupId>
|
||||
</exclusion>
|
||||
<exclusion>
|
||||
<artifactId>log4j-slf4j-impl</artifactId>
|
||||
<groupId>org.apache.logging.log4j</groupId>
|
||||
</exclusion>
|
||||
<exclusion>
|
||||
<artifactId>slf4j-reload4j</artifactId>
|
||||
<groupId>org.slf4j</groupId>
|
||||
</exclusion>
|
||||
</exclusions>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>tech.easyflow</groupId>
|
||||
<artifactId>easyflow-module-auth</artifactId>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>tech.easyflow</groupId>
|
||||
<artifactId>easyflow-module-autoconfig</artifactId>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.zaxxer</groupId>
|
||||
<artifactId>HikariCP</artifactId>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.mysql</groupId>
|
||||
<artifactId>mysql-connector-j</artifactId>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.yaml</groupId>
|
||||
<artifactId>snakeyaml</artifactId>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
|
||||
<build>
|
||||
<plugins>
|
||||
<plugin>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-maven-plugin</artifactId>
|
||||
<version>${spring-boot.version}</version>
|
||||
<configuration>
|
||||
<fork>true</fork>
|
||||
</configuration>
|
||||
<executions>
|
||||
<execution>
|
||||
<goals>
|
||||
<goal>repackage</goal>
|
||||
</goals>
|
||||
</execution>
|
||||
</executions>
|
||||
</plugin>
|
||||
</plugins>
|
||||
</build>
|
||||
|
||||
</project>
|
||||
@@ -0,0 +1,15 @@
|
||||
package tech.easyflow.starter;
|
||||
|
||||
import org.dromara.x.file.storage.spring.EnableFileStorage;
|
||||
import tech.easyflow.common.spring.BaseApp;
|
||||
import org.springframework.boot.autoconfigure.SpringBootApplication;
|
||||
|
||||
@SpringBootApplication
|
||||
@EnableFileStorage
|
||||
public class MainApplication extends BaseApp {
|
||||
|
||||
public static void main(String[] args) {
|
||||
run(MainApplication.class, args);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,26 @@
|
||||
package tech.easyflow.starter;
|
||||
|
||||
import com.mybatisflex.core.FlexGlobalConfig;
|
||||
import com.mybatisflex.core.audit.AuditManager;
|
||||
import com.mybatisflex.core.audit.ConsoleMessageCollector;
|
||||
import com.mybatisflex.core.audit.MessageCollector;
|
||||
import com.mybatisflex.spring.boot.MyBatisFlexCustomizer;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
|
||||
@Configuration
|
||||
public class MybatisConfig implements MyBatisFlexCustomizer {
|
||||
|
||||
|
||||
@Override
|
||||
public void customize(FlexGlobalConfig flexGlobalConfig) {
|
||||
//开启审计功能
|
||||
AuditManager.setAuditEnable(true);
|
||||
|
||||
//取消控制台的 Banner 打印
|
||||
flexGlobalConfig.setPrintBanner(false);
|
||||
|
||||
//设置 SQL 审计收集器
|
||||
MessageCollector collector = new ConsoleMessageCollector();
|
||||
AuditManager.setMessageCollector(collector);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,8 @@
|
||||
spring:
|
||||
config:
|
||||
activate:
|
||||
on-profile: prod
|
||||
datasource:
|
||||
url: jdbc:mysql://127.0.0.1:3306/easyflow?useInformationSchema=true&characterEncoding=utf-8
|
||||
username: easyflow
|
||||
password: 123456
|
||||
@@ -0,0 +1,146 @@
|
||||
server:
|
||||
port: 8111
|
||||
address: 0.0.0.0
|
||||
shutdown: graceful
|
||||
# 启用HTTP响应压缩
|
||||
compression:
|
||||
enabled: true
|
||||
servlet:
|
||||
encoding:
|
||||
enabled: true
|
||||
charset: UTF-8 # 必须设置 UTF-8,避免 WebFlux 流式返回(AI 场景)会乱码问题
|
||||
force: true
|
||||
spring:
|
||||
profiles:
|
||||
active: dev
|
||||
datasource:
|
||||
# !!! 注意:useInformationSchema=true 是必须的,用于支持 MyBatis-Flex 正确读取表注释。
|
||||
url: jdbc:mysql://127.0.0.1:23306/easyflow?useInformationSchema=true&characterEncoding=utf-8
|
||||
username: root
|
||||
password: root
|
||||
servlet:
|
||||
multipart:
|
||||
max-file-size: 100MB
|
||||
max-request-size: 100MB
|
||||
web:
|
||||
resources:
|
||||
# 示例:windows【file: C:\easyflow\attachment】 linux【file: /www/easyflow/attachment】
|
||||
static-locations: file:/Users/slience/postgraduate/easyflow/attachment
|
||||
mvc:
|
||||
pathmatch:
|
||||
matching-strategy: ant_path_matcher
|
||||
# 静态资源路径,用于访问本地文件
|
||||
# !!! 注意,这里要和下面的 easyflow.storage.local.prefix 后面的路径 /attachment 保持一致!
|
||||
static-path-pattern: /attachment/**
|
||||
# quartz 相关配置
|
||||
quartz:
|
||||
startup-delay: 1
|
||||
job-store-type: jdbc
|
||||
jdbc:
|
||||
platform: mysql
|
||||
initialize-schema: never
|
||||
properties:
|
||||
org:
|
||||
quartz:
|
||||
jobStore:
|
||||
misfireThreshold: 1000
|
||||
# 如果数据库大小写敏感,可将ddl里的相关表名改为大写
|
||||
tablePrefix: TB_QRTZ_
|
||||
threadPool:
|
||||
threadCount: 20
|
||||
threadPriority: 5
|
||||
threads:
|
||||
virtual:
|
||||
enabled: true
|
||||
easyflow:
|
||||
# 语音播放、识别服务(阿里云)
|
||||
audio:
|
||||
type: aliAudioService
|
||||
ali:
|
||||
access-key-id: xxx
|
||||
access-key-secret: xxx
|
||||
app-key: xxx
|
||||
voice: siyue
|
||||
login:
|
||||
# 放行接口路径
|
||||
excludes: /api/v1/auth/**, /static/**, /userCenter/auth/**, /userCenter/public/**
|
||||
storage:
|
||||
type: local # xFileStorage / local
|
||||
# 本地文件存储配置
|
||||
local:
|
||||
# 示例:windows【C:\easyflow\attachment】 linux【/www/easyflow/attachment】
|
||||
root: /Users/slience/postgraduate/easyflow/attachment
|
||||
# 后端接口地址,用于拼接完整 url
|
||||
prefix: http://localhost:8080/attachment
|
||||
# xFileStorage存储文件配置
|
||||
dromara:
|
||||
x-file-storage: #文件存储配置
|
||||
default-platform: aliyun-oss-1 #默认使用的存储平台
|
||||
aliyun-oss:
|
||||
- platform: aliyun-oss-1 # 存储平台标识
|
||||
enable-storage: true # 启用存储
|
||||
access-key: yourAccessKeyId
|
||||
secret-key: yourAccessKeySecret
|
||||
end-point: yourEndpoint # 示例:https://oss-cn-beijing.aliyuncs.com
|
||||
bucket-name: yourBucketName
|
||||
domain: yourDomain # 访问域名,注意“/”结尾,例如:https://bucketname.oss-cn-shanghai.aliyuncs.com/
|
||||
base-path: attachment # 基础路径
|
||||
# 自定义节点相关配置
|
||||
node:
|
||||
# 文件内容提取节点,默认使用简单文档读取器,可自行实现 ReadDocService
|
||||
reader: 'defaultReader'
|
||||
# gitee 文档读取的实现,需要配置gitee的appKey
|
||||
gitee:
|
||||
appKey: 'xxx'
|
||||
# 搜索引擎节点 - 目前只支持博查搜索
|
||||
bochaai:
|
||||
apiKey: 'xxx'
|
||||
jetcache:
|
||||
# 缓存类型,可选值:local/remote/both CacheConfig 类初始化
|
||||
cacheType: local
|
||||
statIntervalMinutes: 15
|
||||
areaInCacheName: false
|
||||
local:
|
||||
default:
|
||||
type: linkedhashmap
|
||||
keyConvertor: fastjson
|
||||
remote:
|
||||
default:
|
||||
type: redis
|
||||
keyConvertor: fastjson2
|
||||
broadcastChannel: projectA
|
||||
valueEncoder: java
|
||||
valueDecoder: java
|
||||
poolConfig:
|
||||
minIdle: 5
|
||||
maxIdle: 20
|
||||
maxTotal: 50
|
||||
host: 127.0.0.1
|
||||
port: 6379
|
||||
password: pwd
|
||||
database: 0
|
||||
# 多路召回搜索引擎配置
|
||||
rag:
|
||||
searcher:
|
||||
# 搜索方式 默认lucene
|
||||
lucene:
|
||||
indexDirPath: ./luceneKnowledge
|
||||
elastic:
|
||||
host: https://127.0.0.1:9200
|
||||
userName: elastic
|
||||
password: elastic
|
||||
indexName: easyflow
|
||||
logging:
|
||||
file:
|
||||
path: .logs/
|
||||
name: easyflow.log
|
||||
level:
|
||||
root: info
|
||||
tech.easyflow.ai: debug
|
||||
# 行为验证码配置
|
||||
captcha:
|
||||
# 初始化默认资源
|
||||
init-default-resource: true
|
||||
# 开启二次验证
|
||||
secondary:
|
||||
enabled: true
|
||||
|
After Width: | Height: | Size: 18 KiB |
|
After Width: | Height: | Size: 9.1 KiB |
|
After Width: | Height: | Size: 22 KiB |
|
After Width: | Height: | Size: 22 KiB |
|
After Width: | Height: | Size: 11 KiB |
|
After Width: | Height: | Size: 17 KiB |
|
After Width: | Height: | Size: 17 KiB |
|
After Width: | Height: | Size: 9.8 KiB |
|
After Width: | Height: | Size: 10 KiB |
|
After Width: | Height: | Size: 8.0 KiB |
@@ -0,0 +1,51 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<configuration>
|
||||
<property name="LOG_HOME" value=".logs"/>
|
||||
<include resource="org/springframework/boot/logging/logback/defaults.xml"/>
|
||||
<include resource="org/springframework/boot/logging/logback/console-appender.xml"/>
|
||||
<!-- 彩色日志 -->
|
||||
<!-- 彩色日志依赖的渲染类 -->
|
||||
<conversionRule conversionWord="clr" class="org.springframework.boot.logging.logback.ColorConverter"/>
|
||||
<conversionRule conversionWord="wex"
|
||||
class="org.springframework.boot.logging.logback.WhitespaceThrowableProxyConverter"/>
|
||||
<conversionRule conversionWord="wEx"
|
||||
class="org.springframework.boot.logging.logback.ExtendedWhitespaceThrowableProxyConverter"/>
|
||||
<!-- 彩色日志格式 -->
|
||||
<property name="CONSOLE_LOG_PATTERN"
|
||||
value="${CONSOLE_LOG_PATTERN:-%clr(%d{yyyy-MM-dd HH:mm:ss.SSS}){faint} %clr(${LOG_LEVEL_PATTERN:-%5p}) %clr(${PID:- }){magenta} %clr(---){faint} %clr([%15.15t]){faint} %clr(%-40.40logger{39}){cyan} %clr(:){faint} %m%n${LOG_EXCEPTION_CONVERSION_WORD:-%wEx}}"/>
|
||||
|
||||
<!--输出到控制台-->
|
||||
<appender name="CONSOLE" class="ch.qos.logback.core.ConsoleAppender">
|
||||
<!--此日志appender是为开发使用,只配置最底级别,控制台输出的日志级别是大于或等于此级别的日志信息-->
|
||||
<!--<filter class="ch.qos.logback.classic.filter.ThresholdFilter">-->
|
||||
<!--<level>info</level>-->
|
||||
<!--</filter>-->
|
||||
<encoder>
|
||||
<Pattern>${CONSOLE_LOG_PATTERN}</Pattern>
|
||||
<!-- 设置字符集 -->
|
||||
<charset>UTF-8</charset>
|
||||
</encoder>
|
||||
</appender>
|
||||
|
||||
<!-- 日志文件 -->
|
||||
<appender name="LOGFILE" class="ch.qos.logback.core.rolling.RollingFileAppender">
|
||||
<file>${LOG_PATH}/${LOG_FILE}</file>
|
||||
<rollingPolicy class="ch.qos.logback.core.rolling.SizeAndTimeBasedRollingPolicy">
|
||||
<fileNamePattern>${LOG_PATH}/%d{yyyy-MM-dd}/${LOG_FILE}-%i</fileNamePattern>
|
||||
<maxFileSize>50MB</maxFileSize>
|
||||
<maxHistory>30</maxHistory>
|
||||
</rollingPolicy>
|
||||
<encoder class="ch.qos.logback.classic.encoder.PatternLayoutEncoder">
|
||||
<pattern>%d{MM-dd HH:mm:ss.SSS} |-%-5level %logger{36}:%L - %m%n</pattern>
|
||||
</encoder>
|
||||
</appender>
|
||||
|
||||
<root level="DEBUG">
|
||||
<appender-ref ref="CONSOLE" />
|
||||
<appender-ref ref="LOGFILE" />
|
||||
</root>
|
||||
<root level="INFO">
|
||||
<appender-ref ref="CONSOLE" />
|
||||
<appender-ref ref="LOGFILE" />
|
||||
</root>
|
||||
</configuration>
|
||||
38
easyflow-starter/easyflow-starter-codegen/pom.xml
Normal file
@@ -0,0 +1,38 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project xmlns="http://maven.apache.org/POM/4.0.0"
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
<parent>
|
||||
<groupId>tech.easyflow</groupId>
|
||||
<artifactId>easyflow-starter</artifactId>
|
||||
<version>${revision}</version>
|
||||
</parent>
|
||||
|
||||
<artifactId>easyflow-starter-codegen</artifactId>
|
||||
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<groupId>com.mybatis-flex</groupId>
|
||||
<artifactId>mybatis-flex-spring-boot3-starter</artifactId>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.mybatis-flex</groupId>
|
||||
<artifactId>mybatis-flex-codegen</artifactId>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>tech.easyflow</groupId>
|
||||
<artifactId>easyflow-common-base</artifactId>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.mysql</groupId>
|
||||
<artifactId>mysql-connector-j</artifactId>
|
||||
<scope>runtime</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.zaxxer</groupId>
|
||||
<artifactId>HikariCP</artifactId>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
|
||||
</project>
|
||||
@@ -0,0 +1,69 @@
|
||||
package tech.easyflow.codegen;
|
||||
|
||||
import com.mybatisflex.codegen.Generator;
|
||||
import com.mybatisflex.codegen.config.ColumnConfig;
|
||||
import com.mybatisflex.codegen.config.GlobalConfig;
|
||||
import com.mybatisflex.codegen.dialect.JdbcTypeMapping;
|
||||
import com.mybatisflex.core.handler.CommaSplitTypeHandler;
|
||||
import com.zaxxer.hikari.HikariDataSource;
|
||||
|
||||
public class AIModuleGen {
|
||||
public static void main(String[] args) {
|
||||
//配置数据源
|
||||
HikariDataSource dataSource = new HikariDataSource();
|
||||
|
||||
//注意:url 需添加上 useInformationSchema=true 才能正常获取表的注释
|
||||
dataSource.setJdbcUrl("jdbc:mysql://192.168.2.10:3306/easyflow-v2?useInformationSchema=true&characterEncoding=utf-8");
|
||||
dataSource.setUsername("root");
|
||||
dataSource.setPassword("123456");
|
||||
|
||||
// 设置时间类型为 Date
|
||||
JdbcTypeMapping.registerDateTypes();
|
||||
|
||||
|
||||
//生成 framework-modules/easyflow-module-ai 下的代码
|
||||
GlobalConfig globalConfig = createGlobalConfig();
|
||||
Generator moduleGenerator = new Generator(dataSource, globalConfig);
|
||||
moduleGenerator.generate();
|
||||
}
|
||||
|
||||
|
||||
public static GlobalConfig createGlobalConfig() {
|
||||
|
||||
String optionsColumns = "options,vector_store_options,model_options";
|
||||
|
||||
//创建配置内容
|
||||
GlobalConfig globalConfig = Util.createBaseConfig(optionsColumns);
|
||||
globalConfig.setBasePackage("tech.easyflow.ai");
|
||||
|
||||
globalConfig.setGenerateTable("tb_bot"
|
||||
, "tb_bot_api_key", "tb_bot_category"
|
||||
, "tb_bot_conversation", "tb_bot_document_collection", "tb_bot_message"
|
||||
, "tb_bot_model", "tb_bot_plugin", "tb_bot_recently_used", "tb_bot_workflow"
|
||||
, "tb_document", "tb_document_chunk", "tb_document_collection", "tb_document_collection_category", "tb_document_history"
|
||||
, "tb_model", "tb_model_provider"
|
||||
, "tb_plugin", "tb_plugin_category", "tb_plugin_category_mapping", "tb_plugin_item"
|
||||
, "tb_resource", "tb_resource_category"
|
||||
, "tb_workflow", "tb_workflow_category", "tb_workflow_exec_result", "tb_workflow_exec_step", "tb_mcp", "tb_bot_mcp"
|
||||
);
|
||||
|
||||
String sourceDir = System.getProperty("user.dir") + "/easyflow-modules/easyflow-module-ai/src/main/java";
|
||||
globalConfig.setSourceDir(sourceDir);
|
||||
|
||||
|
||||
ColumnConfig tablesColumnConfig = new ColumnConfig();
|
||||
tablesColumnConfig.setPropertyType("java.util.List<String>");
|
||||
tablesColumnConfig.setTypeHandler(CommaSplitTypeHandler.class);
|
||||
tablesColumnConfig.setColumnName("tables");
|
||||
globalConfig.setColumnConfig("tb_dev_module", tablesColumnConfig);
|
||||
|
||||
ColumnConfig validRolesColumnConfig = new ColumnConfig();
|
||||
validRolesColumnConfig.setPropertyType("java.util.List<String>");
|
||||
validRolesColumnConfig.setTypeHandler(CommaSplitTypeHandler.class);
|
||||
validRolesColumnConfig.setColumnName("valid_roles");
|
||||
globalConfig.setColumnConfig("tb_dev_table_field", validRolesColumnConfig);
|
||||
|
||||
return globalConfig;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
package tech.easyflow.codegen;
|
||||
|
||||
public class AllModuleGen {
|
||||
public static void main(String[] args) {
|
||||
AIModuleGen.main(args);
|
||||
DatacenterModuleGen.main(args);
|
||||
JobModuleGen.main(args);
|
||||
SystemModuleGen.main(args);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,50 @@
|
||||
package tech.easyflow.codegen;
|
||||
|
||||
import com.mybatisflex.codegen.Generator;
|
||||
import com.mybatisflex.codegen.config.GlobalConfig;
|
||||
import com.mybatisflex.codegen.dialect.JdbcTypeMapping;
|
||||
import com.zaxxer.hikari.HikariDataSource;
|
||||
|
||||
public class DatacenterModuleGen {
|
||||
public static void main(String[] args) {
|
||||
//配置数据源
|
||||
HikariDataSource dataSource = new HikariDataSource();
|
||||
|
||||
//注意:url 需添加上 useInformationSchema=true 才能正常获取表的注释
|
||||
dataSource.setJdbcUrl("jdbc:mysql://192.168.2.10:3306/easyflow-v2?useInformationSchema=true&characterEncoding=utf-8");
|
||||
dataSource.setUsername("root");
|
||||
dataSource.setPassword("123456");
|
||||
|
||||
// 设置时间类型为 Date
|
||||
JdbcTypeMapping.registerDateTypes();
|
||||
|
||||
|
||||
//生成 framework-modules/easyflow-module-datacenter 下的代码
|
||||
GlobalConfig globalConfig = createGlobalConfig();
|
||||
Generator moduleGenerator = new Generator(dataSource, globalConfig);
|
||||
moduleGenerator.generate();
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
public static GlobalConfig createGlobalConfig() {
|
||||
|
||||
String optionsColumns = "options,vector_store_options,llm_options";
|
||||
|
||||
//创建配置内容
|
||||
GlobalConfig globalConfig = Util.createBaseConfig(optionsColumns);
|
||||
globalConfig.setBasePackage("tech.easyflow.datacenter");
|
||||
|
||||
|
||||
globalConfig.setGenerateTable("tb_datacenter_table", "tb_datacenter_table_field");
|
||||
String sourceDir = System.getProperty("user.dir") + "/easyflow-modules/easyflow-module-datacenter/src/main/java";
|
||||
globalConfig.setSourceDir(sourceDir);
|
||||
|
||||
return globalConfig;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
@@ -0,0 +1,50 @@
|
||||
package tech.easyflow.codegen;
|
||||
|
||||
import com.mybatisflex.codegen.Generator;
|
||||
import com.mybatisflex.codegen.config.GlobalConfig;
|
||||
import com.mybatisflex.codegen.dialect.JdbcTypeMapping;
|
||||
import com.zaxxer.hikari.HikariDataSource;
|
||||
|
||||
public class JobModuleGen {
|
||||
public static void main(String[] args) {
|
||||
//配置数据源
|
||||
HikariDataSource dataSource = new HikariDataSource();
|
||||
|
||||
//注意:url 需添加上 useInformationSchema=true 才能正常获取表的注释
|
||||
dataSource.setJdbcUrl("jdbc:mysql://192.168.2.10:3306/easyflow-v2?useInformationSchema=true&characterEncoding=utf-8");
|
||||
dataSource.setUsername("root");
|
||||
dataSource.setPassword("123456");
|
||||
|
||||
// 设置时间类型为 Date
|
||||
JdbcTypeMapping.registerDateTypes();
|
||||
|
||||
|
||||
//生成 framework-modules/easyflow-module-job 下的代码
|
||||
GlobalConfig globalConfig = createGlobalConfig();
|
||||
Generator moduleGenerator = new Generator(dataSource, globalConfig);
|
||||
moduleGenerator.generate();
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
public static GlobalConfig createGlobalConfig() {
|
||||
|
||||
String optionsColumns = "options,job_params";
|
||||
|
||||
//创建配置内容
|
||||
GlobalConfig globalConfig = Util.createBaseConfig(optionsColumns);
|
||||
globalConfig.setBasePackage("tech.easyflow.job");
|
||||
|
||||
|
||||
|
||||
globalConfig.setGenerateTable("tb_sys_job", "tb_sys_job_log");
|
||||
String sourceDir = System.getProperty("user.dir") + "/easyflow-modules/easyflow-module-job/src/main/java";
|
||||
globalConfig.setSourceDir(sourceDir);
|
||||
|
||||
return globalConfig;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
@@ -0,0 +1,17 @@
|
||||
package tech.easyflow.codegen;
|
||||
|
||||
import tech.easyflow.common.util.HashUtil;
|
||||
|
||||
public class PasswordGen {
|
||||
|
||||
public static void main(String[] args) {
|
||||
String password = "123456";
|
||||
String salt = HashUtil.generateSalt(24);
|
||||
String hashPassword = HashUtil.sha256(salt + password);
|
||||
System.out.println("salt: " + salt);
|
||||
System.out.println("password: " + password);
|
||||
System.out.println("hashPassword: " + hashPassword);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
@@ -0,0 +1,53 @@
|
||||
package tech.easyflow.codegen;
|
||||
|
||||
import com.mybatisflex.codegen.Generator;
|
||||
import com.mybatisflex.codegen.config.GlobalConfig;
|
||||
import com.mybatisflex.codegen.dialect.JdbcTypeMapping;
|
||||
import com.zaxxer.hikari.HikariDataSource;
|
||||
|
||||
public class SystemModuleGen {
|
||||
public static void main(String[] args) {
|
||||
//配置数据源
|
||||
HikariDataSource dataSource = new HikariDataSource();
|
||||
|
||||
//注意:url 需添加上 useInformationSchema=true 才能正常获取表的注释
|
||||
dataSource.setJdbcUrl("jdbc:mysql://192.168.2.10:3306/easyflow-v2?useInformationSchema=true&characterEncoding=utf-8");
|
||||
dataSource.setUsername("root");
|
||||
dataSource.setPassword("123456");
|
||||
|
||||
// 设置时间类型为 Date
|
||||
JdbcTypeMapping.registerDateTypes();
|
||||
|
||||
|
||||
//生成 framework-modules/easyflow-module-system 下的代码
|
||||
GlobalConfig globalConfig = createGlobalConfig();
|
||||
Generator moduleGenerator = new Generator(dataSource, globalConfig);
|
||||
moduleGenerator.generate();
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
public static GlobalConfig createGlobalConfig() {
|
||||
|
||||
String optionsColumns = "options,vector_store_options,llm_options";
|
||||
|
||||
//创建配置内容
|
||||
GlobalConfig globalConfig = Util.createBaseConfig(optionsColumns);
|
||||
globalConfig.setBasePackage("tech.easyflow.system");
|
||||
|
||||
|
||||
globalConfig.setGenerateTable("tb_sys_account", "tb_sys_account_position", "tb_sys_account_role"
|
||||
, "tb_sys_api_key", "tb_sys_api_key_resource", "tb_sys_api_key_resource_mapping"
|
||||
, "tb_sys_dept", "tb_sys_dict", "tb_sys_dict_item", "tb_sys_log", "tb_sys_menu", "tb_sys_option"
|
||||
, "tb_sys_position", "tb_sys_role", "tb_sys_role_menu", "tb_sys_user_feedback"
|
||||
);
|
||||
String sourceDir = System.getProperty("user.dir") + "/easyflow-modules/easyflow-module-system/src/main/java";
|
||||
globalConfig.setSourceDir(sourceDir);
|
||||
|
||||
return globalConfig;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,102 @@
|
||||
package tech.easyflow.codegen;
|
||||
|
||||
import com.mybatisflex.annotation.KeyType;
|
||||
import com.mybatisflex.codegen.config.ColumnConfig;
|
||||
import com.mybatisflex.codegen.config.GlobalConfig;
|
||||
import com.mybatisflex.core.handler.FastjsonTypeHandler;
|
||||
import com.mybatisflex.core.keygen.KeyGenerators;
|
||||
import tech.easyflow.common.entity.DateEntity;
|
||||
import tech.easyflow.common.entity.DateTreeEntity;
|
||||
import tech.easyflow.common.entity.TreeEntity;
|
||||
import tech.easyflow.common.util.StringUtil;
|
||||
|
||||
public class Util {
|
||||
|
||||
|
||||
public static GlobalConfig createBaseConfig() {
|
||||
return createBaseConfig("options");
|
||||
}
|
||||
|
||||
|
||||
public static GlobalConfig createBaseConfig(String optionsColumns) {
|
||||
|
||||
//创建配置内容
|
||||
GlobalConfig globalConfig = new GlobalConfig();
|
||||
|
||||
//设置表前缀和只生成哪些表
|
||||
globalConfig.setTablePrefix("tb_");
|
||||
|
||||
//设置生成 entity
|
||||
globalConfig.setEntityGenerateEnable(true);
|
||||
|
||||
globalConfig.getEntityConfig().setWithBaseClassEnable(true);
|
||||
globalConfig.getEntityConfig().setBaseOverwriteEnable(true);
|
||||
globalConfig.getEntityConfig().setColumnCommentEnable(true);
|
||||
|
||||
|
||||
globalConfig.setMapperGenerateEnable(true);
|
||||
globalConfig.setServiceGenerateEnable(true);
|
||||
globalConfig.setServiceImplGenerateEnable(true);
|
||||
|
||||
|
||||
// 设置 entity 父类
|
||||
globalConfig.setEntitySuperClassFactory(table -> {
|
||||
if (table.containsColumn("id", "pid") || table.containsColumn("id","parent_id")) {
|
||||
if (table.containsColumn("created", "modified")) {
|
||||
return DateTreeEntity.class;
|
||||
} else {
|
||||
return TreeEntity.class;
|
||||
}
|
||||
} else if (table.containsColumn("created", "modified")) {
|
||||
return DateEntity.class;
|
||||
}
|
||||
return null;
|
||||
});
|
||||
|
||||
// 不生成 Controller
|
||||
globalConfig.setControllerGenerateEnable(false);
|
||||
// globalConfig.setControllerOverwriteEnable(false);
|
||||
// try {
|
||||
// ClassPathResource cpr = new ClassPathResource("templates/controller.tpl");
|
||||
// globalConfig.setControllerTemplatePath(cpr.getFile().getAbsolutePath());
|
||||
// } catch (IOException e) {
|
||||
// throw new RuntimeException(e);
|
||||
// }
|
||||
|
||||
ColumnConfig pkColumnConfig = new ColumnConfig();
|
||||
pkColumnConfig.setPrimaryKey(true);
|
||||
pkColumnConfig.setKeyType(KeyType.Generator);
|
||||
pkColumnConfig.setKeyValue(KeyGenerators.snowFlakeId);
|
||||
pkColumnConfig.setColumnName("id");
|
||||
|
||||
|
||||
ColumnConfig tenantColumnConfig = new ColumnConfig();
|
||||
tenantColumnConfig.setTenantId(true);
|
||||
tenantColumnConfig.setColumnName("tenant_id");
|
||||
|
||||
ColumnConfig logicDeleteColumnConfig = new ColumnConfig();
|
||||
logicDeleteColumnConfig.setLogicDelete(true);
|
||||
logicDeleteColumnConfig.setColumnName("is_deleted");
|
||||
|
||||
globalConfig.setColumnConfig(pkColumnConfig);
|
||||
globalConfig.setColumnConfig(tenantColumnConfig);
|
||||
globalConfig.setColumnConfig(logicDeleteColumnConfig);
|
||||
|
||||
|
||||
String[] optionsColumnArray = optionsColumns.split(",");
|
||||
for (String optionsColumn : optionsColumnArray) {
|
||||
if (StringUtil.hasText(optionsColumn)) {
|
||||
ColumnConfig optionsColumnConfig = new ColumnConfig();
|
||||
optionsColumnConfig.setPropertyType("java.util.Map<String, Object>");
|
||||
optionsColumnConfig.setTypeHandler(FastjsonTypeHandler.class);
|
||||
optionsColumnConfig.setColumnName(optionsColumn.trim());
|
||||
globalConfig.setColumnConfig(optionsColumnConfig);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
return globalConfig;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
14
easyflow-starter/easyflow-starter-public/pom.xml
Normal file
@@ -0,0 +1,14 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project xmlns="http://maven.apache.org/POM/4.0.0"
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
<parent>
|
||||
<groupId>tech.easyflow</groupId>
|
||||
<artifactId>easyflow-starter</artifactId>
|
||||
<version>${revision}</version>
|
||||
</parent>
|
||||
|
||||
<artifactId>easyflow-starter-public</artifactId>
|
||||
|
||||
</project>
|
||||
14
easyflow-starter/easyflow-starter-usercenter/pom.xml
Normal file
@@ -0,0 +1,14 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project xmlns="http://maven.apache.org/POM/4.0.0"
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
<parent>
|
||||
<groupId>tech.easyflow</groupId>
|
||||
<artifactId>easyflow-starter</artifactId>
|
||||
<version>${revision}</version>
|
||||
</parent>
|
||||
|
||||
<artifactId>easyflow-starter-usercenter</artifactId>
|
||||
|
||||
</project>
|
||||
23
easyflow-starter/pom.xml
Normal file
@@ -0,0 +1,23 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project xmlns="http://maven.apache.org/POM/4.0.0"
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
<parent>
|
||||
<groupId>tech.easyflow</groupId>
|
||||
<artifactId>easyflow</artifactId>
|
||||
<version>${revision}</version>
|
||||
</parent>
|
||||
|
||||
<artifactId>easyflow-starter</artifactId>
|
||||
<packaging>pom</packaging>
|
||||
|
||||
<modules>
|
||||
<module>easyflow-starter-admin</module>
|
||||
<module>easyflow-starter-all</module>
|
||||
<module>easyflow-starter-public</module>
|
||||
<module>easyflow-starter-usercenter</module>
|
||||
<module>easyflow-starter-codegen</module>
|
||||
</modules>
|
||||
|
||||
</project>
|
||||