40 Commits

Author SHA1 Message Date
cuijiawang
18bb9f9c95 fix 2025-10-23 10:54:36 +08:00
cuijiawang
979f2aa5f0 fix 2025-10-23 10:47:44 +08:00
cuijiawang
189930f0ab fix 2025-10-23 10:03:34 +08:00
cuijiawang
3c78e2bb53 fix 2025-10-23 09:51:56 +08:00
cuijiawang
63dc394c54 feat(gateway): 添加开发环境网关路由配置
- 配置了服务发现定位器启用- 添加了指向wol-auth服务的路由
- 设置了路径匹配规则为/auth/**
2025-10-23 09:44:04 +08:00
cuijiawang
f24137eb8f fix 2025-10-22 16:49:46 +08:00
cuijiawang
504fc94b8c fix 2025-10-22 12:08:53 +08:00
cuijiawang
6ef6a344c6 fix 2025-10-22 11:31:00 +08:00
cuijiawang
5e3e0890f3 fix 2025-10-21 18:01:02 +08:00
cuijiawang
b7a7fca5f3 fix 2025-10-21 17:54:02 +08:00
cuijiawang
6adfe238be fix 2025-10-21 17:51:37 +08:00
cuijiawang
c1eac2a224 fix 2025-10-14 17:28:29 +08:00
cuijiawang
c5b01251d8 fix 2025-10-13 17:06:23 +08:00
cuijiawang
d40232d335 fix 2025-10-13 17:02:08 +08:00
cuijiawang
f37ea57bce fix 2025-10-13 17:01:12 +08:00
cuijiawang
b366869a00 gateway 2025-10-13 16:32:54 +08:00
cuijiawang
a8e2887bbf fix 2025-10-11 09:55:31 +08:00
cuijiawang
92b772373b fix: port 2025-09-30 14:54:05 +08:00
cuijiawang
8f433a2594 fix: 启动类 2025-09-30 14:48:56 +08:00
cuijiawang
e0db7a251c Merge branch 'dev-pwd' into dev-codegen 2025-09-30 10:20:40 +08:00
cuijiawang
84bb7410cf fix: 登录校验密码 2025-09-30 10:19:52 +08:00
cuijiawang
2d75478bb7 fix: 代码生成器 系统模板 2025-09-29 16:55:30 +08:00
cuijiawang
5e47425ab5 fix: 代码生成器 未完成的解析器 2025-09-29 14:44:18 +08:00
cuijiawang
a4d6306259 fix: 性能优化 2025-09-28 10:41:05 +08:00
cuijiawang
852eb05cbf fix: 代码生成器 模板内容预览 系统内容 2025-09-28 09:31:09 +08:00
cuijiawang
90f98d66cc feat: 代码生成器 模板内容预览 2025-09-27 19:38:07 +08:00
cuijiawang
bf6e0dd952 feat: 代码生成器 自定义模板 使用次数 2025-09-27 19:01:07 +08:00
cuijiawang
04da9f9c02 feat: 代码生成器 自定义模板 显隐控制 2025-09-27 18:33:33 +08:00
cuijiawang
b4525cd1a6 fix: 代码生成器 自定义模板 逻辑删除问题 2025-09-27 17:50:32 +08:00
cuijiawang
b51f113053 fix: 代码生成器 自定义模板 复制 2025-09-27 17:23:19 +08:00
cuijiawang
685cc3d92c fix: 代码生成器 自定义模板 新增删除 2025-09-27 17:15:32 +08:00
cuijiawang
e512fc29e0 fix: 代码生成器 自定义模板 编辑 2025-09-27 16:38:17 +08:00
cuijiawang
5d19f5589a 代码生成器 模板仓库 模板预览 2025-09-27 16:03:47 +08:00
cuijiawang
d6be017f37 代码生成器 模板仓库 模板描述 2025-09-27 15:22:50 +08:00
cuijiawang
db5bda1bba 代码生成器 模板仓库fix 2025-09-27 14:19:02 +08:00
cuijiawang
c9929c84d2 代码生成器 模板仓库 2025-09-26 17:55:35 +08:00
cuijiawang
f91ecee6cc 代码生成功能 2025-09-25 14:52:14 +08:00
cuijiawang
142c24ca90 ftl 2025-09-25 14:14:03 +08:00
cuijiawang
a59dd25156 Merge branch 'dev' into dev-codegen 2025-09-24 17:26:59 +08:00
cuijiawang
a3ec97fec1 codegen 2025-09-24 16:38:11 +08:00
269 changed files with 7133 additions and 384 deletions

View File

@@ -1,70 +0,0 @@
# 数据源配置
spring:
datasource:
type: com.alibaba.druid.pool.DruidDataSource
driverClassName: com.mysql.cj.jdbc.Driver
druid:
webStatFilter:
enabled: true
statViewServlet:
enabled: true
# 设置白名单,不填则允许所有访问
allow:
url-pattern: /druid/*
# 控制台管理用户名和密码
login-username: agileboot
login-password: 123456
filter:
stat:
enabled: true
# 慢SQL记录
log-slow-sql: true
slow-sql-millis: 1000
merge-sql: true
wall:
config:
multi-statement-allow: true
dynamic:
primary: master
strict: false
druid:
# 初始连接数
initialSize: 5
# 最小连接池数量
minIdle: 10
# 最大连接池数量
maxActive: 20
# 配置获取连接等待超时的时间
maxWait: 60000
# 配置间隔多久才进行一次检测,检测需要关闭的空闲连接,单位是毫秒
timeBetweenEvictionRunsMillis: 60000
# 配置一个连接在池中最小生存的时间,单位是毫秒
minEvictableIdleTimeMillis: 300000
# 配置一个连接在池中最大生存的时间,单位是毫秒
maxEvictableIdleTimeMillis: 900000
# 配置检测连接是否有效
validationQuery: SELECT 1 FROM DUAL
testWhileIdle: true
testOnBorrow: false
testOnReturn: false
datasource:
master:
url: jdbc:mysql://121.41.64.98:3306/agileboot?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=true&serverTimezone=GMT%2B8&sslMode=REQUIRED
username: agileboot
password: 123456
data:
redis:
database: 3
host: 121.41.64.98
port: 6379
password: 'Wyy123123'
sa-token:
# 是否输出操作日志
is-log: true
token-name: Authorization
jasypt:
encryptor:
password: ${JASYPT_ENCRYPTOR_PASSWORD:}

View File

@@ -1,13 +0,0 @@
server:
port: 8088
servlet:
context-path: /api
tomcat:
uri-encoding: UTF-8 # tomcat的URI编码
accept-count: 1000 # 连接数满后的排队数默认为100
threads:
max: 800 # tomcat最大线程数默认为200
min-spare: 100 # Tomcat启动初始化的线程数默认值10
spring:
profiles:
active: dev

View File

@@ -1,8 +0,0 @@
Application Version: ${revision}
Spring Boot Version: ${spring-boot.version}
_ _ _ ____ _
/ \ __ _ (_)| | ___ | __ ) ___ ___ | |_
/ _ \ / _` || || | / _ \| _ \ / _ \ / _ \ | __|
/ ___ \| (_| || || || __/| |_) || (_) || (_) || |_
/_/ \_\\__, ||_||_| \___||____/ \___/ \___/ \__|
|___/

View File

@@ -1,18 +0,0 @@
<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/maven-v4_0_0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>com.agileboot</groupId>
<artifactId>agileboot-cloud</artifactId>
<version>1.0.0</version>
</parent>
<artifactId>agileboot-cloud-start</artifactId>
<dependencies>
<dependency>
<groupId>com.agileboot</groupId>
<artifactId>wol-common-web</artifactId>
<version>${revision}</version>
</dependency>
</dependencies>
</project>

View File

@@ -1,11 +0,0 @@
package com.agileboot;
import org.springframework.boot.autoconfigure.SpringBootApplication;
/**
* @Author cuiJiaWang
* @Create 2025-08-12 17:35
*/
@SpringBootApplication
public class AgilebootCloudApplication {
}

View File

@@ -1,15 +0,0 @@
<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/maven-v4_0_0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>com.agileboot</groupId>
<artifactId>agileboot</artifactId>
<version>1.0.0</version>
</parent>
<artifactId>agileboot-cloud</artifactId>
<packaging>pom</packaging>
<modules>
<module>agileboot-cloud-start</module>
</modules>
</project>

View File

@@ -18,6 +18,7 @@
<module>wol-common-redis</module>
<module>wol-common-json</module>
<module>wol-common-satoken</module>
<module>wol-common-nacos</module>
</modules>
<packaging>pom</packaging>

View File

@@ -52,7 +52,11 @@
<artifactId>wol-common-satoken</artifactId>
<version>${revision}</version>
</dependency>
<dependency>
<groupId>com.agileboot</groupId>
<artifactId>wol-common-nacos</artifactId>
<version>${revision}</version>
</dependency>
</dependencies>
</dependencyManagement>

View File

@@ -0,0 +1,21 @@
wol:
mysql:
maser:
url: ${MYSQL_URL:121.41.64.98:3306}
username: ${MYSQL_USERNAME:agileboot}
password: ${MYSQL_PASSWORD:123456}
redis:
database: ${REDIS_DATABASE:3}
host: ${REDIS_HOST:121.41.64.98}
port: ${REDIS_PORT:6379}
password: ${REDIS_PASSWORD:'Wyy123123'}
nacos:
server:
addr: ${NACOS_ADDR:192.168.110.27:8848}
username: ${NACOS_USERNAME:nacos}
password: ${NACOS_PASSWORD:nacos}
namespace: ${NACOS_NAMESPACE:public}
group: ${NACOS_GROUP:DEFAULT_GROUP}
jasypt:
encryptor:
password: ${JASYPT_ENCRYPTOR_PASSWORD:}

View File

@@ -30,3 +30,58 @@ mybatis-plus:
insertStrategy: NOT_NULL
updateStrategy: NOT_NULL
whereStrategy: NOT_NULL
# 数据源配置
spring:
datasource:
type: com.alibaba.druid.pool.DruidDataSource
driverClassName: com.mysql.cj.jdbc.Driver
druid:
webStatFilter:
enabled: true
statViewServlet:
enabled: true
# 设置白名单,不填则允许所有访问
allow:
url-pattern: /druid/*
# 控制台管理用户名和密码
login-username: agileboot
login-password: 123456
filter:
stat:
enabled: true
# 慢SQL记录
log-slow-sql: true
slow-sql-millis: 1000
merge-sql: true
wall:
config:
multi-statement-allow: true
dynamic:
primary: master
strict: false
druid:
# 初始连接数
initialSize: 5
# 最小连接池数量
minIdle: 10
# 最大连接池数量
maxActive: 20
# 配置获取连接等待超时的时间
maxWait: 60000
# 配置间隔多久才进行一次检测,检测需要关闭的空闲连接,单位是毫秒
timeBetweenEvictionRunsMillis: 60000
# 配置一个连接在池中最小生存的时间,单位是毫秒
minEvictableIdleTimeMillis: 300000
# 配置一个连接在池中最大生存的时间,单位是毫秒
maxEvictableIdleTimeMillis: 900000
# 配置检测连接是否有效
validationQuery: SELECT 1 FROM DUAL
testWhileIdle: true
testOnBorrow: false
testOnReturn: false
datasource:
master:
url: jdbc:mysql://${wol.mysql.maser.url}/agileboot?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=false&serverTimezone=GMT%2B8&allowPublicKeyRetrieval=true
username: ${wol.mysql.maser.username}
password: ${wol.mysql.maser.password}

View File

@@ -0,0 +1,38 @@
<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/maven-v4_0_0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>com.agileboot</groupId>
<artifactId>agileboot-common</artifactId>
<version>1.0.0</version>
</parent>
<artifactId>wol-common-nacos</artifactId>
<dependencies>
<!-- Nacos 服务注册与发现-->
<dependency>
<groupId>com.alibaba.cloud</groupId>
<artifactId>spring-cloud-starter-alibaba-nacos-discovery</artifactId>
<exclusions>
<exclusion>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-starter-netflix-ribbon</artifactId>
</exclusion>
</exclusions>
</dependency>
<!-- 配置中心 -->
<dependency>
<groupId>com.alibaba.cloud</groupId>
<artifactId>spring-cloud-starter-alibaba-nacos-config</artifactId>
</dependency>
<!-- Spring Boot 3 + Spring Cloud 2023 默认不启用 bootstrap -->
<dependency>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-starter-bootstrap</artifactId>
</dependency>
</dependencies>
</project>

View File

@@ -0,0 +1,18 @@
spring:
cloud:
nacos:
discovery:
server-addr: ${wol.nacos.server.addr}
username: ${wol.nacos.server.username}
password: ${wol.nacos.server.password}
group: ${wol.nacos.server.group}
namespace: ${wol.nacos.server.namespace}
config:
server-addr: ${wol.nacos.server.addr}
group: ${wol.nacos.server.group}
namespace: ${wol.nacos.server.namespace}
file-extension: yaml
refresh-enabled: true # 是否开启动态刷新
name: ${spring.application.name}
username: ${wol.nacos.server.username}
password: ${wol.nacos.server.password}

View File

@@ -40,6 +40,19 @@
<groupId>com.fasterxml.jackson.datatype</groupId>
<artifactId>jackson-datatype-jsr310</artifactId>
</dependency>
<!-- JetCache -->
<!-- <dependency>-->
<!-- <groupId>com.alicp.jetcache</groupId>-->
<!-- <artifactId>jetcache-starter-redisson</artifactId>-->
<!-- <version>2.7.5</version>-->
<!-- <exclusions>-->
<!-- <exclusion>-->
<!-- <groupId>org.springframework.boot</groupId>-->
<!-- <artifactId>spring-boot-starter-logging</artifactId>-->
<!-- </exclusion>-->
<!-- </exclusions>-->
<!-- </dependency>-->
</dependencies>
</project>
</project>

View File

@@ -1,5 +1,6 @@
package com.agileboot.common.redis.config;
import com.agileboot.common.core.factory.YmlPropertySourceFactory;
import com.fasterxml.jackson.annotation.JsonAutoDetect;
import com.fasterxml.jackson.annotation.JsonTypeInfo;
import com.fasterxml.jackson.annotation.PropertyAccessor;
@@ -12,6 +13,7 @@ import com.fasterxml.jackson.datatype.jsr310.JavaTimeModule;
import lombok.extern.slf4j.Slf4j;
import org.springframework.boot.autoconfigure.AutoConfiguration;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.PropertySource;
import org.springframework.data.redis.connection.RedisConnectionFactory;
import org.springframework.data.redis.core.RedisTemplate;
import org.springframework.data.redis.serializer.GenericJackson2JsonRedisSerializer;
@@ -19,6 +21,7 @@ import org.springframework.data.redis.serializer.StringRedisSerializer;
@Slf4j
@AutoConfiguration
@PropertySource(value = "classpath:common-cache.yml", factory = YmlPropertySourceFactory.class)
public class RedisConfiguration {
@Bean

View File

@@ -0,0 +1,46 @@
spring:
data:
redis:
database: ${wol.redis.database}
host: ${wol.redis.host}
port: ${wol.redis.port}
password: ${wol.redis.password}
redis:
redisson:
config: |
singleServerConfig:
idleConnectionTimeout: 10000
connectTimeout: 10000
timeout: 3000
retryAttempts: 3
retryInterval: 1500
password: ${wol.redis.password}
subscriptionsPerConnection: 5
clientName: null
address: "redis://${wol.redis.host}:${wol.redis.port}"
subscriptionConnectionMinimumIdleSize: 1
subscriptionConnectionPoolSize: 50
connectionMinimumIdleSize: 24
connectionPoolSize: 64
database: ${wol.redis.database}
dnsMonitoringInterval: 5000
threads: 16
nettyThreads: 32
codec: !<org.redisson.client.codec.StringCodec> {}
transportMode: "NIO"
jetcache:
statIntervalMinutes: 1
areaInCacheName: false
local:
default:
type: caffeine
keyConvertor: fastjson2
remote:
default:
type: redisson
keyConvertor: fastjson2
broadcastChannel: ${spring.application.name}
keyPrefix: ${spring.application.name}
valueEncoder: java
valueDecoder: java
defaultExpireInMillis: 5000

View File

@@ -1,16 +1,13 @@
package com.agileboot.common.satoken.config;
import cn.dev33.satoken.SaManager;
import cn.dev33.satoken.filter.SaServletFilter;
import cn.dev33.satoken.interceptor.SaInterceptor;
import cn.dev33.satoken.router.SaRouter;
import cn.dev33.satoken.same.SaSameUtil;
import cn.dev33.satoken.stp.StpUtil;
import cn.dev33.satoken.util.SaResult;
import com.agileboot.common.core.constant.HttpStatus;
import org.springframework.boot.autoconfigure.AutoConfiguration;
import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean;
import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingClass;
import org.springframework.boot.autoconfigure.condition.ConditionalOnWebApplication;
import org.springframework.context.annotation.Bean;
import org.springframework.web.servlet.config.annotation.InterceptorRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;
@@ -21,6 +18,7 @@ import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;
* @author Lion Li
*/
@AutoConfiguration
@ConditionalOnWebApplication(type = ConditionalOnWebApplication.Type.SERVLET)
public class SaTokenMvcConfiguration implements WebMvcConfigurer {
/**
@@ -36,7 +34,6 @@ public class SaTokenMvcConfiguration implements WebMvcConfigurer {
* 注册 [Sa-Token全局过滤器]
*/
@Bean
@ConditionalOnMissingClass("cn.dev33.satoken.reactor.spring.SaTokenContextRegister")
public SaServletFilter getGlobleSaServletFilter() {
return new SaServletFilter()
.addInclude("/**").addExclude("/favicon.ico")
@@ -47,36 +44,4 @@ public class SaTokenMvcConfiguration implements WebMvcConfigurer {
.setError(e -> SaResult.error("认证失败,无法访问系统资源").setCode(HttpStatus.UNAUTHORIZED));
}
/**
* 校验是否从网关转发
*/
@Bean
@ConditionalOnMissingBean(SaServletFilter.class)
public SaServletFilter getSaServletFilter() {
return new SaServletFilter()
.addInclude("/**")
.addExclude("/actuator", "/actuator/**")
.setAuth(obj -> {
if (SaManager.getConfig().getCheckSameToken()) {
SaSameUtil.checkCurrentRequestToken();
}
})
.setError(e -> SaResult.error("认证失败,无法访问系统资源").setCode(HttpStatus.UNAUTHORIZED));
}
/**
* 对 actuator 健康检查接口 做账号密码鉴权
*/
// @Bean
// public SaServletFilter actuatorFilter() {
// String username = SpringUtil.getProperty("spring.cloud.nacos.discovery.metadata.username");
// String password = SpringUtil.getProperty("spring.cloud.nacos.discovery.metadata.userpassword");
// return new SaServletFilter()
// .addInclude("/actuator", "/actuator/**")
// .setAuth(obj -> {
// SaHttpBasicUtil.check(username + ":" + password);
// })
// .setError(e -> SaResult.error(e.getMessage()).setCode(HttpStatus.UNAUTHORIZED));
// }
}

View File

@@ -10,19 +10,8 @@
<packaging>pom</packaging>
<modules>
<module>wol-auth</module>
<module>agileboot-system-base</module>
<module>wol-gateway</module>
<module>wol-domain</module>
<module>wol-api</module>
</modules>
<dependencyManagement>
<dependencies>
<dependency>
<groupId>com.agileboot</groupId>
<artifactId>agileboot-system-base</artifactId>
<version>1.0.0</version>
</dependency>
</dependencies>
</dependencyManagement>
</project>

View File

@@ -5,7 +5,7 @@
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>com.agileboot</groupId>
<artifactId>agileboot</artifactId>
<artifactId>agileboot-system</artifactId>
<version>1.0.0</version>
</parent>
@@ -19,4 +19,4 @@
</dependency>
</dependencies>
</project>
</project>

View File

@@ -1,135 +0,0 @@
# 数据源配置
spring:
datasource:
type: com.alibaba.druid.pool.DruidDataSource
driverClassName: com.mysql.cj.jdbc.Driver
druid:
webStatFilter:
enabled: true
statViewServlet:
enabled: true
# 设置白名单,不填则允许所有访问
allow:
url-pattern: /druid/*
# 控制台管理用户名和密码
login-username: agileboot
login-password: 123456
filter:
stat:
enabled: true
# 慢SQL记录
log-slow-sql: true
slow-sql-millis: 1000
merge-sql: true
wall:
config:
multi-statement-allow: true
dynamic:
primary: master
strict: false
druid:
# 初始连接数
initialSize: 5
# 最小连接池数量
minIdle: 10
# 最大连接池数量
maxActive: 20
# 配置获取连接等待超时的时间
maxWait: 60000
# 配置间隔多久才进行一次检测,检测需要关闭的空闲连接,单位是毫秒
timeBetweenEvictionRunsMillis: 60000
# 配置一个连接在池中最小生存的时间,单位是毫秒
minEvictableIdleTimeMillis: 300000
# 配置一个连接在池中最大生存的时间,单位是毫秒
maxEvictableIdleTimeMillis: 900000
# 配置检测连接是否有效
validationQuery: SELECT 1 FROM DUAL
testWhileIdle: true
testOnBorrow: false
testOnReturn: false
datasource:
master:
url: jdbc:mysql://121.41.64.98:3306/agileboot?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=true&serverTimezone=GMT%2B8&sslMode=REQUIRED
username: agileboot
password: 123456
data:
redis:
database: 3
host: 121.41.64.98
port: 6379
password: 'Wyy123123'
jasypt:
encryptor:
password: ${JASYPT_ENCRYPTOR_PASSWORD:}
user:
password:
# 密码最大错误次数
maxRetryCount: 5
# 密码锁定时间默认10分钟
lockTime: 10
# 安全配置
security:
clientId: 1
# 验证码
captcha:
# 是否开启验证码
enabled: false
# 验证码类型 math 数组计算 char 字符验证
type: CHAR
# line 线段干扰 circle 圆圈干扰 shear 扭曲干扰
category: CIRCLE
# 数字验证码位数
numberLength: 0
# 字符验证码长度
charLength: 5
# 注册
register:
phoneEnabled: false
# redisson 配置
#redisson:
# # redis key前缀
# keyPrefix:
# # 线程池数量
# threads: 4
# # Netty线程池数量
# nettyThreads: 8
# # 单节点配置
# singleServerConfig:
# # 客户端名称
# clientName: ${spring.application.name}
# # 最小空闲连接数
# connectionMinimumIdleSize: 8
# # 连接池大小
# connectionPoolSize: 32
# # 连接空闲超时,单位:毫秒
# idleConnectionTimeout: 10000
# # 命令等待超时,单位:毫秒
# timeout: 3000
# # 发布和订阅连接池大小
# subscriptionConnectionPoolSize: 50
# 分布式锁 lock4j 全局配置
#lock4j:
# # 获取分布式锁超时时间,默认为 3000 毫秒
# acquire-timeout: 3000
# # 分布式锁的超时时间,默认为 30 秒
# expire: 30000
# Sa-Token配置
sa-token:
# token名称 (同时也是cookie名称)
token-name: Authorization
# 开启内网服务调用鉴权(不允许越过gateway访问内网服务 保障服务安全)
check-same-token: false
# 是否允许同一账号并发登录 (为true时允许一起登录, 为false时新登录挤掉旧登录)
is-concurrent: true
# 在多人登录同一账号时是否共用一个token (为true时所有登录共用一个token, 为false时每次登录新建一个token)
is-share: true
# 是否输出操作日志
is-log: true
# jwt秘钥
jwt-secret-key: abcdefghijklmnopqrstuvwxyz

View File

@@ -1,9 +0,0 @@
server:
port: 9210
servlet:
context-path: /
spring:
application:
name: agileboot-system
profiles:
active: dev

View File

@@ -5,7 +5,7 @@
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>com.agileboot</groupId>
<artifactId>agileboot</artifactId>
<artifactId>agileboot-system</artifactId>
<version>1.0.0</version>
</parent>
@@ -34,4 +34,4 @@
<scope>provided</scope>
</dependency>
</dependencies>
</project>
</project>

View File

@@ -1,9 +0,0 @@
# Tomcat
server:
port: 8080
servlet:
context-path: /
spring:
application:
name: wol-gateway

35
pom.xml
View File

@@ -17,10 +17,8 @@
<modules>
<module>agileboot-common</module>
<module>agileboot-system</module>
<module>agileboot-boot-start</module>
<module>agileboot-cloud</module>
<module>wol-domain</module>
<module>wol-api</module>
<module>wol-auth</module>
<module>wol-gateway</module>
<module>wol-modules</module>
</modules>
<packaging>pom</packaging>
@@ -30,8 +28,9 @@
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
<java.version>17</java.version>
<spring.boot.version>3.5.4</spring.boot.version>
<spring.boot.version>3.4.7</spring.boot.version>
<spring-cloud.version>2024.0.0</spring-cloud.version>
<spring-cloud-alibaba.version>2023.0.3.3</spring-cloud-alibaba.version>
<mybatis.version>3.5.16</mybatis.version>
<mybatis-plus.version>3.5.12</mybatis-plus.version>
<dynamic-ds.version>4.3.1</dynamic-ds.version>
@@ -72,6 +71,14 @@
<type>pom</type>
<scope>import</scope>
</dependency>
<dependency>
<groupId>com.alibaba.cloud</groupId>
<artifactId>spring-cloud-alibaba-dependencies</artifactId>
<version>${spring-cloud-alibaba.version}</version>
<type>pom</type>
<scope>import</scope>
</dependency>
<!-- SpringBoot的依赖配置-->
<dependency>
<groupId>org.springframework.boot</groupId>
@@ -319,6 +326,24 @@
<build>
<!-- 用 @application.name@ 让 Maven 替换变量,确保 pom.xml 开启 资源过滤 -->
<resources>
<resource>
<directory>src/main/resources</directory>
<filtering>true</filtering>
<excludes>
<exclude>**/*.xdb</exclude> <!-- 不过滤二进制文件 -->
<exclude>**/*.png</exclude>
<exclude>**/*.jpg</exclude>
<exclude>**/*.ico</exclude>
</excludes>
</resource>
<resource>
<directory>src/main/resources/static</directory>
<filtering>false</filtering> <!-- 静态文件完全不过滤 -->
</resource>
</resources>
<pluginManagement>
<plugins>

View File

@@ -0,0 +1,11 @@
-- 为用户模板表添加显示隐藏控制字段和内容公开控制字段
-- 用于控制私有模板的显示状态,以及公开模板创建者的显示偏好
ALTER TABLE `user_template` ADD COLUMN `is_enabled` tinyint(1) NOT NULL DEFAULT '1' COMMENT '是否启用显示(0-隐藏 1-显示)' AFTER `status`;
-- 添加模板内容是否公开字段
ALTER TABLE `user_template` ADD COLUMN `is_content_public` tinyint(1) NOT NULL DEFAULT '0' COMMENT '模板内容是否公开(0-不公开 1-公开)' AFTER `is_enabled`;
-- 添加索引以提高查询性能
ALTER TABLE `user_template` ADD INDEX `idx_is_enabled` (`is_enabled`);
ALTER TABLE `user_template` ADD INDEX `idx_is_content_public` (`is_content_public`);

View File

@@ -0,0 +1,16 @@
-- 修复用户模板表的唯一约束问题
-- 解决逻辑删除与唯一约束的冲突
-- 1. 删除原有的唯一约束
ALTER TABLE `user_template` DROP INDEX `uk_user_template_name`;
-- 2. 创建条件唯一索引,只对未删除的记录生效
-- MySQL 5.7+ 支持函数索引,但为了兼容性,我们使用另一种方案
-- 创建一个复合索引,对于已删除的记录,使用 NULL 值来避免唯一约束
ALTER TABLE `user_template` ADD UNIQUE INDEX `uk_user_template_name_active` (`user_id`, `template_name`, (CASE WHEN deleted = 0 THEN 0 ELSE NULL END));
-- 注意:这个索引允许以下情况:
-- - 用户A有模板"test1"deleted=0正常- 唯一
-- - 用户A有多个模板"test1"deleted=1已删除- 允许多个
-- 但不允许:
-- - 用户A有两个模板"test1"都是deleted=0

125
sql/user_template.sql Normal file
View File

@@ -0,0 +1,125 @@
-- ========================================
-- 用户自定义模板功能数据库脚本
-- 创建时间: 2025-09-26
-- 描述: 支持用户创建私有/公开模板,模板仓库管理功能
-- ========================================
-- 1. 用户模板表
DROP TABLE IF EXISTS `user_template`;
CREATE TABLE `user_template` (
`id` bigint NOT NULL AUTO_INCREMENT COMMENT '主键ID',
`user_id` bigint NOT NULL COMMENT '用户ID',
`template_name` varchar(100) NOT NULL COMMENT '模板名称',
`template_group` varchar(50) NOT NULL COMMENT '模板分组',
`template_content` longtext NOT NULL COMMENT '模板内容(FreeMarker模板)',
`description` varchar(500) DEFAULT NULL COMMENT '模板描述',
`is_public` tinyint(1) NOT NULL DEFAULT '0' COMMENT '是否公开(0-私有 1-公开)',
`version` varchar(20) NOT NULL DEFAULT '1.0.0' COMMENT '模板版本',
`use_count` int NOT NULL DEFAULT '0' COMMENT '使用次数统计',
`status` tinyint(1) NOT NULL DEFAULT '1' COMMENT '状态(0-草稿 1-发布 2-禁用)',
`create_by` bigint DEFAULT NULL COMMENT '创建人ID',
`create_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
`update_by` bigint DEFAULT NULL COMMENT '更新人ID',
`update_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '更新时间',
`deleted` tinyint(1) NOT NULL DEFAULT '0' COMMENT '逻辑删除(0-未删除 1-已删除)',
PRIMARY KEY (`id`),
UNIQUE KEY `uk_user_template_name` (`user_id`, `template_name`),
KEY `idx_user_id` (`user_id`),
KEY `idx_template_group` (`template_group`),
KEY `idx_is_public` (`is_public`),
KEY `idx_status` (`status`),
KEY `idx_create_time` (`create_time`),
KEY `idx_deleted` (`deleted`)
) ENGINE=InnoDB AUTO_INCREMENT=1 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci COMMENT='用户自定义模板表';
-- 2. 用户模板仓库配置表
DROP TABLE IF EXISTS `user_template_repository`;
CREATE TABLE `user_template_repository` (
`id` bigint NOT NULL AUTO_INCREMENT COMMENT '主键ID',
`user_id` bigint NOT NULL COMMENT '用户ID',
`template_source` varchar(20) NOT NULL COMMENT '模板来源(system-系统模板 user-用户模板)',
`template_id` varchar(50) NOT NULL COMMENT '模板ID(系统模板用template.json中的id用户模板用user_template.id)',
`template_name` varchar(100) NOT NULL COMMENT '模板名称(冗余字段便于查询)',
`template_group` varchar(50) NOT NULL COMMENT '模板分组(冗余字段便于查询)',
`is_enabled` tinyint(1) NOT NULL DEFAULT '1' COMMENT '是否启用显示(0-隐藏 1-显示)',
`sort_order` int NOT NULL DEFAULT '0' COMMENT '显示排序(数字越小越靠前)',
`create_by` bigint DEFAULT NULL COMMENT '创建人ID',
`create_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
`update_by` bigint DEFAULT NULL COMMENT '更新人ID',
`update_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '更新时间',
`deleted` tinyint(1) NOT NULL DEFAULT '0' COMMENT '逻辑删除(0-未删除 1-已删除)',
PRIMARY KEY (`id`),
UNIQUE KEY `uk_user_template` (`user_id`, `template_source`, `template_id`),
KEY `idx_user_id` (`user_id`),
KEY `idx_template_source` (`template_source`),
KEY `idx_is_enabled` (`is_enabled`),
KEY `idx_sort_order` (`sort_order`),
KEY `idx_deleted` (`deleted`)
) ENGINE=InnoDB AUTO_INCREMENT=1 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci COMMENT='用户模板仓库配置表';
-- 3. 模板使用日志表
DROP TABLE IF EXISTS `template_usage_log`;
CREATE TABLE `template_usage_log` (
`id` bigint NOT NULL AUTO_INCREMENT COMMENT '主键ID',
`user_id` bigint NOT NULL COMMENT '使用者ID',
`template_source` varchar(20) NOT NULL COMMENT '模板来源(system-系统模板 user-用户模板)',
`template_id` varchar(50) NOT NULL COMMENT '模板ID',
`template_name` varchar(100) NOT NULL COMMENT '模板名称',
`template_group` varchar(50) NOT NULL COMMENT '模板分组',
`ip_address` varchar(50) DEFAULT NULL COMMENT 'IP地址',
`create_by` bigint DEFAULT NULL COMMENT '创建人ID',
`create_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间(使用时间)',
`update_by` bigint DEFAULT NULL COMMENT '更新人ID',
`update_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '更新时间',
`deleted` tinyint(1) NOT NULL DEFAULT '0' COMMENT '逻辑删除(0-未删除 1-已删除)',
PRIMARY KEY (`id`),
KEY `idx_user_id` (`user_id`),
KEY `idx_template_source` (`template_source`),
KEY `idx_template_id` (`template_id`),
KEY `idx_create_time` (`create_time`),
KEY `idx_deleted` (`deleted`)
) ENGINE=InnoDB AUTO_INCREMENT=1 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci COMMENT='模板使用日志表';
-- ========================================
-- 初始化数据
-- ========================================
-- 为管理员用户(假设user_id=1)初始化系统默认模板到仓库
-- 这些数据对应template.json中的模板配置
INSERT INTO `user_template_repository` (`user_id`, `template_source`, `template_id`, `template_name`, `template_group`, `is_enabled`, `sort_order`) VALUES
(1, 'system', '10', 'swagger-ui', 'ui', 1, 10),
(1, 'system', '20', 'controller', 'mybatis', 1, 20),
(1, 'system', '21', 'service', 'mybatis', 1, 21),
(1, 'system', '22', 'service_impl', 'mybatis', 1, 22),
(1, 'system', '23', 'mapper', 'mybatis', 1, 23),
(1, 'system', '24', 'mybatis', 'mybatis', 1, 24),
(1, 'system', '25', 'model', 'mybatis', 1, 25),
(1, 'system', '26', 'mapper2', 'mybatis', 1, 26),
(1, 'system', '60', 'pluscontroller', 'mybatis-plus', 1, 60),
(1, 'system', '61', 'plusservice', 'mybatis-plus', 1, 61),
(1, 'system', '62', 'plusmapper', 'mybatis-plus', 1, 62),
(1, 'system', '63', 'plusentity', 'mybatis-plus', 1, 63);
-- ========================================
-- 示例数据(可选)
-- ========================================
-- 创建一个示例用户模板
INSERT INTO `user_template` (
`user_id`, `template_name`, `template_group`, `template_content`, `description`,
`is_public`, `version`, `status`, `create_by`
) VALUES (
1,
'custom-controller',
'custom',
'/**\n * ${classInfo.classComment}\n * \n * @author ${classInfo.author}\n * @date ${classInfo.createDate}\n */\n@RestController\n@RequestMapping("/${classInfo.classNameLower}")\npublic class ${classInfo.className}Controller {\n // 自定义控制器模板\n}',
'自定义控制器模板示例',
1,
'1.0.0',
1,
1
);
-- 将示例模板添加到仓库
INSERT INTO `user_template_repository` (`user_id`, `template_source`, `template_id`, `template_name`, `template_group`, `is_enabled`, `sort_order`)
SELECT 1, 'user', id, template_name, template_group, 1, 100 FROM `user_template` WHERE `template_name` = 'custom-controller';

View File

@@ -5,13 +5,21 @@
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>com.agileboot</groupId>
<artifactId>agileboot-system</artifactId>
<artifactId>agileboot</artifactId>
<version>1.0.0</version>
</parent>
<artifactId>wol-auth</artifactId>
<properties>
<application.name>wol-auth</application.name>
</properties>
<dependencies>
<dependency>
<groupId>com.agileboot</groupId>
<artifactId>wol-common-nacos</artifactId>
</dependency>
<dependency>
<groupId>com.agileboot</groupId>
<artifactId>wol-common-satoken</artifactId>
@@ -23,6 +31,7 @@
<dependency>
<groupId>com.agileboot</groupId>
<artifactId>agileboot-system-base</artifactId>
<version>${project.version}</version>
</dependency>
</dependencies>

View File

@@ -7,9 +7,9 @@ import org.springframework.boot.autoconfigure.SpringBootApplication;
* @Author cuiJiaWang
* @Create 2025-08-12 18:07
*/
@SpringBootApplication(scanBasePackages = "com.agileboot.*")
@SpringBootApplication(scanBasePackages = {"com.agileboot.auth", "com.agileboot.system"})
public class WolAuthApplication {
public static void main(String[] args) {
SpringApplication.run(WolAuthApplication.class, args);
String successMsg = " ____ _ _ __ _ _ \n"

View File

@@ -0,0 +1,14 @@
package com.agileboot.auth.config;
import com.agileboot.common.core.factory.YmlPropertySourceFactory;
import org.springframework.context.annotation.Configuration;
import org.springframework.context.annotation.PropertySource;
/**
* @Author cuiJiaWang
* @Create 2025-09-30 14:29
*/
@Configuration
@PropertySource(value = "classpath:auth.yml", factory = YmlPropertySourceFactory.class)
public class AuthConfig {
}

View File

@@ -54,7 +54,7 @@ public class AuthController {
public R<?> login(@RequestBody String body) {
LoginBody loginBody = JSONObject.parseObject(body, LoginBody.class);
ValidatorUtils.validate(loginBody);
Long clientId = loginBody.getClientId();
Long clientId = Long.parseLong(loginBody.getClientId());
String grantType = loginBody.getGrantType();
SysClientVO clientVo = sysClientService.queryByClientId(clientId);

Some files were not shown because too many files have changed in this diff Show More