build: continew-starter 2.12.2 => 2.13.0

1.引入 continew-starter-validation(从 core 拆分)、sa-token-sign(从 sa-token-core 拆分并调整了部分 API)
2.Starter import 包路径调整
- EasyExcel 替换为 FastExcel:com.alibaba.excel(EasyExcel) => cn.idev.excel(FastExcel)
- top.continew.starter.file.excel => top.continew.starter.excel
- top.continew.starter.core.validation.constraints => top.continew.starter.validation.constraints
- top.continew.starter.core.validation.ValidationUtils、CheckUtils、Validator => top.continew.starter.core.util.validation
- cn.dev33.satoken.sign => cn.dev33.satoken.sign.template
- top.continew.starter.core.autoconfigure.project => top.continew.starter.core.autoconfigure.application
- top.continew.starter.data.core、top.continew.starter.data.mp => top.continew.starter.data
- top.continew.starter.data.mp.base.BaseMapper => top.continew.starter.data.mapper.BaseMapper
2.Starter 基础类命名调整
CRUD:AbstractBaseController => AbstractCrudController,BaseService => CrudService,BaseServiceImpl => CrudServiceImpl
Core:ProjectProperties(项目配置,project.xxx) => ApplicationProperties(应用配置更为贴切,且变量 application.xx 可以和 Maven 变量显著区分开)
3.groupId 调整:top.continew.starter、top.continew.admin(避免部分童鞋全局替换包名时出现把 starter 也一起替换了!)
4.Admin import 包路径调整:BaseController、BaseDO等 => common.base
5.新增 BaseService、BaseServiceImpl 替代 Starter 原 BaseXxx,方便用户根据项目实际需要重写或新增全局通用接口、方法
6.snail-job server 数据库脚本更新至 v1.5.0
7.Valid 及 Validated 使用梳理(CrudService 支持通过在实现类添加 Validated 注解来实现 Service 层基础校验)
This commit is contained in:
2025-07-05 21:33:45 +08:00
parent efb65c21a1
commit 2138bee42c
184 changed files with 714 additions and 575 deletions

View File

@@ -4,7 +4,7 @@
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>top.continew</groupId>
<groupId>top.continew.admin</groupId>
<artifactId>continew-admin</artifactId>
<version>${revision}</version>
</parent>
@@ -55,15 +55,27 @@
<artifactId>postgresql</artifactId>
</dependency>-->
<!-- ContiNew Starter 扩展模块 - CURD增删改查 -->
<!-- ContiNew Starter JSON 模块 - Jackson -->
<dependency>
<groupId>top.continew</groupId>
<artifactId>continew-starter-extension-crud-mp</artifactId>
<groupId>top.continew.starter</groupId>
<artifactId>continew-starter-json-jackson</artifactId>
</dependency>
<!-- ContiNew Starter 验证模块 -->
<dependency>
<groupId>top.continew.starter</groupId>
<artifactId>continew-starter-validation</artifactId>
</dependency>
<!-- ContiNew Starter 缓存模块 - JetCache -->
<dependency>
<groupId>top.continew.starter</groupId>
<artifactId>continew-starter-cache-jetcache</artifactId>
</dependency>
<!-- ContiNew Starter 认证模块 - SaToken -->
<dependency>
<groupId>top.continew</groupId>
<groupId>top.continew.starter</groupId>
<artifactId>continew-starter-auth-satoken</artifactId>
<exclusions>
<exclusion>
@@ -72,28 +84,63 @@
</exclusion>
</exclusions>
</dependency>
<!-- API 接口参数签名 -->
<dependency>
<groupId>cn.dev33</groupId>
<artifactId>sa-token-sign</artifactId>
</dependency>
<!-- ContiNew Starter 认证模块 - JustAuth -->
<dependency>
<groupId>top.continew</groupId>
<groupId>top.continew.starter</groupId>
<artifactId>continew-starter-auth-justauth</artifactId>
</dependency>
<!-- ContiNew Starter 缓存模块 - JetCache -->
<!-- ContiNew Starter 安全模块 - 密码编码器 -->
<dependency>
<groupId>top.continew</groupId>
<artifactId>continew-starter-cache-jetcache</artifactId>
<groupId>top.continew.starter</groupId>
<artifactId>continew-starter-security-password</artifactId>
</dependency>
<!-- ContiNew Starter 数据权限模块 - MyBatis Plus -->
<!-- ContiNew Starter 安全模块 - 加密 -->
<dependency>
<groupId>top.continew</groupId>
<artifactId>continew-starter-extension-datapermission-mp</artifactId>
<groupId>top.continew.starter</groupId>
<artifactId>continew-starter-security-crypto</artifactId>
</dependency>
<!-- ContiNew Starter 安全模块 - 脱敏 -->
<dependency>
<groupId>top.continew.starter</groupId>
<artifactId>continew-starter-security-mask</artifactId>
</dependency>
<!-- ContiNew Starter 限流模块 -->
<dependency>
<groupId>top.continew.starter</groupId>
<artifactId>continew-starter-ratelimiter</artifactId>
</dependency>
<!-- ContiNew Starter 验证码模块 - 图形验证码 -->
<dependency>
<groupId>top.continew.starter</groupId>
<artifactId>continew-starter-captcha-graphic</artifactId>
</dependency>
<!-- ContiNew Starter 验证码模块 - 行为验证码 -->
<dependency>
<groupId>top.continew.starter</groupId>
<artifactId>continew-starter-captcha-behavior</artifactId>
</dependency>
<!-- ContiNew Starter 消息模块 - 邮件 -->
<dependency>
<groupId>top.continew.starter</groupId>
<artifactId>continew-starter-messaging-mail</artifactId>
</dependency>
<!-- ContiNew Starter 消息模块 - WebSocket -->
<dependency>
<groupId>top.continew</groupId>
<groupId>top.continew.starter</groupId>
<artifactId>continew-starter-messaging-websocket</artifactId>
<exclusions>
<exclusion>
@@ -103,58 +150,22 @@
</exclusions>
</dependency>
<!-- ContiNew Starter 消息模块 - 邮件 -->
<dependency>
<groupId>top.continew</groupId>
<artifactId>continew-starter-messaging-mail</artifactId>
</dependency>
<!-- ContiNew Starter 验证码模块 - 图形验证码 -->
<dependency>
<groupId>top.continew</groupId>
<artifactId>continew-starter-captcha-graphic</artifactId>
</dependency>
<!-- ContiNew Starter 验证码模块 - 行为验证码 -->
<dependency>
<groupId>top.continew</groupId>
<artifactId>continew-starter-captcha-behavior</artifactId>
</dependency>
<!-- ContiNew Starter 限流模块 -->
<dependency>
<groupId>top.continew</groupId>
<artifactId>continew-starter-ratelimiter</artifactId>
</dependency>
<!-- ContiNew Starter 安全模块 - 加密 -->
<dependency>
<groupId>top.continew</groupId>
<artifactId>continew-starter-security-crypto</artifactId>
</dependency>
<!-- ContiNew Starter 安全模块 - 脱敏 -->
<dependency>
<groupId>top.continew</groupId>
<artifactId>continew-starter-security-mask</artifactId>
</dependency>
<!-- ContiNew Starter 安全模块 - 密码编码器 -->
<dependency>
<groupId>top.continew</groupId>
<artifactId>continew-starter-security-password</artifactId>
</dependency>
<!-- ContiNew Starter JSON 模块 - Jackson -->
<dependency>
<groupId>top.continew</groupId>
<artifactId>continew-starter-json-jackson</artifactId>
</dependency>
<!-- ContiNew Starter 日志模块 - 拦截器版Spring Boot Actuator HttpTrace 增强版) -->
<dependency>
<groupId>top.continew</groupId>
<groupId>top.continew.starter</groupId>
<artifactId>continew-starter-log-interceptor</artifactId>
</dependency>
<!-- ContiNew Starter 数据权限模块 - MyBatis Plus -->
<dependency>
<groupId>top.continew.starter</groupId>
<artifactId>continew-starter-extension-datapermission-mp</artifactId>
</dependency>
<!-- ContiNew Starter 扩展模块 - CURD增删改查 -->
<dependency>
<groupId>top.continew.starter</groupId>
<artifactId>continew-starter-extension-crud-mp</artifactId>
</dependency>
</dependencies>
</project>

View File

@@ -14,54 +14,74 @@
* limitations under the License.
*/
package top.continew.admin.common.controller;
package top.continew.admin.common.base.controller;
import cn.dev33.satoken.annotation.SaIgnore;
import cn.dev33.satoken.context.SaHolder;
import cn.dev33.satoken.context.model.SaRequest;
import cn.dev33.satoken.sign.SaSignTemplate;
import cn.dev33.satoken.sign.template.SaSignTemplate;
import cn.dev33.satoken.stp.StpUtil;
import cn.hutool.core.annotation.AnnotationUtil;
import cn.hutool.core.text.CharSequenceUtil;
import top.continew.admin.common.base.service.BaseService;
import top.continew.starter.core.constant.StringConstants;
import top.continew.starter.extension.crud.annotation.CrudApi;
import top.continew.starter.extension.crud.annotation.CrudRequestMapping;
import top.continew.starter.extension.crud.controller.AbstractBaseController;
import top.continew.starter.extension.crud.controller.AbstractCrudController;
import top.continew.starter.extension.crud.enums.Api;
import top.continew.starter.extension.crud.service.BaseService;
import java.lang.reflect.Method;
import java.util.Collection;
/**
* 控制器基类
*
* <p>
* 根据实际项目需要自行重写 CRUD 接口或增加自定义通用业务接口
* </p>
*
* @param <S> 业务接口
* @param <L> 列表类型
* @param <D> 详情类型
* @param <Q> 查询条件
* @param <C> 创建或修改参数类型
* @param <Q> 查询条件类型
* @param <C> 创建或修改请求参数类型
* @author Charles7c
* @since 2024/12/6 20:30
*/
public class BaseController<S extends BaseService<L, D, Q, C>, L, D, Q, C> extends AbstractBaseController<S, L, D, Q, C> {
public class BaseController<S extends BaseService<L, D, Q, C>, L, D, Q, C> extends AbstractCrudController<S, L, D, Q, C> {
@Override
public void preHandle(CrudApi crudApi, Object[] args, Method targetMethod, Class<?> targetClass) throws Exception {
// 忽略带 sign 请求权限校验
SaRequest saRequest = SaHolder.getRequest();
Collection<String> paramNames = saRequest.getParamNames();
if (paramNames.stream().anyMatch(SaSignTemplate.sign::equals)) {
return;
}
// 忽略接口类或接口方法上带 @SaIgnore 注解的权限校验
if (AnnotationUtil.hasAnnotation(targetMethod, SaIgnore.class) || AnnotationUtil
.hasAnnotation(targetClass, SaIgnore.class)) {
return;
}
// 校验权限例如创建用户接口POST /system/user => 校验 system:user:create 权限
CrudRequestMapping crudRequestMapping = targetClass.getDeclaredAnnotation(CrudRequestMapping.class);
String path = crudRequestMapping.value();
String prefix = String.join(StringConstants.COLON, CharSequenceUtil.splitTrim(path, StringConstants.SLASH));
Api api = crudApi.value();
String apiName = Api.PAGE.equals(api) || Api.TREE.equals(api) ? Api.LIST.name() : api.name();
String apiName = this.getApiName(crudApi.value());
StpUtil.checkPermission("%s:%s".formatted(prefix, apiName.toLowerCase()));
}
/**
* 获取 API 名称
*
* @param api API
* @return API 名称
*/
private String getApiName(Api api) {
return switch (api) {
case PAGE, TREE, LIST -> Api.LIST.name();
case DELETE, BATCH_DELETE -> Api.DELETE.name();
default -> api.name();
};
}
}

View File

@@ -14,13 +14,13 @@
* limitations under the License.
*/
package top.continew.admin.common.config.mybatis;
package top.continew.admin.common.base.mapper;
import com.baomidou.mybatisplus.core.conditions.Wrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.core.toolkit.Constants;
import org.apache.ibatis.annotations.Param;
import top.continew.starter.data.mp.base.BaseMapper;
import top.continew.starter.data.mapper.BaseMapper;
import top.continew.starter.extension.datapermission.annotation.DataPermission;
import java.io.Serializable;

View File

@@ -14,7 +14,7 @@
* limitations under the License.
*/
package top.continew.admin.common.model.entity;
package top.continew.admin.common.base.model.entity;
import com.baomidou.mybatisplus.annotation.FieldFill;
import com.baomidou.mybatisplus.annotation.TableField;

View File

@@ -14,7 +14,7 @@
* limitations under the License.
*/
package top.continew.admin.common.model.entity;
package top.continew.admin.common.base.model.entity;
import com.baomidou.mybatisplus.annotation.FieldFill;
import com.baomidou.mybatisplus.annotation.TableField;

View File

@@ -14,7 +14,7 @@
* limitations under the License.
*/
package top.continew.admin.common.model.entity;
package top.continew.admin.common.base.model.entity;
import com.baomidou.mybatisplus.annotation.FieldFill;
import com.baomidou.mybatisplus.annotation.TableField;

View File

@@ -14,7 +14,7 @@
* limitations under the License.
*/
package top.continew.admin.common.model.req;
package top.continew.admin.common.base.model.req;
import io.swagger.v3.oas.annotations.media.Schema;
import jakarta.validation.constraints.NotNull;

View File

@@ -14,12 +14,12 @@
* limitations under the License.
*/
package top.continew.admin.common.model.resp;
package top.continew.admin.common.base.model.resp;
import cn.crane4j.annotation.Assemble;
import cn.crane4j.annotation.Mapping;
import cn.crane4j.annotation.condition.ConditionOnPropertyNotNull;
import com.alibaba.excel.annotation.ExcelProperty;
import cn.idev.excel.annotation.ExcelProperty;
import com.fasterxml.jackson.annotation.JsonIgnore;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;

View File

@@ -14,11 +14,11 @@
* limitations under the License.
*/
package top.continew.admin.common.model.resp;
package top.continew.admin.common.base.model.resp;
import cn.crane4j.annotation.Assemble;
import cn.crane4j.annotation.Mapping;
import com.alibaba.excel.annotation.ExcelProperty;
import cn.idev.excel.annotation.ExcelProperty;
import com.fasterxml.jackson.annotation.JsonIgnore;
import com.fasterxml.jackson.annotation.JsonInclude;
import io.swagger.v3.oas.annotations.media.Schema;

View File

@@ -0,0 +1,36 @@
/*
* Copyright (c) 2022-present Charles7c Authors. All Rights Reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package top.continew.admin.common.base.service;
import top.continew.starter.extension.crud.service.CrudService;
/**
* 业务接口基类
*
* <p>
* 根据实际项目需要,自行重写 CRUD 接口或增加自定义通用业务方法
* </p>
*
* @param <L> 列表类型
* @param <D> 详情类型
* @param <Q> 查询条件类型
* @param <C> 创建或修改请求参数类型
* @author Charles7c
* @since 2024/12/6 20:30
*/
public interface BaseService<L, D, Q, C> extends CrudService<L, D, Q, C> {
}

View File

@@ -0,0 +1,41 @@
/*
* Copyright (c) 2022-present Charles7c Authors. All Rights Reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package top.continew.admin.common.base.service;
import top.continew.starter.data.mapper.BaseMapper;
import top.continew.starter.extension.crud.model.entity.BaseIdDO;
import top.continew.starter.extension.crud.service.CrudServiceImpl;
/**
* 业务实现基类
*
*
* <p>
* 根据实际项目需要,自行重写 CRUD 接口或增加自定义通用业务方法实现
* </p>
*
* @param <M> Mapper 接口
* @param <T> 实体类型
* @param <L> 列表类型
* @param <D> 详情类型
* @param <Q> 查询条件类型
* @param <C> 创建或修改请求参数类型
* @author Charles7c
* @since 2024/12/6 20:30
*/
public class BaseServiceImpl<M extends BaseMapper<T>, T extends BaseIdDO, L, D, Q, C> extends CrudServiceImpl<M, T, L, D, Q, C> implements BaseService<L, D, Q, C> {
}

View File

@@ -19,11 +19,11 @@ package top.continew.admin.common.config.excel;
import cn.hutool.core.collection.CollUtil;
import cn.hutool.core.convert.Convert;
import cn.hutool.extra.spring.SpringUtil;
import com.alibaba.excel.converters.Converter;
import com.alibaba.excel.metadata.GlobalConfiguration;
import com.alibaba.excel.metadata.data.ReadCellData;
import com.alibaba.excel.metadata.data.WriteCellData;
import com.alibaba.excel.metadata.property.ExcelContentProperty;
import cn.idev.excel.converters.Converter;
import cn.idev.excel.metadata.GlobalConfiguration;
import cn.idev.excel.metadata.data.ReadCellData;
import cn.idev.excel.metadata.data.WriteCellData;
import cn.idev.excel.metadata.property.ExcelContentProperty;
import top.continew.admin.common.service.CommonDictItemService;
import top.continew.starter.core.constant.StringConstants;
import top.continew.starter.extension.crud.model.resp.LabelValueResp;

View File

@@ -20,7 +20,7 @@ import cn.hutool.core.util.ObjectUtil;
import com.baomidou.mybatisplus.core.handlers.MetaObjectHandler;
import org.apache.ibatis.reflection.MetaObject;
import top.continew.admin.common.context.UserContextHolder;
import top.continew.admin.common.model.entity.BaseDO;
import top.continew.admin.common.base.model.entity.BaseDO;
import java.time.LocalDateTime;

View File

@@ -22,7 +22,7 @@ import cn.hutool.crypto.asymmetric.KeyType;
import cn.hutool.extra.spring.SpringUtil;
import top.continew.admin.common.config.properties.RsaProperties;
import top.continew.starter.core.exception.BusinessException;
import top.continew.starter.core.validation.ValidationUtils;
import top.continew.starter.core.util.validation.ValidationUtils;
import top.continew.starter.security.crypto.autoconfigure.CryptoProperties;
import top.continew.starter.security.crypto.encryptor.AesEncryptor;
import top.continew.starter.security.crypto.encryptor.IEncryptor;

View File

@@ -4,7 +4,7 @@
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>top.continew</groupId>
<groupId>top.continew.admin</groupId>
<artifactId>continew-extension</artifactId>
<version>${revision}</version>
</parent>
@@ -17,7 +17,7 @@
<properties>
<!-- SnailJob 服务端 -->
<snail-job.version>1.4.0</snail-job.version>
<snail-job.version>1.5.0</snail-job.version>
</properties>
<dependencies>

View File

@@ -1,14 +1,14 @@
-- liquibase formatted sql
-- changeset snail-job-server:1.1.0
-- 默认命名空间Default
INSERT INTO `sj_namespace` (`id`, `name`, `unique_id`, `create_dt`, `update_dt`, `deleted`)
VALUES (1, 'Default', '764d604ec6fc45f68cd92514c40e9e1a', NOW(), NOW(), 0);
-- changeset snail-job-server:1.5.0
-- 默认用户admin/admin
INSERT INTO `sj_system_user` (username, password, role)
VALUES ('admin', '465c194afb65670f38322df087f0a9bb225cc257e43eb4ac5a0c98ef5b3173ac', 2);
-- 默认命名空间Default
INSERT INTO `sj_namespace` (`id`, `name`, `unique_id`, `create_dt`, `update_dt`, `deleted`)
VALUES (1, 'Default', '764d604ec6fc45f68cd92514c40e9e1a', NOW(), NOW(), 0);
-- 默认分组continew-admin
INSERT INTO `sj_group_config` (`id`, `namespace_id`, `group_name`, `description`, `token`, `group_status`, `version`, `group_partition`, `id_generator_mode`, `init_scene`, `create_dt`, `update_dt`)
VALUES (1, '764d604ec6fc45f68cd92514c40e9e1a', 'continew-admin', '默认分组', 'SJ_Wyz3dmsdbDOkDujOTSSoBjGQP1BMsVnj', 1, 1, 0, 2, 1, NOW(), NOW());

View File

@@ -1,6 +1,6 @@
-- liquibase formatted sql
-- changeset snail-job-server:1.1.0
-- changeset snail-job-server:1.5.0
SET NAMES utf8mb4;
CREATE TABLE `sj_namespace`
@@ -81,16 +81,20 @@ CREATE TABLE `sj_notify_recipient`
CREATE TABLE `sj_retry_dead_letter`
(
`id` bigint(20) unsigned NOT NULL AUTO_INCREMENT COMMENT '主键',
`namespace_id` varchar(64) NOT NULL DEFAULT '764d604ec6fc45f68cd92514c40e9e1a' COMMENT '命名空间id',
`group_name` varchar(64) NOT NULL COMMENT '组名称',
`scene_name` varchar(64) NOT NULL COMMENT '场景名称',
`idempotent_id` varchar(64) NOT NULL COMMENT '幂等id',
`biz_no` varchar(64) NOT NULL DEFAULT '' COMMENT '业务编号',
`executor_name` varchar(512) NOT NULL DEFAULT '' COMMENT '执行器名称',
`args_str` text NOT NULL COMMENT '执行方法参数',
`ext_attrs` text NOT NULL COMMENT '扩展字段',
`create_dt` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
`id` bigint(20) unsigned NOT NULL AUTO_INCREMENT COMMENT '主键',
`namespace_id` varchar(64) NOT NULL DEFAULT '764d604ec6fc45f68cd92514c40e9e1a' COMMENT '命名空间id',
`group_name` varchar(64) NOT NULL COMMENT '组名称',
`group_id` bigint(20) NOT NULL COMMENT '组Id',
`scene_name` varchar(64) NOT NULL COMMENT '场景名称',
`scene_id` bigint(20) NOT NULL COMMENT '场景ID',
`idempotent_id` varchar(64) NOT NULL COMMENT '幂等id',
`biz_no` varchar(64) NOT NULL DEFAULT '' COMMENT '业务编号',
`executor_name` varchar(512) NOT NULL DEFAULT '' COMMENT '执行器名称',
-- jackson 兼容历史数据 预计1.8.0默认改为fury
`serializer_name` varchar(32) NOT NULL DEFAULT 'jackson' COMMENT '执行方法参数序列化器名称',
`args_str` text NOT NULL COMMENT '执行方法参数',
`ext_attrs` text NOT NULL COMMENT '扩展字段',
`create_dt` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
PRIMARY KEY (`id`),
KEY `idx_namespace_id_group_name_scene_name` (`namespace_id`, `group_name`, `scene_name`),
KEY `idx_idempotent_id` (`idempotent_id`),
@@ -106,12 +110,16 @@ CREATE TABLE `sj_retry`
`id` bigint(20) unsigned NOT NULL AUTO_INCREMENT COMMENT '主键',
`namespace_id` varchar(64) NOT NULL DEFAULT '764d604ec6fc45f68cd92514c40e9e1a' COMMENT '命名空间id',
`group_name` varchar(64) NOT NULL COMMENT '组名称',
`group_id` bigint(20) NOT NULL COMMENT '组Id',
`scene_name` varchar(64) NOT NULL COMMENT '场景名称',
`scene_id` bigint(20) NOT NULL COMMENT '场景ID',
`idempotent_id` varchar(64) NOT NULL COMMENT '幂等id',
`biz_no` varchar(64) NOT NULL DEFAULT '' COMMENT '业务编号',
`executor_name` varchar(512) NOT NULL DEFAULT '' COMMENT '执行器名称',
`args_str` text NOT NULL COMMENT '执行方法参数',
`ext_attrs` text NOT NULL COMMENT '扩展字段',
-- jackson 兼容历史数据 预计1.8.0默认改为fury
`serializer_name` varchar(32) NOT NULL DEFAULT 'jackson' COMMENT '执行方法参数序列化器名称',
`next_trigger_at` bigint(13) NOT NULL COMMENT '下次触发时间',
`retry_count` int(11) NOT NULL DEFAULT 0 COMMENT '重试次数',
`retry_status` tinyint(4) NOT NULL DEFAULT 0 COMMENT '重试状态 0、重试中 1、成功 2、最大重试次数',
@@ -122,13 +130,12 @@ CREATE TABLE `sj_retry`
`create_dt` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
`update_dt` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '修改时间',
PRIMARY KEY (`id`),
KEY `idx_namespace_id_group_name_scene_name` (`namespace_id`, `group_name`, `scene_name`),
KEY `idx_namespace_id_group_name_retry_status` (`namespace_id`, `group_name`, `retry_status`),
KEY `idx_idempotent_id` (`idempotent_id`),
KEY `idx_biz_no` (`biz_no`),
KEY `idx_idempotent_id` (`idempotent_id`),
KEY `idx_retry_status_bucket_index` (`retry_status`, `bucket_index`),
KEY `idx_parent_id` (`parent_id`),
KEY `idx_create_dt` (`create_dt`),
UNIQUE KEY `uk_name_task_type_idempotent_id_deleted` (`namespace_id`, `group_name`, `task_type`, `idempotent_id`, `deleted`)
UNIQUE KEY `uk_scene_tasktype_idempotentid_deleted` (`scene_id`, `task_type`, `idempotent_id`, `deleted`)
) ENGINE = InnoDB
AUTO_INCREMENT = 0
DEFAULT CHARSET = utf8mb4 COMMENT ='重试信息表'
@@ -145,7 +152,7 @@ CREATE TABLE `sj_retry_task`
`task_status` tinyint(4) NOT NULL DEFAULT 1 COMMENT '重试状态',
`task_type` tinyint(4) NOT NULL DEFAULT 1 COMMENT '任务类型 1、重试数据 2、回调数据',
`operation_reason` tinyint(4) NOT NULL DEFAULT 0 COMMENT '操作原因',
`client_info` varchar(128) DEFAULT NULL COMMENT '客户端地址 clientId#ip:port',
`client_info` varchar(128) DEFAULT NULL COMMENT '客户端地址 clientId#ip:port',
`create_dt` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
`update_dt` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '修改时间',
PRIMARY KEY (`id`),
@@ -196,6 +203,8 @@ CREATE TABLE `sj_retry_scene_config`
`cb_trigger_type` tinyint(4) NOT NULL DEFAULT 1 COMMENT '1、默认等级 2、固定间隔时间 3、CRON 表达式',
`cb_max_count` int(11) NOT NULL DEFAULT 16 COMMENT '回调的最大执行次数',
`cb_trigger_interval` varchar(16) NOT NULL DEFAULT '' COMMENT '回调的最大执行次数',
`owner_id` bigint(20) NULL DEFAULT NULL COMMENT '负责人id',
`labels` varchar(512) NULL DEFAULT '' COMMENT '标签',
`description` varchar(256) NOT NULL DEFAULT '' COMMENT '描述',
`create_dt` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
`update_dt` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '修改时间',
@@ -217,6 +226,7 @@ CREATE TABLE `sj_server_node`
`expire_at` datetime NOT NULL COMMENT '过期时间',
`node_type` tinyint(4) NOT NULL COMMENT '节点类型 1、客户端 2、是服务端',
`ext_attrs` varchar(256) NULL DEFAULT '' COMMENT '扩展字段',
`labels` varchar(512) NULL DEFAULT '' COMMENT '标签',
`create_dt` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
`update_dt` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '修改时间',
PRIMARY KEY (`id`),
@@ -230,12 +240,12 @@ CREATE TABLE `sj_server_node`
CREATE TABLE `sj_distributed_lock`
(
`name` varchar(64) NOT NULL COMMENT '锁名称',
`lock_until` timestamp(3) NOT NULL DEFAULT CURRENT_TIMESTAMP(3) ON UPDATE CURRENT_TIMESTAMP(3) COMMENT '锁定时长',
`locked_at` timestamp(3) NOT NULL DEFAULT CURRENT_TIMESTAMP(3) COMMENT '锁定时间',
`locked_by` varchar(255) NOT NULL COMMENT '锁定者',
`create_dt` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
`update_dt` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '修改时间',
`name` varchar(64) NOT NULL COMMENT '锁名称',
`lock_until` timestamp(3) NOT NULL DEFAULT CURRENT_TIMESTAMP(3) ON UPDATE CURRENT_TIMESTAMP(3) COMMENT '锁定时长',
`locked_at` timestamp(3) NOT NULL DEFAULT CURRENT_TIMESTAMP(3) COMMENT '锁定时间',
`locked_by` varchar(255) NOT NULL COMMENT '锁定者',
`create_dt` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
`update_dt` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '修改时间',
PRIMARY KEY (`name`)
) ENGINE = InnoDB
AUTO_INCREMENT = 0
@@ -268,19 +278,6 @@ CREATE TABLE `sj_system_user_permission`
) ENGINE = InnoDB
DEFAULT CHARSET = utf8mb4 COMMENT ='系统用户权限表';
CREATE TABLE `sj_sequence_alloc`
(
`id` bigint(20) unsigned NOT NULL AUTO_INCREMENT COMMENT '主键',
`namespace_id` varchar(64) NOT NULL DEFAULT '764d604ec6fc45f68cd92514c40e9e1a' COMMENT '命名空间id',
`group_name` varchar(64) NOT NULL DEFAULT '' COMMENT '组名称',
`max_id` bigint(20) NOT NULL DEFAULT 1 COMMENT '最大id',
`step` int(11) NOT NULL DEFAULT 100 COMMENT '步长',
`update_dt` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '更新时间',
PRIMARY KEY (`id`),
UNIQUE KEY `uk_namespace_id_group_name` (`namespace_id`, `group_name`)
) ENGINE = InnoDB
DEFAULT CHARSET = utf8mb4 COMMENT ='号段模式序号ID分配表';
-- 分布式调度DDL
CREATE TABLE `sj_job`
(
@@ -306,7 +303,8 @@ CREATE TABLE `sj_job`
`bucket_index` int(11) NOT NULL DEFAULT 0 COMMENT 'bucket',
`resident` tinyint(4) NOT NULL DEFAULT 0 COMMENT '是否是常驻任务',
`notify_ids` varchar(128) NOT NULL DEFAULT '' COMMENT '通知告警场景配置id列表',
`owner_id` bigint(20) NULL COMMENT '负责人id',
`owner_id` bigint(20) NULL DEFAULT NULL COMMENT '负责人id',
`labels` varchar(512) NULL DEFAULT '' COMMENT '标签',
`description` varchar(256) NOT NULL DEFAULT '' COMMENT '描述',
`ext_attrs` varchar(256) NULL DEFAULT '' COMMENT '扩展字段',
`deleted` tinyint(4) NOT NULL DEFAULT 0 COMMENT '逻辑删除 1、删除',
@@ -459,6 +457,7 @@ CREATE TABLE `sj_workflow`
`notify_ids` varchar(128) NOT NULL DEFAULT '' COMMENT '通知告警场景配置id列表',
`bucket_index` int(11) NOT NULL DEFAULT 0 COMMENT 'bucket',
`version` int(11) NOT NULL COMMENT '版本号',
`owner_id` bigint(20) NULL DEFAULT NULL COMMENT '负责人id',
`ext_attrs` varchar(256) NULL DEFAULT '' COMMENT '扩展字段',
`deleted` tinyint(4) NOT NULL DEFAULT 0 COMMENT '逻辑删除 1、删除',
`create_dt` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
@@ -508,7 +507,7 @@ CREATE TABLE `sj_workflow_task_batch`
`wf_context` text DEFAULT NULL COMMENT '全局上下文',
`execution_at` bigint(13) NOT NULL DEFAULT 0 COMMENT '任务执行时间',
`ext_attrs` varchar(256) NULL DEFAULT '' COMMENT '扩展字段',
`version` int(11) NOT NULL DEFAULT 1 COMMENT '版本号',
`version` int(11) NOT NULL DEFAULT 1 COMMENT '版本号',
`deleted` tinyint(4) NOT NULL DEFAULT 0 COMMENT '逻辑删除 1、删除',
`create_dt` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
`update_dt` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '修改时间',
@@ -518,4 +517,20 @@ CREATE TABLE `sj_workflow_task_batch`
KEY `idx_namespace_id_group_name` (`namespace_id`, `group_name`)
) ENGINE = InnoDB
AUTO_INCREMENT = 0
DEFAULT CHARSET = utf8mb4 COMMENT ='工作流批次';
DEFAULT CHARSET = utf8mb4 COMMENT ='工作流批次';
CREATE TABLE `sj_job_executor`
(
`id` bigint(20) unsigned NOT NULL AUTO_INCREMENT COMMENT '主键',
`namespace_id` varchar(64) NOT NULL DEFAULT '764d604ec6fc45f68cd92514c40e9e1a' COMMENT '命名空间id',
`group_name` varchar(64) NOT NULL COMMENT '组名称',
`executor_info` varchar(256) NOT NULL COMMENT '任务执行器名称',
`executor_type` varchar(3) NOT NULL COMMENT '1:java 2:python 3:go',
`create_dt` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
`update_dt` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '修改时间',
PRIMARY KEY (`id`),
KEY `idx_namespace_id_group_name` (`namespace_id`, `group_name`),
KEY `idx_create_dt` (`create_dt`)
) ENGINE = InnoDB
AUTO_INCREMENT = 0
DEFAULT CHARSET = utf8mb4 COMMENT ='任务执行器信息';

View File

@@ -1,14 +1,14 @@
-- liquibase formatted sql
-- changeset snail-job-server:1.1.0
-- 默认命名空间Default
INSERT INTO sj_namespace (id, name, unique_id, create_dt, update_dt, deleted)
VALUES (1, 'Default', '764d604ec6fc45f68cd92514c40e9e1a', NOW(), NOW(), 0);
-- changeset snail-job-server:1.5.0
-- 默认用户admin/admin
INSERT INTO sj_system_user (username, password, role)
VALUES ('admin', '465c194afb65670f38322df087f0a9bb225cc257e43eb4ac5a0c98ef5b3173ac', 2);
-- 默认命名空间Default
INSERT INTO sj_namespace (id, name, unique_id, create_dt, update_dt, deleted)
VALUES (1, 'Default', '764d604ec6fc45f68cd92514c40e9e1a', NOW(), NOW(), 0);
-- 默认分组continew-admin
INSERT INTO sj_group_config (id, namespace_id, group_name, description, token, group_status, version, group_partition, id_generator_mode, init_scene, create_dt, update_dt)
VALUES (1, '764d604ec6fc45f68cd92514c40e9e1a', 'continew-admin', '默认分组', 'SJ_Wyz3dmsdbDOkDujOTSSoBjGQP1BMsVnj', 1, 1, 0, 2, 1, NOW(), NOW());

View File

@@ -1,6 +1,6 @@
-- liquibase formatted sql
-- changeset snail-job-server:1.1.0
-- changeset snail-job-server:1.5.0
-- sj_namespace
CREATE TABLE sj_namespace
(
@@ -122,16 +122,19 @@ COMMENT ON TABLE sj_notify_recipient IS '告警通知接收人';
-- sj_retry_dead_letter
CREATE TABLE sj_retry_dead_letter
(
id bigserial PRIMARY KEY,
namespace_id varchar(64) NOT NULL DEFAULT '764d604ec6fc45f68cd92514c40e9e1a',
group_name varchar(64) NOT NULL,
scene_name varchar(64) NOT NULL,
idempotent_id varchar(64) NOT NULL,
biz_no varchar(64) NOT NULL DEFAULT '',
executor_name varchar(512) NOT NULL DEFAULT '',
args_str text NOT NULL,
ext_attrs text NOT NULL,
create_dt timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP
id bigserial PRIMARY KEY,
namespace_id varchar(64) NOT NULL DEFAULT '764d604ec6fc45f68cd92514c40e9e1a',
group_name varchar(64) NOT NULL,
group_id bigint NOT NULL,
scene_name varchar(64) NOT NULL,
scene_id bigint NOT NULL,
idempotent_id varchar(64) NOT NULL,
biz_no varchar(64) NOT NULL DEFAULT '',
executor_name varchar(512) NOT NULL DEFAULT '',
serializer_name varchar(32) NOT NULL DEFAULT 'jackson',
args_str text NOT NULL,
ext_attrs text NOT NULL,
create_dt timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP
);
CREATE INDEX idx_sj_retry_dead_letter_01 ON sj_retry_dead_letter (namespace_id, group_name, scene_name);
@@ -142,10 +145,13 @@ CREATE INDEX idx_sj_retry_dead_letter_04 ON sj_retry_dead_letter (create_dt);
COMMENT ON COLUMN sj_retry_dead_letter.id IS '主键';
COMMENT ON COLUMN sj_retry_dead_letter.namespace_id IS '命名空间id';
COMMENT ON COLUMN sj_retry_dead_letter.group_name IS '组名称';
COMMENT ON COLUMN sj_retry_dead_letter.group_id IS '组Id';
COMMENT ON COLUMN sj_retry_dead_letter.scene_name IS '场景名称';
COMMENT ON COLUMN sj_retry_dead_letter.scene_id IS '场景ID';
COMMENT ON COLUMN sj_retry_dead_letter.idempotent_id IS '幂等id';
COMMENT ON COLUMN sj_retry_dead_letter.biz_no IS '业务编号';
COMMENT ON COLUMN sj_retry_dead_letter.executor_name IS '执行器名称';
COMMENT ON COLUMN sj_retry_dead_letter.serializer_name IS '执行方法参数序列化器名称';
COMMENT ON COLUMN sj_retry_dead_letter.args_str IS '执行方法参数';
COMMENT ON COLUMN sj_retry_dead_letter.ext_attrs IS '扩展字段';
COMMENT ON COLUMN sj_retry_dead_letter.create_dt IS '创建时间';
@@ -157,12 +163,15 @@ CREATE TABLE sj_retry
id bigserial PRIMARY KEY,
namespace_id varchar(64) NOT NULL DEFAULT '764d604ec6fc45f68cd92514c40e9e1a',
group_name varchar(64) NOT NULL,
group_id bigint NOT NULL,
scene_name varchar(64) NOT NULL,
scene_id bigint NOT NULL,
idempotent_id varchar(64) NOT NULL,
biz_no varchar(64) NOT NULL DEFAULT '',
executor_name varchar(512) NOT NULL DEFAULT '',
args_str text NOT NULL,
ext_attrs text NOT NULL,
serializer_name varchar(32) NOT NULL DEFAULT 'jackson',
next_trigger_at bigint NOT NULL,
retry_count int NOT NULL DEFAULT 0,
retry_status smallint NOT NULL DEFAULT 0,
@@ -174,24 +183,26 @@ CREATE TABLE sj_retry
update_dt timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP
);
CREATE UNIQUE INDEX uk_sj_retry_01 ON sj_retry (namespace_id, group_name, task_type, idempotent_id, deleted);
CREATE UNIQUE INDEX uk_sj_retry_01 ON sj_retry (scene_id, task_type, idempotent_id, deleted);
CREATE INDEX idx_sj_retry_01 ON sj_retry (namespace_id, group_name, scene_name);
CREATE INDEX idx_sj_retry_02 ON sj_retry (namespace_id, group_name, retry_status);
CREATE INDEX idx_sj_retry_03 ON sj_retry (idempotent_id);
CREATE INDEX idx_sj_retry_04 ON sj_retry (biz_no);
CREATE INDEX idx_sj_retry_05 ON sj_retry (parent_id);
CREATE INDEX idx_sj_retry_06 ON sj_retry (create_dt);
CREATE INDEX idx_sj_retry_01 ON sj_retry (biz_no);
CREATE INDEX idx_sj_retry_02 ON sj_retry (idempotent_id);
CREATE INDEX idx_sj_retry_03 ON sj_retry (retry_status, bucket_index);
CREATE INDEX idx_sj_retry_04 ON sj_retry (parent_id);
CREATE INDEX idx_sj_retry_05 ON sj_retry (create_dt);
COMMENT ON COLUMN sj_retry.id IS '主键';
COMMENT ON COLUMN sj_retry.namespace_id IS '命名空间id';
COMMENT ON COLUMN sj_retry.group_name IS '组名称';
COMMENT ON COLUMN sj_retry.group_id IS '组Id';
COMMENT ON COLUMN sj_retry.scene_name IS '场景名称';
COMMENT ON COLUMN sj_retry.scene_id IS '场景ID';
COMMENT ON COLUMN sj_retry.idempotent_id IS '幂等id';
COMMENT ON COLUMN sj_retry.biz_no IS '业务编号';
COMMENT ON COLUMN sj_retry.executor_name IS '执行器名称';
COMMENT ON COLUMN sj_retry.args_str IS '执行方法参数';
COMMENT ON COLUMN sj_retry.ext_attrs IS '扩展字段';
COMMENT ON COLUMN sj_retry.serializer_name IS '执行方法参数序列化器名称';
COMMENT ON COLUMN sj_retry.next_trigger_at IS '下次触发时间';
COMMENT ON COLUMN sj_retry.retry_count IS '重试次数';
COMMENT ON COLUMN sj_retry.retry_status IS '重试状态 0、重试中 1、成功 2、最大重试次数';
@@ -287,6 +298,8 @@ CREATE TABLE sj_retry_scene_config
cb_trigger_type smallint NOT NULL DEFAULT 1,
cb_max_count int NOT NULL DEFAULT 16,
cb_trigger_interval varchar(16) NOT NULL DEFAULT '',
owner_id bigint NULL DEFAULT NULL,
labels varchar(512) NULL DEFAULT '',
description varchar(256) NOT NULL DEFAULT '',
create_dt timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
update_dt timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP
@@ -311,6 +324,8 @@ COMMENT ON COLUMN sj_retry_scene_config.cb_status IS '回调状态 0、不开启
COMMENT ON COLUMN sj_retry_scene_config.cb_trigger_type IS '1、默认等级 2、固定间隔时间 3、CRON 表达式';
COMMENT ON COLUMN sj_retry_scene_config.cb_max_count IS '回调的最大执行次数';
COMMENT ON COLUMN sj_retry_scene_config.cb_trigger_interval IS '回调的最大执行次数';
COMMENT ON COLUMN sj_retry_scene_config.owner_id IS '负责人id';
COMMENT ON COLUMN sj_retry_scene_config.labels IS '标签';
COMMENT ON COLUMN sj_retry_scene_config.description IS '描述';
COMMENT ON COLUMN sj_retry_scene_config.create_dt IS '创建时间';
COMMENT ON COLUMN sj_retry_scene_config.update_dt IS '修改时间';
@@ -328,6 +343,7 @@ CREATE TABLE sj_server_node
expire_at timestamp NOT NULL,
node_type smallint NOT NULL,
ext_attrs varchar(256) NULL DEFAULT '',
labels varchar(512) NULL DEFAULT '',
create_dt timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
update_dt timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP
);
@@ -346,6 +362,7 @@ COMMENT ON COLUMN sj_server_node.host_port IS '机器端口';
COMMENT ON COLUMN sj_server_node.expire_at IS '过期时间';
COMMENT ON COLUMN sj_server_node.node_type IS '节点类型 1、客户端 2、是服务端';
COMMENT ON COLUMN sj_server_node.ext_attrs IS '扩展字段';
COMMENT ON COLUMN sj_server_node.labels IS '标签';
COMMENT ON COLUMN sj_server_node.create_dt IS '创建时间';
COMMENT ON COLUMN sj_server_node.update_dt IS '修改时间';
COMMENT ON TABLE sj_server_node IS '服务器节点';
@@ -353,7 +370,7 @@ COMMENT ON TABLE sj_server_node IS '服务器节点';
-- sj_distributed_lock
CREATE TABLE sj_distributed_lock
(
name varchar(64) NOT NULL,
name varchar(64) NOT NULL PRIMARY KEY,
lock_until timestamp(3) NOT NULL DEFAULT CURRENT_TIMESTAMP(3),
locked_at timestamp(3) NOT NULL DEFAULT CURRENT_TIMESTAMP(3),
locked_by varchar(255) NOT NULL,
@@ -409,27 +426,6 @@ COMMENT ON COLUMN sj_system_user_permission.create_dt IS '创建时间';
COMMENT ON COLUMN sj_system_user_permission.update_dt IS '修改时间';
COMMENT ON TABLE sj_system_user_permission IS '系统用户权限表';
-- sj_sequence_alloc
CREATE TABLE sj_sequence_alloc
(
id bigserial PRIMARY KEY,
namespace_id varchar(64) NOT NULL DEFAULT '764d604ec6fc45f68cd92514c40e9e1a',
group_name varchar(64) NOT NULL DEFAULT '',
max_id bigint NOT NULL DEFAULT 1,
step int NOT NULL DEFAULT 100,
update_dt timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP
);
CREATE UNIQUE INDEX uk_sj_sequence_alloc_01 ON sj_sequence_alloc (namespace_id, group_name);
COMMENT ON COLUMN sj_sequence_alloc.id IS '主键';
COMMENT ON COLUMN sj_sequence_alloc.namespace_id IS '命名空间id';
COMMENT ON COLUMN sj_sequence_alloc.group_name IS '组名称';
COMMENT ON COLUMN sj_sequence_alloc.max_id IS '最大id';
COMMENT ON COLUMN sj_sequence_alloc.step IS '步长';
COMMENT ON COLUMN sj_sequence_alloc.update_dt IS '更新时间';
COMMENT ON TABLE sj_sequence_alloc IS '号段模式序号ID分配表';
-- sj_job
CREATE TABLE sj_job
(
@@ -455,7 +451,8 @@ CREATE TABLE sj_job
bucket_index int NOT NULL DEFAULT 0,
resident smallint NOT NULL DEFAULT 0,
notify_ids varchar(128) NOT NULL DEFAULT '',
owner_id bigint NULL,
owner_id bigint NULL DEFAULT NULL,
labels varchar(512) NULL DEFAULT '',
description varchar(256) NOT NULL DEFAULT '',
ext_attrs varchar(256) NULL DEFAULT '',
deleted smallint NOT NULL DEFAULT 0,
@@ -490,6 +487,7 @@ COMMENT ON COLUMN sj_job.bucket_index IS 'bucket';
COMMENT ON COLUMN sj_job.resident IS '是否是常驻任务';
COMMENT ON COLUMN sj_job.notify_ids IS '通知告警场景配置id列表';
COMMENT ON COLUMN sj_job.owner_id IS '负责人id';
COMMENT ON COLUMN sj_job.labels IS '标签';
COMMENT ON COLUMN sj_job.description IS '描述';
COMMENT ON COLUMN sj_job.ext_attrs IS '扩展字段';
COMMENT ON COLUMN sj_job.deleted IS '逻辑删除 1、删除';
@@ -716,6 +714,7 @@ CREATE TABLE sj_workflow
notify_ids varchar(128) NOT NULL DEFAULT '',
bucket_index int NOT NULL DEFAULT 0,
version int NOT NULL,
owner_id bigint NULL DEFAULT NULL,
ext_attrs varchar(256) NULL DEFAULT '',
deleted smallint NOT NULL DEFAULT 0,
create_dt timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
@@ -741,6 +740,7 @@ COMMENT ON COLUMN sj_workflow.wf_context IS '上下文';
COMMENT ON COLUMN sj_workflow.notify_ids IS '通知告警场景配置id列表';
COMMENT ON COLUMN sj_workflow.bucket_index IS 'bucket';
COMMENT ON COLUMN sj_workflow.version IS '版本号';
COMMENT ON COLUMN sj_workflow.owner_id IS '负责人id';
COMMENT ON COLUMN sj_workflow.ext_attrs IS '扩展字段';
COMMENT ON COLUMN sj_workflow.deleted IS '逻辑删除 1、删除';
COMMENT ON COLUMN sj_workflow.create_dt IS '创建时间';
@@ -828,4 +828,28 @@ COMMENT ON COLUMN sj_workflow_task_batch.version IS '版本号';
COMMENT ON COLUMN sj_workflow_task_batch.deleted IS '逻辑删除 1、删除';
COMMENT ON COLUMN sj_workflow_task_batch.create_dt IS '创建时间';
COMMENT ON COLUMN sj_workflow_task_batch.update_dt IS '修改时间';
COMMENT ON TABLE sj_workflow_task_batch IS '工作流批次';
COMMENT ON TABLE sj_workflow_task_batch IS '工作流批次';
-- sj_job_executor
CREATE TABLE sj_job_executor
(
id bigserial PRIMARY KEY,
namespace_id varchar(64) NOT NULL DEFAULT '764d604ec6fc45f68cd92514c40e9e1a',
group_name varchar(64) NOT NULL,
executor_info varchar(256) NOT NULL,
executor_type varchar(3) NOT NULL,
create_dt timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
update_dt timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP
);
CREATE INDEX idx_sj_job_executor_01 ON sj_job_executor (namespace_id, group_name);
CREATE INDEX idx_sj_job_executor_02 ON sj_job_executor (create_dt);
COMMENT ON COLUMN sj_job_executor.id IS '主键';
COMMENT ON COLUMN sj_job_executor.namespace_id IS '命名空间id';
COMMENT ON COLUMN sj_job_executor.group_name IS '组名称';
COMMENT ON COLUMN sj_job_executor.executor_info IS '任务执行器名称';
COMMENT ON COLUMN sj_job_executor.executor_type IS '1:java 2:python 3:go';
COMMENT ON COLUMN sj_job_executor.create_dt IS '创建时间';
COMMENT ON COLUMN sj_job_executor.update_dt IS '修改时间';
COMMENT ON TABLE sj_job_executor IS '任务执行器信息';

View File

@@ -2,7 +2,7 @@
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>top.continew</groupId>
<groupId>top.continew.admin</groupId>
<artifactId>continew-admin</artifactId>
<version>${revision}</version>
</parent>

View File

@@ -4,7 +4,7 @@
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>top.continew</groupId>
<groupId>top.continew.admin</groupId>
<artifactId>continew-plugin</artifactId>
<version>${revision}</version>
</parent>
@@ -18,7 +18,7 @@
<dependencies>
<!-- 系统管理模块 -->
<dependency>
<groupId>top.continew</groupId>
<groupId>top.continew.admin</groupId>
<artifactId>continew-system</artifactId>
</dependency>
</dependencies>

View File

@@ -21,7 +21,7 @@ import cn.hutool.core.map.MapUtil;
import lombok.Data;
import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.stereotype.Component;
import top.continew.starter.data.core.enums.DatabaseType;
import top.continew.starter.data.enums.DatabaseType;
import java.util.List;
import java.util.Map;

View File

@@ -22,8 +22,8 @@ import io.swagger.v3.oas.annotations.Parameter;
import io.swagger.v3.oas.annotations.enums.ParameterIn;
import io.swagger.v3.oas.annotations.tags.Tag;
import jakarta.servlet.http.HttpServletResponse;
import jakarta.validation.Valid;
import lombok.RequiredArgsConstructor;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;
import top.continew.admin.generator.model.entity.FieldConfigDO;
import top.continew.admin.generator.model.entity.GenConfigDO;
@@ -46,7 +46,6 @@ import java.util.List;
* @since 2023/8/3 22:58
*/
@Tag(name = "代码生成 API")
@Validated
@RestController
@RequiredArgsConstructor
@RequestMapping("/code/generator")
@@ -58,7 +57,7 @@ public class GeneratorController {
@Operation(summary = "分页查询生成配置", description = "分页查询生成配置列表")
@SaCheckPermission("code:generator:list")
@GetMapping("/config")
public PageResp<GenConfigDO> pageGenConfig(GenConfigQuery query, @Validated PageQuery pageQuery) {
public PageResp<GenConfigDO> pageGenConfig(@Valid GenConfigQuery query, @Valid PageQuery pageQuery) {
return baseService.pageGenConfig(query, pageQuery);
}
@@ -84,7 +83,7 @@ public class GeneratorController {
@Parameter(name = "tableName", description = "表名称", required = true, example = "sys_user", in = ParameterIn.PATH)
@SaCheckPermission("code:generator:config")
@PostMapping("/config/{tableName}")
public void saveConfig(@Validated @RequestBody GenConfigReq req, @PathVariable String tableName) {
public void saveConfig(@RequestBody @Valid GenConfigReq req, @PathVariable String tableName) {
baseService.saveConfig(req, tableName);
}

View File

@@ -20,7 +20,7 @@ import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;
import top.continew.admin.generator.model.entity.FieldConfigDO;
import top.continew.starter.data.mp.base.BaseMapper;
import top.continew.starter.data.mapper.BaseMapper;
import java.util.List;

View File

@@ -18,7 +18,7 @@ package top.continew.admin.generator.mapper;
import org.apache.ibatis.annotations.Mapper;
import top.continew.admin.generator.model.entity.GenConfigDO;
import top.continew.starter.data.mp.base.BaseMapper;
import top.continew.starter.data.mapper.BaseMapper;
/**
* 生成配置 Mapper

View File

@@ -53,13 +53,13 @@ import top.continew.admin.generator.model.query.GenConfigQuery;
import top.continew.admin.generator.model.req.GenConfigReq;
import top.continew.admin.generator.model.resp.GeneratePreviewResp;
import top.continew.admin.generator.service.GeneratorService;
import top.continew.starter.core.autoconfigure.project.ProjectProperties;
import top.continew.starter.core.autoconfigure.application.ApplicationProperties;
import top.continew.starter.core.constant.StringConstants;
import top.continew.starter.core.enums.BaseEnum;
import top.continew.starter.core.exception.BusinessException;
import top.continew.starter.core.validation.CheckUtils;
import top.continew.starter.data.core.enums.DatabaseType;
import top.continew.starter.data.core.util.MetaUtils;
import top.continew.starter.core.util.validation.CheckUtils;
import top.continew.starter.data.enums.DatabaseType;
import top.continew.starter.data.util.MetaUtils;
import top.continew.starter.extension.crud.model.query.PageQuery;
import top.continew.starter.extension.crud.model.resp.PageResp;
import top.continew.starter.core.util.FileUploadUtils;
@@ -84,7 +84,7 @@ public class GeneratorServiceImpl implements GeneratorService {
private final DataSource dataSource;
private final GeneratorProperties generatorProperties;
private final ProjectProperties projectProperties;
private final ApplicationProperties applicationProperties;
private final FieldConfigMapper fieldConfigMapper;
private final GenConfigMapper genConfigMapper;
private static final List<String> TIME_PACKAGE_CLASS = Arrays.asList("LocalDate", "LocalTime", "LocalDateTime");
@@ -235,7 +235,7 @@ public class GeneratorServiceImpl implements GeneratorService {
try {
String tempDir = SystemUtil.getUserInfo().getTempDir();
// 删除旧代码
FileUtil.del(tempDir + projectProperties.getAppName());
FileUtil.del(tempDir + applicationProperties.getId());
tableNames.forEach(tableName -> {
// 初始化配置及数据
List<GeneratePreviewResp> generatePreviewList = this.preview(tableName);
@@ -243,7 +243,7 @@ public class GeneratorServiceImpl implements GeneratorService {
this.generateCode(generatePreviewList, genConfigMapper.selectById(tableName));
});
// 打包下载
File tempDirFile = new File(tempDir, projectProperties.getAppName());
File tempDirFile = new File(tempDir, applicationProperties.getId());
String zipFilePath = tempDirFile.getPath() + jodd.io.ZipUtil.ZIP_EXT;
ZipUtil.zip(tempDirFile.getPath(), zipFilePath);
FileUploadUtils.download(response, new File(zipFilePath));
@@ -358,7 +358,7 @@ public class GeneratorServiceImpl implements GeneratorService {
if (StringUtils.isBlank(dictCode)) {
return fieldConfig;
}
Set<Class<?>> classSet = ClassUtil.scanPackageBySuper(projectProperties.getBasePackage(), BaseEnum.class);
Set<Class<?>> classSet = ClassUtil.scanPackageBySuper(applicationProperties.getBasePackage(), BaseEnum.class);
Optional<Class<?>> clazzOptional = classSet.stream()
.filter(s -> StrUtil.toUnderlineCase(s.getSimpleName()).toLowerCase().equals(dictCode))
.findFirst();
@@ -383,8 +383,8 @@ public class GeneratorServiceImpl implements GeneratorService {
GeneratorProperties.TemplateConfig templateConfig) {
// 获取前后端基础路径
String backendBasicPackagePath = this.buildBackendBasicPackagePath(genConfig, templateConfig);
String frontendBasicPackagePath = String.join(File.separator, projectProperties.getAppName(), projectProperties
.getAppName() + "-ui");
String frontendBasicPackagePath = String.join(File.separator, applicationProperties
.getId(), applicationProperties.getId() + "-ui");
String packagePath;
if (generatePreview.isBackend()) {
// 例如continew-admin/continew-system/src/main/java/top/continew/admin/system/service/impl
@@ -432,7 +432,7 @@ public class GeneratorServiceImpl implements GeneratorService {
GeneratorProperties.TemplateConfig templateConfig) {
String extension = templateConfig.getExtension();
// 例如continew-admin/continew-system/src/main/java/top/continew/admin/system
return String.join(File.separator, projectProperties.getAppName(), projectProperties.getAppName(), genConfig
return String.join(File.separator, applicationProperties.getId(), applicationProperties.getId(), genConfig
.getModuleName(), "src", "main", FileNameUtil.EXT_JAVA.equals(extension)
? "java"
: "resources") + (FileNameUtil.EXT_JAVA.equals(extension)

View File

@@ -7,7 +7,7 @@ import io.swagger.v3.oas.annotations.tags.Tag;
import org.springframework.web.bind.annotation.*;
import top.continew.starter.extension.crud.annotation.CrudRequestMapping;
import top.continew.admin.common.controller.BaseController;
import top.continew.admin.common.base.controller.BaseController;
import ${packageName}.model.query.${classNamePrefix}Query;
import ${packageName}.model.req.${classNamePrefix}Req;
import ${packageName}.model.resp.${classNamePrefix}DetailResp;

View File

@@ -4,11 +4,11 @@ import lombok.Data;
import io.swagger.v3.oas.annotations.media.Schema;
import com.alibaba.excel.annotation.ExcelIgnoreUnannotated;
import com.alibaba.excel.annotation.ExcelProperty;
import cn.idev.excel.annotation.ExcelIgnoreUnannotated;
import cn.idev.excel.annotation.ExcelProperty;
import top.continew.admin.common.model.resp.BaseDetailResp;
import top.continew.starter.file.excel.converter.ExcelBaseEnumConverter;
import top.continew.starter.excel.converter.ExcelBaseEnumConverter;
<#if imports??>
<#list imports as className>
import ${className};

View File

@@ -2,7 +2,7 @@ package ${packageName}.${subPackageName};
import org.apache.ibatis.annotations.Mapper;
import ${packageName}.model.entity.${classNamePrefix}DO;
import top.continew.starter.data.mp.base.BaseMapper;
import top.continew.starter.data.mapper.BaseMapper;
/**
* ${businessName} Mapper

View File

@@ -4,8 +4,8 @@ import lombok.Data;
import io.swagger.v3.oas.annotations.media.Schema;
import top.continew.starter.data.core.annotation.Query;
import top.continew.starter.data.core.enums.QueryType;
import top.continew.starter.data.annotation.Query;
import top.continew.starter.data.enums.QueryType;
<#if imports??>
<#list imports as className>
import ${className};

View File

@@ -1,10 +1,12 @@
package ${packageName}.${subPackageName};
import top.continew.starter.extension.crud.service.BaseService;
import top.continew.admin.common.base.service.BaseService;
import ${packageName}.model.entity.${classNamePrefix}DO;
import ${packageName}.model.query.${classNamePrefix}Query;
import ${packageName}.model.req.${classNamePrefix}Req;
import ${packageName}.model.resp.${classNamePrefix}DetailResp;
import ${packageName}.model.resp.${classNamePrefix}Resp;
import top.continew.starter.data.service.IService;
/**
* ${businessName}业务接口
@@ -12,4 +14,4 @@ import ${packageName}.model.resp.${classNamePrefix}Resp;
* @author ${author}
* @since ${datetime}
*/
public interface ${className} extends BaseService<${classNamePrefix}Resp, ${classNamePrefix}DetailResp, ${classNamePrefix}Query, ${classNamePrefix}Req> {}
public interface ${className} extends BaseService<${classNamePrefix}Resp, ${classNamePrefix}DetailResp, ${classNamePrefix}Query, ${classNamePrefix}Req>, IService<${classNamePrefix}DO> {}

View File

@@ -4,7 +4,7 @@ import lombok.RequiredArgsConstructor;
import org.springframework.stereotype.Service;
import top.continew.starter.extension.crud.service.BaseServiceImpl;
import top.continew.admin.common.base.service.BaseServiceImpl;
import ${packageName}.mapper.${classNamePrefix}Mapper;
import ${packageName}.model.entity.${classNamePrefix}DO;
import ${packageName}.model.query.${classNamePrefix}Query;

View File

@@ -4,7 +4,7 @@
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>top.continew</groupId>
<groupId>top.continew.admin</groupId>
<artifactId>continew-plugin</artifactId>
<version>${revision}</version>
</parent>

View File

@@ -26,7 +26,7 @@ import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PatchMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RestController;
import top.continew.admin.common.controller.BaseController;
import top.continew.admin.common.base.controller.BaseController;
import top.continew.admin.open.model.query.AppQuery;
import top.continew.admin.open.model.req.AppReq;
import top.continew.admin.open.model.resp.AppDetailResp;

View File

@@ -21,7 +21,7 @@ import cn.dev33.satoken.annotation.handler.SaAnnotationHandlerInterface;
import org.springframework.stereotype.Component;
import top.continew.admin.open.util.OpenApiUtils;
import java.lang.reflect.Method;
import java.lang.reflect.AnnotatedElement;
import static cn.dev33.satoken.annotation.handler.SaCheckPermissionHandler._checkMethod;
@@ -40,9 +40,10 @@ public class SaCheckPermissionHandler implements SaAnnotationHandlerInterface<Sa
}
@Override
public void checkMethod(SaCheckPermission at, Method method) {
public void checkMethod(SaCheckPermission saCheckPermission, AnnotatedElement annotatedElement) {
if (!OpenApiUtils.isSignParamExists()) {
_checkMethod(at.type(), at.value(), at.mode(), at.orRole());
_checkMethod(saCheckPermission.type(), saCheckPermission.value(), saCheckPermission
.mode(), saCheckPermission.orRole());
}
}
}

View File

@@ -20,7 +20,7 @@ import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;
import top.continew.admin.open.model.entity.AppDO;
import top.continew.starter.data.mp.base.BaseMapper;
import top.continew.starter.data.mapper.BaseMapper;
import top.continew.starter.security.crypto.annotation.FieldEncrypt;
/**

View File

@@ -19,7 +19,7 @@ package top.continew.admin.open.model.entity;
import com.baomidou.mybatisplus.annotation.TableName;
import lombok.Data;
import top.continew.admin.common.enums.DisEnableStatusEnum;
import top.continew.admin.common.model.entity.BaseDO;
import top.continew.admin.common.base.model.entity.BaseDO;
import top.continew.starter.security.crypto.annotation.FieldEncrypt;
import java.io.Serial;

View File

@@ -18,8 +18,8 @@ package top.continew.admin.open.model.query;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
import top.continew.starter.data.core.annotation.Query;
import top.continew.starter.data.core.enums.QueryType;
import top.continew.starter.data.annotation.Query;
import top.continew.starter.data.enums.QueryType;
import java.io.Serial;
import java.io.Serializable;

View File

@@ -16,13 +16,13 @@
package top.continew.admin.open.model.resp;
import com.alibaba.excel.annotation.ExcelIgnoreUnannotated;
import com.alibaba.excel.annotation.ExcelProperty;
import cn.idev.excel.annotation.ExcelIgnoreUnannotated;
import cn.idev.excel.annotation.ExcelProperty;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
import top.continew.admin.common.model.resp.BaseDetailResp;
import top.continew.admin.common.base.model.resp.BaseDetailResp;
import top.continew.admin.common.enums.DisEnableStatusEnum;
import top.continew.starter.file.excel.converter.ExcelBaseEnumConverter;
import top.continew.starter.excel.converter.ExcelBaseEnumConverter;
import java.io.Serial;
import java.time.LocalDateTime;

View File

@@ -18,7 +18,7 @@ package top.continew.admin.open.model.resp;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
import top.continew.admin.common.model.resp.BaseDetailResp;
import top.continew.admin.common.base.model.resp.BaseDetailResp;
import top.continew.admin.common.enums.DisEnableStatusEnum;
import java.io.Serial;

View File

@@ -16,13 +16,13 @@
package top.continew.admin.open.service;
import top.continew.admin.common.base.service.BaseService;
import top.continew.admin.open.model.entity.AppDO;
import top.continew.admin.open.model.query.AppQuery;
import top.continew.admin.open.model.req.AppReq;
import top.continew.admin.open.model.resp.AppDetailResp;
import top.continew.admin.open.model.resp.AppResp;
import top.continew.admin.open.model.resp.AppSecretResp;
import top.continew.starter.extension.crud.service.BaseService;
/**
* 应用业务接口

View File

@@ -19,8 +19,8 @@ package top.continew.admin.open.service.impl;
import cn.hutool.core.codec.Base64;
import cn.hutool.core.util.IdUtil;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import lombok.RequiredArgsConstructor;
import org.springframework.stereotype.Service;
import top.continew.admin.common.base.service.BaseServiceImpl;
import top.continew.admin.open.mapper.AppMapper;
import top.continew.admin.open.model.entity.AppDO;
import top.continew.admin.open.model.query.AppQuery;
@@ -30,7 +30,6 @@ import top.continew.admin.open.model.resp.AppResp;
import top.continew.admin.open.model.resp.AppSecretResp;
import top.continew.admin.open.service.AppService;
import top.continew.starter.core.constant.StringConstants;
import top.continew.starter.extension.crud.service.BaseServiceImpl;
/**
* 应用业务实现
@@ -40,7 +39,6 @@ import top.continew.starter.extension.crud.service.BaseServiceImpl;
* @since 2024/10/17 16:03
*/
@Service
@RequiredArgsConstructor
public class AppServiceImpl extends BaseServiceImpl<AppMapper, AppDO, AppResp, AppDetailResp, AppQuery, AppReq> implements AppService {
@Override

View File

@@ -17,13 +17,13 @@
package top.continew.admin.open.sign;
import cn.dev33.satoken.secure.SaSecureUtil;
import cn.dev33.satoken.sign.SaSignTemplate;
import cn.dev33.satoken.sign.template.SaSignTemplate;
import lombok.RequiredArgsConstructor;
import org.springframework.stereotype.Component;
import top.continew.admin.common.enums.DisEnableStatusEnum;
import top.continew.admin.open.model.entity.AppDO;
import top.continew.admin.open.service.AppService;
import top.continew.starter.core.validation.ValidationUtils;
import top.continew.starter.core.util.validation.ValidationUtils;
import java.util.Map;

View File

@@ -18,7 +18,7 @@ package top.continew.admin.open.util;
import cn.dev33.satoken.context.SaHolder;
import cn.dev33.satoken.context.model.SaRequest;
import cn.dev33.satoken.sign.SaSignTemplate;
import cn.dev33.satoken.sign.template.SaSignTemplate;
import java.util.Collection;

View File

@@ -2,7 +2,7 @@
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>top.continew</groupId>
<groupId>top.continew.admin</groupId>
<artifactId>continew-plugin</artifactId>
<version>${revision}</version>
</parent>

View File

@@ -22,7 +22,7 @@ import org.springframework.beans.factory.annotation.Value;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import top.continew.admin.schedule.api.JobClient;
import top.continew.starter.core.autoconfigure.project.ProjectProperties;
import top.continew.starter.core.autoconfigure.application.ApplicationProperties;
/**
* Feign 配置
@@ -34,7 +34,7 @@ import top.continew.starter.core.autoconfigure.project.ProjectProperties;
@RequiredArgsConstructor
public class FeignConfiguration {
private final ProjectProperties projectProperties;
private final ApplicationProperties applicationProperties;
@Value("${snail-job.server.api.url}")
private String baseUrl;
@@ -58,6 +58,6 @@ public class FeignConfiguration {
*/
@Bean
public Logger.Level feignLoggerLevel() {
return projectProperties.isProduction() ? Logger.Level.BASIC : Logger.Level.FULL;
return applicationProperties.isProduction() ? Logger.Level.BASIC : Logger.Level.FULL;
}
}

View File

@@ -21,6 +21,7 @@ import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.Parameter;
import io.swagger.v3.oas.annotations.enums.ParameterIn;
import io.swagger.v3.oas.annotations.tags.Tag;
import jakarta.validation.Valid;
import lombok.RequiredArgsConstructor;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;
@@ -44,7 +45,6 @@ import java.util.List;
* @since 2024/6/25 22:24
*/
@Tag(name = " 任务 API")
@Validated
@RestController
@RequiredArgsConstructor
@RequestMapping("/schedule/job")
@@ -62,7 +62,8 @@ public class JobController {
@Operation(summary = "新增任务", description = "新增任务")
@SaCheckPermission("schedule:job:create")
@PostMapping
public void create(@Validated(CrudValidationGroup.Create.class) @RequestBody JobReq req) {
@Validated(CrudValidationGroup.Create.class)
public void create(@RequestBody @Valid JobReq req) {
baseService.create(req);
}
@@ -70,14 +71,15 @@ public class JobController {
@Parameter(name = "id", description = "ID", example = "1", in = ParameterIn.PATH)
@SaCheckPermission("schedule:job:update")
@PutMapping("/{id}")
public void update(@Validated(CrudValidationGroup.Update.class) @RequestBody JobReq req, @PathVariable Long id) {
@Validated(CrudValidationGroup.Update.class)
public void update(@RequestBody @Valid JobReq req, @PathVariable Long id) {
baseService.update(req, id);
}
@Operation(summary = "修改任务状态", description = "修改任务状态")
@SaCheckPermission("schedule:job:update")
@PatchMapping("/{id}/status")
public void updateStatus(@Validated @RequestBody JobStatusReq req, @PathVariable Long id) {
public void updateStatus(@RequestBody @Valid JobStatusReq req, @PathVariable Long id) {
baseService.updateStatus(req, id);
}

View File

@@ -21,8 +21,8 @@ import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.Parameter;
import io.swagger.v3.oas.annotations.enums.ParameterIn;
import io.swagger.v3.oas.annotations.tags.Tag;
import jakarta.validation.Valid;
import lombok.RequiredArgsConstructor;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;
import top.continew.admin.schedule.model.JobInstanceLogPageResult;
import top.continew.admin.schedule.model.query.JobInstanceLogQuery;
@@ -43,7 +43,6 @@ import java.util.List;
* @since 2024/6/27 22:24
*/
@Tag(name = " 任务日志 API")
@Validated
@RestController
@RequiredArgsConstructor
@RequestMapping("/schedule/log")
@@ -54,7 +53,7 @@ public class JobLogController {
@Operation(summary = "分页查询任务日志列表", description = "分页查询任务日志列表")
@SaCheckPermission("schedule:log:list")
@GetMapping
public PageResp<JobLogResp> page(JobLogQuery query) {
public PageResp<JobLogResp> page(@Valid JobLogQuery query) {
return baseService.page(query);
}
@@ -77,14 +76,14 @@ public class JobLogController {
@Operation(summary = "查询任务实例列表", description = "查询任务实例列表")
@SaCheckPermission("schedule:log:list")
@GetMapping("/instance")
public List<JobInstanceResp> listInstance(JobInstanceQuery query) {
public List<JobInstanceResp> listInstance(@Valid JobInstanceQuery query) {
return baseService.listInstance(query);
}
@Operation(summary = "分页查询任务实例日志列表", description = "分页查询任务实例日志列表")
@SaCheckPermission("schedule:log:list")
@GetMapping("/instance/log")
public JobInstanceLogPageResult pageInstanceLog(JobInstanceLogQuery query) {
public JobInstanceLogPageResult pageInstanceLog(@Valid JobInstanceLogQuery query) {
return baseService.pageInstanceLog(query);
}
}

View File

@@ -20,7 +20,7 @@ import io.swagger.v3.oas.annotations.media.Schema;
import jakarta.validation.constraints.Size;
import lombok.Data;
import top.continew.admin.schedule.enums.JobExecuteStatusEnum;
import top.continew.starter.core.validation.constraints.EnumValue;
import top.continew.starter.validation.constraints.EnumValue;
import java.io.Serial;
import java.time.LocalDateTime;

View File

@@ -19,7 +19,7 @@ package top.continew.admin.schedule.model.query;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
import top.continew.admin.schedule.enums.JobStatusEnum;
import top.continew.starter.core.validation.constraints.EnumValue;
import top.continew.starter.validation.constraints.EnumValue;
import java.io.Serial;

View File

@@ -4,7 +4,7 @@
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>top.continew</groupId>
<groupId>top.continew.admin</groupId>
<artifactId>continew-admin</artifactId>
<version>${revision}</version>
</parent>
@@ -24,7 +24,7 @@
<dependencies>
<!-- 公共模块 -->
<dependency>
<groupId>top.continew</groupId>
<groupId>top.continew.admin</groupId>
<artifactId>continew-common</artifactId>
</dependency>
</dependencies>

View File

@@ -4,7 +4,7 @@
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>top.continew</groupId>
<groupId>top.continew.admin</groupId>
<artifactId>continew-admin</artifactId>
<version>${revision}</version>
</parent>
@@ -30,31 +30,31 @@
<dependencies>
<!-- 系统管理模块 -->
<dependency>
<groupId>top.continew</groupId>
<groupId>top.continew.admin</groupId>
<artifactId>continew-system</artifactId>
</dependency>
<!-- 任务调度插件 -->
<dependency>
<groupId>top.continew</groupId>
<groupId>top.continew.admin</groupId>
<artifactId>continew-plugin-schedule</artifactId>
</dependency>
<!-- 能力开放插件 -->
<dependency>
<groupId>top.continew</groupId>
<groupId>top.continew.admin</groupId>
<artifactId>continew-plugin-open</artifactId>
</dependency>
<!-- 代码生成器插件 -->
<dependency>
<groupId>top.continew</groupId>
<groupId>top.continew.admin</groupId>
<artifactId>continew-plugin-generator</artifactId>
</dependency>
<!-- ContiNew Starter 链路追踪模块 -->
<dependency>
<groupId>top.continew</groupId>
<groupId>top.continew.starter</groupId>
<artifactId>continew-starter-trace</artifactId>
</dependency>

View File

@@ -29,12 +29,13 @@ import org.dromara.x.file.storage.spring.EnableFileStorage;
import org.springframework.boot.ApplicationArguments;
import org.springframework.boot.ApplicationRunner;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.SpringBootVersion;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.boot.autoconfigure.web.ServerProperties;
import org.springframework.cloud.openfeign.EnableFeignClients;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RestController;
import top.continew.starter.core.autoconfigure.project.ProjectProperties;
import top.continew.starter.core.autoconfigure.application.ApplicationProperties;
import top.continew.starter.extension.crud.annotation.EnableCrudRestController;
import top.continew.starter.web.annotation.EnableGlobalResponse;
import top.continew.starter.web.model.R;
@@ -56,7 +57,7 @@ import top.continew.starter.web.model.R;
@RequiredArgsConstructor
public class ContiNewAdminApplication implements ApplicationRunner {
private final ProjectProperties projectProperties;
private final ApplicationProperties applicationProperties;
private final ServerProperties serverProperties;
public static void main(String[] args) {
@@ -67,7 +68,7 @@ public class ContiNewAdminApplication implements ApplicationRunner {
@SaIgnore
@GetMapping("/")
public R index() {
return R.ok(projectProperties);
return R.ok(applicationProperties);
}
@Override
@@ -76,18 +77,19 @@ public class ContiNewAdminApplication implements ApplicationRunner {
Integer port = serverProperties.getPort();
String contextPath = serverProperties.getServlet().getContextPath();
String baseUrl = URLUtil.normalize("%s:%s%s".formatted(hostAddress, port, contextPath));
log.info("----------------------------------------------");
log.info("{} service started successfully.", projectProperties.getName());
log.info("Profile: {}", SpringUtil.getProperty("spring.profiles.active"));
log.info("项目版本: v{} (ContiNew Starter: v{})", projectProperties.getVersion(), SpringUtil
.getProperty("project.starter"));
log.info("API 地址: {}", baseUrl);
log.info("-----------------------------------------------------");
log.info("{} server started successfully.", applicationProperties.getName());
log.info("ContiNew Starter: v{} (Spring Boot: v{})", SpringUtil
.getProperty("application.starter"), SpringBootVersion.getVersion());
log.info("当前版本: v{} (Profile: {})", applicationProperties.getVersion(), SpringUtil
.getProperty("spring.profiles.active"));
log.info("服务地址: {}", baseUrl);
Knife4jProperties knife4jProperties = SpringUtil.getBean(Knife4jProperties.class);
if (!knife4jProperties.isProduction()) {
log.info("API 文档: {}/doc.html", baseUrl);
log.info("接口文档: {}/doc.html", baseUrl);
}
log.info("在线文档: https://continew.top");
log.info("常见问题: https://continew.top/admin/faq.html");
log.info("----------------------------------------------");
log.info("-----------------------------------------------------");
}
}

View File

@@ -16,14 +16,14 @@
package top.continew.admin.config.satoken;
import cn.dev33.satoken.SaManager;
import cn.dev33.satoken.annotation.SaIgnore;
import cn.dev33.satoken.context.SaHolder;
import cn.dev33.satoken.context.model.SaRequest;
import cn.dev33.satoken.interceptor.SaInterceptor;
import cn.dev33.satoken.router.SaRouter;
import cn.dev33.satoken.sign.SaSignTemplate;
import cn.dev33.satoken.sign.SaSignUtil;
import cn.dev33.satoken.sign.SaSignManager;
import cn.dev33.satoken.sign.template.SaSignTemplate;
import cn.dev33.satoken.sign.template.SaSignUtil;
import cn.dev33.satoken.stp.StpInterface;
import cn.dev33.satoken.stp.StpUtil;
import lombok.RequiredArgsConstructor;
@@ -41,7 +41,7 @@ import top.continew.admin.open.sign.OpenApiSignTemplate;
import top.continew.starter.auth.satoken.autoconfigure.SaTokenExtensionProperties;
import top.continew.starter.core.constant.StringConstants;
import top.continew.starter.core.exception.BusinessException;
import top.continew.starter.core.validation.CheckUtils;
import top.continew.starter.core.util.validation.CheckUtils;
import top.continew.starter.extension.crud.annotation.CrudRequestMapping;
import java.util.*;
@@ -75,7 +75,7 @@ public class SaTokenConfiguration {
*/
@Bean
public SaInterceptor saInterceptor() {
SaManager.setSaSignTemplate(signTemplate);
SaSignManager.setSaSignTemplate(signTemplate);
return new SaExtensionInterceptor(handle -> SaRouter.match(StringConstants.PATH_PATTERN)
.notMatch(properties.getSecurity().getExcludes())
.check(r -> {
@@ -101,7 +101,7 @@ public class SaTokenConfiguration {
}
/**
* 配置 sa-token SaIgnore 注解排除路径
* 配置 sa-token {@link SaIgnore} 注解排除路径
* <p>主要针对 @CrudRequestMapping 注解</p>
*/
@EventListener(ApplicationReadyEvent.class)
@@ -113,11 +113,11 @@ public class SaTokenConfiguration {
if (AopUtils.isAopProxy(bean)) {
clazz = AopProxyUtils.ultimateTargetClass(bean);
}
// 使用 @CrudRequestMapping 的 Controller如果使用了 @SaIgnore 注解,则表示忽略校验
CrudRequestMapping crudRequestMapping = AnnotationUtils.findAnnotation(clazz, CrudRequestMapping.class);
SaIgnore saIgnore = AnnotationUtils.findAnnotation(clazz, SaIgnore.class);
if (crudRequestMapping != null && saIgnore != null) {
return crudRequestMapping.value() + "/**";
return crudRequestMapping.value() + StringConstants.PATH_PATTERN;
}
return null;
}).filter(Objects::nonNull).toList();

View File

@@ -52,16 +52,16 @@ import top.continew.admin.system.service.OptionService;
import top.continew.admin.system.service.SmsConfigService;
import top.continew.starter.cache.redisson.util.RedisUtils;
import top.continew.starter.captcha.graphic.core.GraphicCaptchaService;
import top.continew.starter.core.autoconfigure.project.ProjectProperties;
import top.continew.starter.core.autoconfigure.application.ApplicationProperties;
import top.continew.starter.core.util.TemplateUtils;
import top.continew.starter.core.validation.CheckUtils;
import top.continew.starter.core.validation.ValidationUtils;
import top.continew.starter.core.validation.constraints.Mobile;
import top.continew.starter.core.util.validation.CheckUtils;
import top.continew.starter.core.util.validation.ValidationUtils;
import top.continew.starter.log.annotation.Log;
import top.continew.starter.messaging.mail.util.MailUtils;
import top.continew.starter.ratelimiter.annotation.RateLimiter;
import top.continew.starter.ratelimiter.annotation.RateLimiters;
import top.continew.starter.ratelimiter.enums.LimitType;
import top.continew.starter.validation.constraints.Mobile;
import top.continew.starter.web.model.R;
import java.time.Duration;
@@ -84,7 +84,7 @@ import java.util.concurrent.TimeUnit;
@RequestMapping("/captcha")
public class CaptchaController {
private final ProjectProperties projectProperties;
private final ApplicationProperties applicationProperties;
private final CaptchaProperties captchaProperties;
private final CaptchaService behaviorCaptchaService;
private final GraphicCaptchaService graphicCaptchaService;
@@ -162,12 +162,12 @@ public class CaptchaController {
Long expirationInMinutes = captchaMail.getExpirationInMinutes();
Map<String, String> siteConfig = optionService.getByCategory(OptionCategoryEnum.SITE);
String content = TemplateUtils.render(captchaMail.getTemplatePath(), Dict.create()
.set("siteUrl", projectProperties.getUrl())
.set("siteUrl", applicationProperties.getUrl())
.set("siteTitle", siteConfig.get("SITE_TITLE"))
.set("siteCopyright", siteConfig.get("SITE_COPYRIGHT"))
.set("captcha", captcha)
.set("expiration", expirationInMinutes));
MailUtils.sendHtml(email, "【%s】邮箱验证码".formatted(projectProperties.getName()), content);
MailUtils.sendHtml(email, "【%s】邮箱验证码".formatted(applicationProperties.getName()), content);
// 保存验证码
String captchaKey = CacheConstants.CAPTCHA_KEY_PREFIX + email;
RedisUtils.set(captchaKey, captcha, Duration.ofMinutes(expirationInMinutes));

View File

@@ -35,7 +35,7 @@ import top.continew.admin.system.enums.OptionCategoryEnum;
import top.continew.admin.system.model.query.*;
import top.continew.admin.system.model.resp.file.FileUploadResp;
import top.continew.admin.system.service.*;
import top.continew.starter.core.validation.ValidationUtils;
import top.continew.starter.core.util.validation.ValidationUtils;
import top.continew.starter.extension.crud.model.query.SortQuery;
import top.continew.starter.extension.crud.model.resp.LabelValueResp;
import top.continew.starter.log.annotation.Log;
@@ -68,7 +68,7 @@ public class CommonController {
@Operation(summary = "上传文件", description = "上传文件")
@Parameter(name = "parentPath", description = "上级目录", example = "/", in = ParameterIn.QUERY)
@PostMapping("/file")
public FileUploadResp upload(@NotNull(message = "文件不能为空") @RequestPart MultipartFile file,
public FileUploadResp upload(@RequestPart @NotNull(message = "文件不能为空") MultipartFile file,
@RequestParam(required = false) String parentPath) throws IOException {
ValidationUtils.throwIf(file::isEmpty, "文件不能为空");
FileInfo fileInfo = fileService.upload(file, parentPath);

View File

@@ -25,7 +25,6 @@ import io.swagger.v3.oas.annotations.Parameter;
import io.swagger.v3.oas.annotations.enums.ParameterIn;
import io.swagger.v3.oas.annotations.tags.Tag;
import lombok.RequiredArgsConstructor;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
@@ -36,7 +35,7 @@ import top.continew.admin.system.model.resp.dashboard.DashboardChartCommonResp;
import top.continew.admin.system.model.resp.dashboard.DashboardNoticeResp;
import top.continew.admin.system.model.resp.dashboard.DashboardOverviewCommonResp;
import top.continew.admin.system.service.DashboardService;
import top.continew.starter.core.validation.ValidationUtils;
import top.continew.starter.core.util.validation.ValidationUtils;
import top.continew.starter.log.annotation.Log;
import java.io.IOException;
@@ -50,7 +49,6 @@ import java.util.List;
*/
@Tag(name = "仪表盘 API")
@Log(ignore = true)
@Validated
@RestController
@RequiredArgsConstructor
@RequestMapping("/dashboard")

View File

@@ -22,13 +22,13 @@ import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.Parameter;
import io.swagger.v3.oas.annotations.enums.ParameterIn;
import io.swagger.v3.oas.annotations.tags.Tag;
import jakarta.validation.Valid;
import lombok.RequiredArgsConstructor;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;
import top.continew.admin.auth.model.query.OnlineUserQuery;
import top.continew.admin.auth.model.resp.OnlineUserResp;
import top.continew.admin.auth.service.OnlineUserService;
import top.continew.starter.core.validation.CheckUtils;
import top.continew.starter.core.util.validation.CheckUtils;
import top.continew.starter.extension.crud.model.query.PageQuery;
import top.continew.starter.extension.crud.model.resp.PageResp;
@@ -49,7 +49,7 @@ public class OnlineUserController {
@Operation(summary = "分页查询列表", description = "分页查询列表")
@SaCheckPermission("monitor:online:list")
@GetMapping
public PageResp<OnlineUserResp> page(OnlineUserQuery query, @Validated PageQuery pageQuery) {
public PageResp<OnlineUserResp> page(@Valid OnlineUserQuery query, @Valid PageQuery pageQuery) {
return baseService.page(query, pageQuery);
}

View File

@@ -4,6 +4,6 @@
| |___| (_) || | | || |_ | || |\ || __/ \ V V /|_____|/ ___ \| (_| || | | | | || || | | |
\____|\___/ |_| |_| \__||_||_| \_| \___| \_/\_/ /_/ \_\\__,_||_| |_| |_||_||_| |_|
:: ${project.name} :: v${project.version}
:: ContiNew Starter :: v${project.starter}
:: ${application.name} :: v${application.version} (Profile: ${spring.profiles.active})
:: ContiNew Starter :: v${application.starter}
:: Spring Boot :: v${spring-boot.version}

View File

@@ -1,5 +1,5 @@
--- ### 项目配置
project:
--- ### 应用配置
application:
# URL跨域配置默认放行此 URL第三方登录回调默认使用此 URL 为前缀,请注意更改为你实际的前端 URL
url: http://localhost:5173
@@ -234,11 +234,11 @@ justauth:
GITEE:
client-id: 5d271b7f638941812aaf8bfc2e2f08f06d6235ef934e0e39537e2364eb8452c4
client-secret: 1f7d08**********5b7**********29e
redirect-uri: ${project.url}/social/callback?source=gitee
redirect-uri: ${application.url}/social/callback?source=gitee
GITHUB:
client-id: 38080dad08cfbdfacca9
client-secret: 1f7d08**********5b7**********29e
redirect-uri: ${project.url}/social/callback?source=github
redirect-uri: ${application.url}/social/callback?source=github
cache:
type: REDIS

View File

@@ -1,5 +1,5 @@
--- ### 项目配置
project:
--- ### 应用配置
application:
# URL跨域配置默认放行此 URL第三方登录回调默认使用此 URL 为前缀,请注意更改为你实际的前端 URL
url: https://admin.continew.top
# 是否为生产环境
@@ -99,14 +99,14 @@ jetcache:
## 接口文档增强配置
knife4j:
# 开启生产环境屏蔽
production: ${project.production}
production: ${application.production}
--- ### 跨域配置
continew-starter.web.cors:
enabled: true
# 配置允许跨域的域名
allowed-origins:
- ${project.url}
- ${application.url}
# 配置允许跨域的请求方式
allowed-methods: '*'
# 配置允许跨域的请求头
@@ -213,7 +213,7 @@ continew-starter.messaging.websocket:
path: /websocket
# 配置允许跨域的域名
allowed-origins:
- ${project.url}
- ${application.url}
--- ### Sa-Token 扩展配置
sa-token.extension:
@@ -236,11 +236,11 @@ justauth:
GITEE:
client-id: 5d271b7f638941812aaf8bfc2e2f08f06d6235ef934e0e39537e2364eb8452c4
client-secret: 1f7d08**********5b7**********29e
redirect-uri: ${project.url}/social/callback?source=gitee
redirect-uri: ${application.url}/social/callback?source=gitee
GITHUB:
client-id: 38080dad08cfbdfacca9
client-secret: 1f7d08**********5b7**********29e
redirect-uri: ${project.url}/social/callback?source=github
redirect-uri: ${application.url}/social/callback?source=github
cache:
type: REDIS

View File

@@ -1,14 +1,13 @@
--- ### 项目配置
project:
--- ### 应用配置
application:
id: continew-admin
# 名称
name: ContiNew Admin
# 应用名称
app-name: continew-admin
# 版本
version: 4.0.0-SNAPSHOT
starter: 2.12.2
# 描述
description: 持续迭代优化的前后端分离中后台管理系统框架,开箱即用,持续提供舒适的开发体验。
# 版本
version: 4.0.0-SNAPSHOT
starter: 2.13.0
# 基本包
base-package: top.continew.admin
## 作者信息配置
@@ -44,7 +43,7 @@ server:
--- ### Spring 项目配置
spring:
application:
name: ${project.app-name}
name: ${application.id}
## 环境配置
profiles:
# 启用的环境
@@ -133,7 +132,7 @@ knife4j:
# 是否自定义 footer默认 false非自定义
enable-footer-custom: true
# 自定义 footer 内容,支持 Markdown 语法
footer-custom-content: 'Copyright © 2022-present [${project.contact.name}](${project.contact.url})&nbsp;⋅&nbsp;[${project.name}](${project.url}) v${project.version}'
footer-custom-content: 'Copyright © 2022-present [${application.contact.name}](${application.contact.url})&nbsp;⋅&nbsp;[${application.name}](${application.url}) v${application.version}'
--- ### 全局响应配置
continew-starter.web:
@@ -236,7 +235,7 @@ mybatis-plus:
# Mapper XML 文件目录配置
mapper-locations: classpath*:/mapper/**/*Mapper.xml
# 类型别名扫描包配置
type-aliases-package: ${project.base-package}.**.model
type-aliases-package: ${application.base-package}.**.model
## MyBatis 配置
configuration:
# MyBatis 自动映射策略
@@ -255,7 +254,7 @@ mybatis-plus:
extension:
enabled: true
# Mapper 接口扫描包配置
mapper-package: ${project.base-package}.**.mapper
mapper-package: ${application.base-package}.**.mapper
# ID 生成器配置
id-generator:
type: COSID

View File

@@ -4,7 +4,7 @@
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>top.continew</groupId>
<groupId>top.continew.admin</groupId>
<artifactId>continew-admin</artifactId>
<version>${revision}</version>
</parent>
@@ -18,7 +18,7 @@
<dependencies>
<!-- 公共模块 -->
<dependency>
<groupId>top.continew</groupId>
<groupId>top.continew.admin</groupId>
<artifactId>continew-common</artifactId>
</dependency>

View File

@@ -36,8 +36,8 @@ import top.continew.admin.system.service.DeptService;
import top.continew.admin.system.service.OptionService;
import top.continew.admin.system.service.RoleService;
import top.continew.admin.system.service.UserService;
import top.continew.starter.core.validation.CheckUtils;
import top.continew.starter.core.validation.Validator;
import top.continew.starter.core.util.validation.CheckUtils;
import top.continew.starter.core.util.validation.Validator;
import top.continew.starter.core.util.ServletUtils;
import java.util.Set;

View File

@@ -20,18 +20,17 @@ import cn.dev33.satoken.annotation.SaIgnore;
import cn.dev33.satoken.stp.StpUtil;
import cn.hutool.core.bean.BeanUtil;
import com.xkcoding.justauth.autoconfigure.JustAuthProperties;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.Parameter;
import io.swagger.v3.oas.annotations.enums.ParameterIn;
import io.swagger.v3.oas.annotations.tags.Tag;
import jakarta.servlet.http.HttpServletRequest;
import jakarta.validation.Valid;
import lombok.RequiredArgsConstructor;
import me.zhyd.oauth.AuthRequestBuilder;
import me.zhyd.oauth.config.AuthConfig;
import me.zhyd.oauth.request.AuthRequest;
import me.zhyd.oauth.utils.AuthStateUtils;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;
import top.continew.admin.auth.model.req.LoginReq;
import top.continew.admin.auth.model.resp.LoginResp;
@@ -56,7 +55,6 @@ import java.util.List;
*/
@Tag(name = "认证 API")
@Log(module = "登录")
@Validated
@RestController
@RequiredArgsConstructor
@RequestMapping("/auth")
@@ -69,7 +67,7 @@ public class AuthController {
@SaIgnore
@Operation(summary = "登录", description = "用户登录")
@PostMapping("/login")
public LoginResp login(@Validated @RequestBody LoginReq req, HttpServletRequest request) {
public LoginResp login(@RequestBody @Valid LoginReq req, HttpServletRequest request) {
return authService.login(req, request);
}

View File

@@ -37,8 +37,8 @@ import top.continew.admin.system.model.entity.user.UserDO;
import top.continew.admin.system.model.resp.ClientResp;
import top.continew.starter.cache.redisson.util.RedisUtils;
import top.continew.starter.core.util.ExceptionUtils;
import top.continew.starter.core.validation.CheckUtils;
import top.continew.starter.core.validation.ValidationUtils;
import top.continew.starter.core.util.validation.CheckUtils;
import top.continew.starter.core.util.validation.ValidationUtils;
import java.time.Duration;

View File

@@ -26,7 +26,7 @@ import top.continew.admin.common.constant.CacheConstants;
import top.continew.admin.system.model.entity.user.UserDO;
import top.continew.admin.system.model.resp.ClientResp;
import top.continew.starter.cache.redisson.util.RedisUtils;
import top.continew.starter.core.validation.ValidationUtils;
import top.continew.starter.core.util.validation.ValidationUtils;
/**
* 邮箱登录处理器

View File

@@ -26,7 +26,7 @@ import top.continew.admin.common.constant.CacheConstants;
import top.continew.admin.system.model.entity.user.UserDO;
import top.continew.admin.system.model.resp.ClientResp;
import top.continew.starter.cache.redisson.util.RedisUtils;
import top.continew.starter.core.validation.ValidationUtils;
import top.continew.starter.core.util.validation.ValidationUtils;
/**
* 手机号登录处理器

View File

@@ -50,9 +50,9 @@ import top.continew.admin.system.model.resp.ClientResp;
import top.continew.admin.system.service.MessageService;
import top.continew.admin.system.service.UserRoleService;
import top.continew.admin.system.service.UserSocialService;
import top.continew.starter.core.autoconfigure.project.ProjectProperties;
import top.continew.starter.core.autoconfigure.application.ApplicationProperties;
import top.continew.starter.core.exception.BadRequestException;
import top.continew.starter.core.validation.ValidationUtils;
import top.continew.starter.core.util.validation.ValidationUtils;
import java.time.LocalDateTime;
import java.util.Collections;
@@ -72,7 +72,7 @@ public class SocialLoginHandler extends AbstractLoginHandler<SocialLoginReq> {
private final UserSocialService userSocialService;
private final UserRoleService userRoleService;
private final MessageService messageService;
private final ProjectProperties projectProperties;
private final ApplicationProperties applicationProperties;
@Override
public LoginResp login(SocialLoginReq req, ClientResp client, HttpServletRequest request) {
@@ -166,7 +166,7 @@ public class SocialLoginHandler extends AbstractLoginHandler<SocialLoginReq> {
private void sendSecurityMsg(UserDO user) {
MessageTemplateEnum template = MessageTemplateEnum.SOCIAL_REGISTER;
MessageReq req = new MessageReq(MessageTypeEnum.SECURITY);
req.setTitle(template.getTitle().formatted(projectProperties.getName()));
req.setTitle(template.getTitle().formatted(applicationProperties.getName()));
req.setContent(template.getContent().formatted(user.getNickname()));
messageService.add(req, CollUtil.toList(user.getId().toString()));
}

View File

@@ -20,7 +20,7 @@ import io.swagger.v3.oas.annotations.media.Schema;
import jakarta.validation.constraints.NotBlank;
import lombok.Data;
import org.hibernate.validator.constraints.Length;
import top.continew.starter.core.validation.constraints.Mobile;
import top.continew.starter.validation.constraints.Mobile;
import java.io.Serial;

View File

@@ -40,7 +40,7 @@ import top.continew.admin.system.model.resp.MenuResp;
import top.continew.admin.system.service.ClientService;
import top.continew.admin.system.service.MenuService;
import top.continew.admin.system.service.RoleService;
import top.continew.starter.core.validation.ValidationUtils;
import top.continew.starter.core.util.validation.ValidationUtils;
import top.continew.starter.extension.crud.annotation.TreeField;
import top.continew.starter.extension.crud.autoconfigure.CrudProperties;

View File

@@ -18,7 +18,7 @@ package top.continew.admin.system.controller;
import io.swagger.v3.oas.annotations.tags.Tag;
import org.springframework.web.bind.annotation.RestController;
import top.continew.admin.common.controller.BaseController;
import top.continew.admin.common.base.controller.BaseController;
import top.continew.admin.system.model.query.ClientQuery;
import top.continew.admin.system.model.req.ClientReq;
import top.continew.admin.system.model.resp.ClientResp;

View File

@@ -18,7 +18,7 @@ package top.continew.admin.system.controller;
import io.swagger.v3.oas.annotations.tags.Tag;
import org.springframework.web.bind.annotation.RestController;
import top.continew.admin.common.controller.BaseController;
import top.continew.admin.common.base.controller.BaseController;
import top.continew.admin.system.model.query.DeptQuery;
import top.continew.admin.system.model.req.DeptReq;
import top.continew.admin.system.model.resp.DeptResp;

View File

@@ -23,7 +23,7 @@ import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RestController;
import top.continew.admin.common.constant.CacheConstants;
import top.continew.admin.common.controller.BaseController;
import top.continew.admin.common.base.controller.BaseController;
import top.continew.admin.system.model.query.DictQuery;
import top.continew.admin.system.model.req.DictReq;
import top.continew.admin.system.model.resp.DictResp;

View File

@@ -18,7 +18,7 @@ package top.continew.admin.system.controller;
import io.swagger.v3.oas.annotations.tags.Tag;
import org.springframework.web.bind.annotation.RestController;
import top.continew.admin.common.controller.BaseController;
import top.continew.admin.common.base.controller.BaseController;
import top.continew.admin.system.model.query.DictItemQuery;
import top.continew.admin.system.model.req.DictItemReq;
import top.continew.admin.system.model.resp.DictItemResp;

View File

@@ -25,9 +25,10 @@ import jakarta.validation.Valid;
import jakarta.validation.constraints.NotNull;
import lombok.RequiredArgsConstructor;
import org.dromara.x.file.storage.core.FileInfo;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.multipart.MultipartFile;
import top.continew.admin.common.controller.BaseController;
import top.continew.admin.common.base.controller.BaseController;
import top.continew.admin.system.model.query.FileQuery;
import top.continew.admin.system.model.req.FileReq;
import top.continew.admin.system.model.resp.file.FileDirCalcSizeResp;
@@ -35,7 +36,7 @@ import top.continew.admin.system.model.resp.file.FileResp;
import top.continew.admin.system.model.resp.file.FileStatisticsResp;
import top.continew.admin.system.model.resp.file.FileUploadResp;
import top.continew.admin.system.service.FileService;
import top.continew.starter.core.validation.ValidationUtils;
import top.continew.starter.core.util.validation.ValidationUtils;
import top.continew.starter.extension.crud.annotation.CrudRequestMapping;
import top.continew.starter.extension.crud.enums.Api;
import top.continew.starter.extension.crud.model.resp.IdResp;
@@ -50,6 +51,7 @@ import java.io.IOException;
* @since 2023/12/23 10:38
*/
@Tag(name = "文件管理 API")
@Validated
@RestController
@RequiredArgsConstructor
@CrudRequestMapping(value = "/system/file", api = {Api.PAGE, Api.UPDATE, Api.DELETE})
@@ -85,7 +87,7 @@ public class FileController extends BaseController<FileService, FileResp, FileRe
@Operation(summary = "创建文件夹", description = "创建文件夹")
@SaCheckPermission("system:file:createDir")
@PostMapping("/dir")
public IdResp<Long> createDir(@Valid @RequestBody FileReq req) {
public IdResp<Long> createDir(@RequestBody @Valid FileReq req) {
ValidationUtils.throwIfBlank(req.getParentPath(), "上级目录不能为空");
return new IdResp<>(baseService.createDir(req));
}

View File

@@ -23,8 +23,8 @@ import io.swagger.v3.oas.annotations.Parameter;
import io.swagger.v3.oas.annotations.enums.ParameterIn;
import io.swagger.v3.oas.annotations.tags.Tag;
import jakarta.servlet.http.HttpServletResponse;
import jakarta.validation.Valid;
import lombok.RequiredArgsConstructor;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
@@ -56,7 +56,7 @@ public class LogController {
@Operation(summary = "分页查询列表", description = "分页查询列表")
@SaCheckPermission("monitor:log:list")
@GetMapping
public PageResp<LogResp> page(LogQuery query, @Validated PageQuery pageQuery) {
public PageResp<LogResp> page(@Valid LogQuery query, @Valid PageQuery pageQuery) {
return baseService.page(query, pageQuery);
}
@@ -73,7 +73,7 @@ public class LogController {
@Operation(summary = "导出登录日志", description = "导出登录日志")
@SaCheckPermission("monitor:log:export")
@GetMapping("/export/login")
public void exportLoginLog(LogQuery query, SortQuery sortQuery, HttpServletResponse response) {
public void exportLoginLog(@Valid LogQuery query, @Valid SortQuery sortQuery, HttpServletResponse response) {
baseService.exportLoginLog(query, sortQuery, response);
}
@@ -81,7 +81,7 @@ public class LogController {
@Operation(summary = "导出操作日志", description = "导出操作日志")
@SaCheckPermission("monitor:log:export")
@GetMapping("/export/operation")
public void exportOperationLog(LogQuery query, SortQuery sortQuery, HttpServletResponse response) {
public void exportOperationLog(@Valid LogQuery query, @Valid SortQuery sortQuery, HttpServletResponse response) {
baseService.exportOperationLog(query, sortQuery, response);
}
}

View File

@@ -24,7 +24,7 @@ import io.swagger.v3.oas.annotations.tags.Tag;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.RestController;
import top.continew.admin.common.constant.CacheConstants;
import top.continew.admin.common.controller.BaseController;
import top.continew.admin.common.base.controller.BaseController;
import top.continew.admin.system.model.query.MenuQuery;
import top.continew.admin.system.model.req.MenuReq;
import top.continew.admin.system.model.resp.MenuResp;
@@ -32,7 +32,7 @@ import top.continew.admin.system.service.MenuService;
import top.continew.starter.cache.redisson.util.RedisUtils;
import top.continew.starter.core.constant.StringConstants;
import top.continew.starter.core.util.URLUtils;
import top.continew.starter.core.validation.ValidationUtils;
import top.continew.starter.core.util.validation.ValidationUtils;
import top.continew.starter.extension.crud.annotation.CrudApi;
import top.continew.starter.extension.crud.annotation.CrudRequestMapping;
import top.continew.starter.extension.crud.enums.Api;

View File

@@ -19,7 +19,7 @@ package top.continew.admin.system.controller;
import cn.hutool.core.collection.CollUtil;
import io.swagger.v3.oas.annotations.tags.Tag;
import org.springframework.web.bind.annotation.RestController;
import top.continew.admin.common.controller.BaseController;
import top.continew.admin.common.base.controller.BaseController;
import top.continew.admin.system.enums.NoticeMethodEnum;
import top.continew.admin.system.enums.NoticeScopeEnum;
import top.continew.admin.system.model.query.NoticeQuery;
@@ -27,7 +27,7 @@ import top.continew.admin.system.model.req.NoticeReq;
import top.continew.admin.system.model.resp.notice.NoticeDetailResp;
import top.continew.admin.system.model.resp.notice.NoticeResp;
import top.continew.admin.system.service.NoticeService;
import top.continew.starter.core.validation.ValidationUtils;
import top.continew.starter.core.util.validation.ValidationUtils;
import top.continew.starter.extension.crud.annotation.CrudApi;
import top.continew.starter.extension.crud.annotation.CrudRequestMapping;
import top.continew.starter.extension.crud.enums.Api;

View File

@@ -22,7 +22,6 @@ import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.tags.Tag;
import jakarta.validation.Valid;
import lombok.RequiredArgsConstructor;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;
import top.continew.admin.system.model.query.OptionQuery;
import top.continew.admin.system.model.req.OptionReq;
@@ -39,7 +38,6 @@ import java.util.List;
* @since 2023/8/26 19:38
*/
@Tag(name = "参数管理 API")
@Validated
@RestController
@RequiredArgsConstructor
@RequestMapping("/system/option")
@@ -51,7 +49,7 @@ public class OptionController {
@SaCheckPermission(value = {"system:siteConfig:get", "system:securityConfig:get", "system:loginConfig:get",
"system:mailConfig:get"}, mode = SaMode.OR)
@GetMapping
public List<OptionResp> list(@Validated OptionQuery query) {
public List<OptionResp> list(@Valid OptionQuery query) {
return baseService.list(query);
}
@@ -59,7 +57,7 @@ public class OptionController {
@SaCheckPermission(value = {"system:siteConfig:update", "system:securityConfig:update", "system:loginConfig:update",
"system:mailConfig:update"}, mode = SaMode.OR)
@PutMapping
public void update(@Valid @RequestBody List<OptionReq> options) {
public void update(@RequestBody @Valid List<OptionReq> options) {
baseService.update(options);
}
@@ -67,7 +65,7 @@ public class OptionController {
@SaCheckPermission(value = {"system:siteConfig:update", "system:securityConfig:update", "system:loginConfig:update",
"system:mailConfig:update"}, mode = SaMode.OR)
@PatchMapping("/value")
public void resetValue(@Validated @RequestBody OptionResetValueReq req) {
public void resetValue(@RequestBody @Valid OptionResetValueReq req) {
baseService.resetValue(req);
}
}

View File

@@ -21,11 +21,12 @@ import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.Parameter;
import io.swagger.v3.oas.annotations.enums.ParameterIn;
import io.swagger.v3.oas.annotations.tags.Tag;
import jakarta.validation.Valid;
import jakarta.validation.constraints.NotEmpty;
import lombok.RequiredArgsConstructor;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;
import top.continew.admin.common.controller.BaseController;
import top.continew.admin.common.base.controller.BaseController;
import top.continew.admin.system.model.query.RoleQuery;
import top.continew.admin.system.model.query.RoleUserQuery;
import top.continew.admin.system.model.req.RoleReq;
@@ -60,7 +61,7 @@ public class RoleController extends BaseController<RoleService, RoleResp, RoleDe
@Operation(summary = "修改权限", description = "修改角色的功能权限")
@SaCheckPermission("system:role:updatePermission")
@PutMapping("/{id}/permission")
public void updatePermission(@PathVariable("id") Long id, @Validated @RequestBody RoleUpdatePermissionReq req) {
public void updatePermission(@PathVariable("id") Long id, @RequestBody @Valid RoleUpdatePermissionReq req) {
baseService.updatePermission(id, req);
}
@@ -69,8 +70,8 @@ public class RoleController extends BaseController<RoleService, RoleResp, RoleDe
@SaCheckPermission("system:role:list")
@GetMapping("/{id}/user")
public PageResp<RoleUserResp> pageUser(@PathVariable("id") Long id,
@Validated RoleUserQuery query,
@Validated PageQuery pageQuery) {
@Valid RoleUserQuery query,
@Valid PageQuery pageQuery) {
query.setRoleId(id);
return userRoleService.pageUser(query, pageQuery);
}
@@ -79,14 +80,14 @@ public class RoleController extends BaseController<RoleService, RoleResp, RoleDe
@SaCheckPermission("system:role:assign")
@PostMapping("/{id}/user")
public void assignToUsers(@PathVariable("id") Long id,
@Validated @NotEmpty(message = "用户ID列表不能为空") @RequestBody List<Long> userIds) {
@RequestBody @NotEmpty(message = "用户ID列表不能为空") List<Long> userIds) {
baseService.assignToUsers(id, userIds);
}
@Operation(summary = "取消分配用户", description = "批量取消分配角色给用户")
@SaCheckPermission("system:role:unassign")
@DeleteMapping("/user")
public void unassignFromUsers(@Validated @NotEmpty(message = "用户列表不能为空") @RequestBody List<Long> userRoleIds) {
public void unassignFromUsers(@RequestBody @NotEmpty(message = "用户列表不能为空") List<Long> userRoleIds) {
userRoleService.deleteByIds(userRoleIds);
}

View File

@@ -21,11 +21,10 @@ import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.Parameter;
import io.swagger.v3.oas.annotations.enums.ParameterIn;
import io.swagger.v3.oas.annotations.tags.Tag;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.RestController;
import top.continew.admin.common.controller.BaseController;
import top.continew.admin.common.base.controller.BaseController;
import top.continew.admin.system.model.query.SmsConfigQuery;
import top.continew.admin.system.model.req.SmsConfigReq;
import top.continew.admin.system.model.resp.SmsConfigResp;
@@ -41,7 +40,6 @@ import top.continew.starter.extension.crud.enums.Api;
* @since 2025/03/15 18:41
*/
@Tag(name = "短信配置管理 API")
@Validated
@RestController
@CrudRequestMapping(value = "/system/smsConfig", api = {Api.PAGE, Api.GET, Api.CREATE, Api.UPDATE, Api.DELETE})
public class SmsConfigController extends BaseController<SmsConfigService, SmsConfigResp, SmsConfigResp, SmsConfigQuery, SmsConfigReq> {

View File

@@ -17,9 +17,8 @@
package top.continew.admin.system.controller;
import io.swagger.v3.oas.annotations.tags.Tag;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.RestController;
import top.continew.admin.common.controller.BaseController;
import top.continew.admin.common.base.controller.BaseController;
import top.continew.admin.system.model.query.SmsLogQuery;
import top.continew.admin.system.model.req.SmsLogReq;
import top.continew.admin.system.model.resp.SmsLogResp;
@@ -35,7 +34,6 @@ import top.continew.starter.extension.crud.enums.Api;
* @since 2025/03/15 22:15
*/
@Tag(name = "短信日志管理 API")
@Validated
@RestController
@CrudRequestMapping(value = "/system/smsLog", api = {Api.PAGE, Api.GET, Api.DELETE, Api.EXPORT})
public class SmsLogController extends BaseController<SmsLogService, SmsLogResp, SmsLogResp, SmsLogQuery, SmsLogReq> {

View File

@@ -21,13 +21,13 @@ import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.Parameter;
import io.swagger.v3.oas.annotations.enums.ParameterIn;
import io.swagger.v3.oas.annotations.tags.Tag;
import org.springframework.validation.annotation.Validated;
import jakarta.validation.Valid;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RestController;
import top.continew.admin.common.controller.BaseController;
import top.continew.admin.common.model.req.CommonStatusUpdateReq;
import top.continew.admin.common.base.controller.BaseController;
import top.continew.admin.common.base.model.req.CommonStatusUpdateReq;
import top.continew.admin.system.model.query.StorageQuery;
import top.continew.admin.system.model.req.StorageReq;
import top.continew.admin.system.model.resp.StorageResp;
@@ -42,7 +42,6 @@ import top.continew.starter.extension.crud.enums.Api;
* @since 2023/12/26 22:09
*/
@Tag(name = "存储管理 API")
@Validated
@RestController
@CrudRequestMapping(value = "/system/storage", api = {Api.LIST, Api.GET, Api.CREATE, Api.UPDATE, Api.DELETE})
public class StorageController extends BaseController<StorageService, StorageResp, StorageResp, StorageQuery, StorageReq> {
@@ -51,7 +50,7 @@ public class StorageController extends BaseController<StorageService, StorageRes
@Parameter(name = "id", description = "ID", example = "1", in = ParameterIn.PATH)
@SaCheckPermission("system:storage:updateStatus")
@PutMapping({"/{id}/status"})
public void updateStatus(@Validated @RequestBody CommonStatusUpdateReq req, @PathVariable("id") Long id) {
public void updateStatus(@RequestBody @Valid CommonStatusUpdateReq req, @PathVariable("id") Long id) {
baseService.updateStatus(req, id);
}

View File

@@ -23,14 +23,15 @@ import io.swagger.v3.oas.annotations.Parameter;
import io.swagger.v3.oas.annotations.enums.ParameterIn;
import io.swagger.v3.oas.annotations.tags.Tag;
import jakarta.servlet.http.HttpServletResponse;
import jakarta.validation.Valid;
import jakarta.validation.constraints.NotNull;
import lombok.RequiredArgsConstructor;
import org.springframework.http.MediaType;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.multipart.MultipartFile;
import top.continew.admin.common.base.controller.BaseController;
import top.continew.admin.common.constant.RegexConstants;
import top.continew.admin.common.controller.BaseController;
import top.continew.admin.common.util.SecureUtils;
import top.continew.admin.system.model.query.UserQuery;
import top.continew.admin.system.model.req.user.UserImportReq;
@@ -43,11 +44,10 @@ import top.continew.admin.system.model.resp.user.UserImportResp;
import top.continew.admin.system.model.resp.user.UserResp;
import top.continew.admin.system.service.UserService;
import top.continew.starter.core.util.ExceptionUtils;
import top.continew.starter.core.validation.ValidationUtils;
import top.continew.starter.core.util.validation.ValidationUtils;
import top.continew.starter.extension.crud.annotation.CrudRequestMapping;
import top.continew.starter.extension.crud.enums.Api;
import top.continew.starter.extension.crud.model.resp.IdResp;
import top.continew.starter.extension.crud.validation.CrudValidationGroup;
import java.io.IOException;
@@ -67,7 +67,7 @@ public class UserController extends BaseController<UserService, UserResp, UserDe
@Override
@Operation(summary = "新增数据", description = "新增数据")
public IdResp<Long> create(@Validated(CrudValidationGroup.Create.class) @RequestBody UserReq req) {
public IdResp<Long> create(@RequestBody @Valid UserReq req) {
String rawPassword = ExceptionUtils.exToNull(() -> SecureUtils.decryptByRsaPrivateKey(req.getPassword()));
ValidationUtils.throwIfNull(rawPassword, "密码解密失败");
ValidationUtils.throwIf(!ReUtil
@@ -86,7 +86,7 @@ public class UserController extends BaseController<UserService, UserResp, UserDe
@Operation(summary = "解析导入数据", description = "解析导入数据")
@SaCheckPermission("system:user:import")
@PostMapping("/import/parse")
public UserImportParseResp parseImport(@NotNull(message = "文件不能为空") @RequestPart MultipartFile file) {
public UserImportParseResp parseImport(@RequestPart @NotNull(message = "文件不能为空") MultipartFile file) {
ValidationUtils.throwIf(file::isEmpty, "文件不能为空");
return baseService.parseImport(file);
}
@@ -94,7 +94,7 @@ public class UserController extends BaseController<UserService, UserResp, UserDe
@Operation(summary = "导入数据", description = "导入数据")
@SaCheckPermission("system:user:import")
@PostMapping(value = "/import")
public UserImportResp importUser(@Validated @RequestBody UserImportReq req) {
public UserImportResp importUser(@RequestBody @Valid UserImportReq req) {
return baseService.importUser(req);
}
@@ -102,7 +102,7 @@ public class UserController extends BaseController<UserService, UserResp, UserDe
@Parameter(name = "id", description = "ID", example = "1", in = ParameterIn.PATH)
@SaCheckPermission("system:user:resetPwd")
@PatchMapping("/{id}/password")
public void resetPassword(@Validated @RequestBody UserPasswordResetReq req, @PathVariable Long id) {
public void resetPassword(@RequestBody @Valid UserPasswordResetReq req, @PathVariable Long id) {
String rawNewPassword = ExceptionUtils.exToNull(() -> SecureUtils.decryptByRsaPrivateKey(req.getNewPassword()));
ValidationUtils.throwIfNull(rawNewPassword, "新密码解密失败");
ValidationUtils.throwIf(!ReUtil
@@ -115,7 +115,7 @@ public class UserController extends BaseController<UserService, UserResp, UserDe
@Parameter(name = "id", description = "ID", example = "1", in = ParameterIn.PATH)
@SaCheckPermission("system:user:updateRole")
@PatchMapping("/{id}/role")
public void updateRole(@Validated @RequestBody UserRoleUpdateReq updateReq, @PathVariable Long id) {
public void updateRole(@RequestBody @Valid UserRoleUpdateReq updateReq, @PathVariable Long id) {
baseService.updateRole(updateReq, id);
}
}

View File

@@ -20,8 +20,8 @@ import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.Parameter;
import io.swagger.v3.oas.annotations.enums.ParameterIn;
import io.swagger.v3.oas.annotations.tags.Tag;
import jakarta.validation.Valid;
import lombok.RequiredArgsConstructor;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;
import top.continew.admin.common.context.UserContextHolder;
import top.continew.admin.system.enums.NoticeMethodEnum;
@@ -36,7 +36,7 @@ import top.continew.admin.system.model.resp.notice.NoticeResp;
import top.continew.admin.system.model.resp.notice.NoticeUnreadCountResp;
import top.continew.admin.system.service.MessageService;
import top.continew.admin.system.service.NoticeService;
import top.continew.starter.core.validation.CheckUtils;
import top.continew.starter.core.util.validation.CheckUtils;
import top.continew.starter.extension.crud.model.query.PageQuery;
import top.continew.starter.extension.crud.model.req.IdsReq;
import top.continew.starter.extension.crud.model.resp.BasePageResp;
@@ -53,7 +53,6 @@ import java.util.List;
* @since 2025/4/5 21:30
*/
@Tag(name = "个人消息 API")
@Validated
@RestController
@RequiredArgsConstructor
@RequestMapping("/user/message")
@@ -72,7 +71,7 @@ public class UserMessageController {
@Operation(summary = "分页查询消息列表", description = "分页查询消息列表")
@GetMapping
public PageResp<MessageResp> page(MessageQuery query, @Validated PageQuery pageQuery) {
public PageResp<MessageResp> page(@Valid MessageQuery query, @Valid PageQuery pageQuery) {
query.setUserId(UserContextHolder.getUserId());
return messageService.page(query, pageQuery);
}
@@ -91,13 +90,13 @@ public class UserMessageController {
@Operation(summary = "删除消息", description = "删除消息")
@DeleteMapping
public void delete(@Validated @RequestBody IdsReq req) {
public void delete(@RequestBody @Valid IdsReq req) {
messageService.delete(req.getIds());
}
@Operation(summary = "消息标记为已读", description = "将消息标记为已读状态")
@PatchMapping("/read")
public void read(@Validated @RequestBody IdsReq req) {
public void read(@RequestBody @Valid IdsReq req) {
messageService.readMessage(req.getIds(), UserContextHolder.getUserId());
}
@@ -125,7 +124,7 @@ public class UserMessageController {
@Operation(summary = "分页查询公告列表", description = "分页查询公告列表")
@GetMapping("/notice")
public BasePageResp<NoticeResp> pageNotice(@Validated NoticeQuery query, @Validated PageQuery pageQuery) {
public BasePageResp<NoticeResp> pageNotice(@Valid NoticeQuery query, @Valid PageQuery pageQuery) {
query.setUserId(UserContextHolder.getUserId());
return noticeService.page(query, pageQuery);
}

View File

@@ -49,7 +49,7 @@ import top.continew.admin.system.service.UserSocialService;
import top.continew.starter.cache.redisson.util.RedisUtils;
import top.continew.starter.core.exception.BadRequestException;
import top.continew.starter.core.util.ExceptionUtils;
import top.continew.starter.core.validation.ValidationUtils;
import top.continew.starter.core.util.validation.ValidationUtils;
import java.io.IOException;
import java.util.List;
@@ -83,13 +83,13 @@ public class UserProfileController {
@Operation(summary = "修改基础信息", description = "修改用户基础信息")
@PatchMapping("/basic/info")
public void updateBasicInfo(@Validated @RequestBody UserBasicInfoUpdateReq req) {
public void updateBasicInfo(@RequestBody @Valid UserBasicInfoUpdateReq req) {
userService.updateBasicInfo(req, UserContextHolder.getUserId());
}
@Operation(summary = "修改密码", description = "修改用户登录密码")
@PatchMapping("/password")
public void updatePassword(@Validated @RequestBody UserPasswordUpdateReq updateReq) {
public void updatePassword(@RequestBody @Valid UserPasswordUpdateReq updateReq) {
String rawOldPassword = ExceptionUtils.exToNull(() -> SecureUtils.decryptByRsaPrivateKey(updateReq
.getOldPassword()));
ValidationUtils.throwIfNull(rawOldPassword, DECRYPT_FAILED);
@@ -101,7 +101,7 @@ public class UserProfileController {
@Operation(summary = "修改手机号", description = "修改手机号")
@PatchMapping("/phone")
public void updatePhone(@Validated @RequestBody UserPhoneUpdateReq updateReq) {
public void updatePhone(@RequestBody @Valid UserPhoneUpdateReq updateReq) {
String rawOldPassword = ExceptionUtils.exToNull(() -> SecureUtils.decryptByRsaPrivateKey(updateReq
.getOldPassword()));
ValidationUtils.throwIfBlank(rawOldPassword, DECRYPT_FAILED);
@@ -115,7 +115,7 @@ public class UserProfileController {
@Operation(summary = "修改邮箱", description = "修改用户邮箱")
@PatchMapping("/email")
public void updateEmail(@Valid @RequestBody UserEmailUpdateReq updateReq) {
public void updateEmail(@RequestBody @Valid UserEmailUpdateReq updateReq) {
String rawOldPassword = ExceptionUtils.exToNull(() -> SecureUtils.decryptByRsaPrivateKey(updateReq
.getOldPassword()));
ValidationUtils.throwIfBlank(rawOldPassword, DECRYPT_FAILED);

View File

@@ -29,7 +29,7 @@ import top.continew.admin.common.constant.SysConstants;
import top.continew.admin.system.model.entity.user.UserDO;
import top.continew.admin.system.service.OptionService;
import top.continew.admin.system.service.UserPasswordHistoryService;
import top.continew.starter.core.validation.ValidationUtils;
import top.continew.starter.core.util.validation.ValidationUtils;
import java.util.Map;

View File

@@ -26,7 +26,7 @@ import top.continew.admin.system.validation.ValidationGroup;
import top.continew.starter.core.constant.StringConstants;
import top.continew.starter.core.enums.BaseEnum;
import top.continew.starter.core.util.URLUtils;
import top.continew.starter.core.validation.ValidationUtils;
import top.continew.starter.core.util.validation.ValidationUtils;
/**
* 存储类型枚举

View File

@@ -18,7 +18,7 @@ package top.continew.admin.system.mapper;
import org.apache.ibatis.annotations.Mapper;
import top.continew.admin.system.model.entity.ClientDO;
import top.continew.starter.data.mp.base.BaseMapper;
import top.continew.starter.data.mapper.BaseMapper;
/**
* 客户端 Mapper

View File

@@ -18,7 +18,7 @@ package top.continew.admin.system.mapper;
import org.apache.ibatis.annotations.Mapper;
import top.continew.admin.system.model.entity.DeptDO;
import top.continew.starter.data.mp.base.BaseMapper;
import top.continew.starter.data.mapper.BaseMapper;
/**
* 部门 Mapper

View File

@@ -21,7 +21,7 @@ import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import top.continew.admin.common.constant.CacheConstants;
import top.continew.admin.system.model.entity.DictItemDO;
import top.continew.starter.data.mp.base.BaseMapper;
import top.continew.starter.data.mapper.BaseMapper;
import top.continew.starter.extension.crud.model.resp.LabelValueResp;
import java.util.List;

View File

@@ -18,7 +18,7 @@ package top.continew.admin.system.mapper;
import org.apache.ibatis.annotations.Mapper;
import top.continew.admin.system.model.entity.DictDO;
import top.continew.starter.data.mp.base.BaseMapper;
import top.continew.starter.data.mapper.BaseMapper;
/**
* 字典 Mapper

View File

@@ -20,7 +20,7 @@ import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;
import top.continew.admin.system.model.entity.FileDO;
import top.continew.admin.system.model.resp.file.FileStatisticsResp;
import top.continew.starter.data.mp.base.BaseMapper;
import top.continew.starter.data.mapper.BaseMapper;
import java.util.List;

View File

@@ -29,7 +29,7 @@ import top.continew.admin.system.model.resp.dashboard.DashboardAccessTrendResp;
import top.continew.admin.system.model.resp.dashboard.DashboardChartCommonResp;
import top.continew.admin.system.model.resp.dashboard.DashboardOverviewCommonResp;
import top.continew.admin.system.model.resp.log.LogResp;
import top.continew.starter.data.mp.base.BaseMapper;
import top.continew.starter.data.mapper.BaseMapper;
import java.util.Date;
import java.util.List;

View File

@@ -19,7 +19,7 @@ package top.continew.admin.system.mapper;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import top.continew.admin.system.model.entity.MenuDO;
import top.continew.starter.data.mp.base.BaseMapper;
import top.continew.starter.data.mapper.BaseMapper;
import java.util.List;
import java.util.Set;

View File

@@ -18,7 +18,7 @@ package top.continew.admin.system.mapper;
import org.apache.ibatis.annotations.Mapper;
import top.continew.admin.system.model.entity.MessageLogDO;
import top.continew.starter.data.mp.base.BaseMapper;
import top.continew.starter.data.mapper.BaseMapper;
/**
* 消息日志 Mapper

View File

@@ -24,7 +24,7 @@ import top.continew.admin.system.model.entity.MessageDO;
import top.continew.admin.system.model.query.MessageQuery;
import top.continew.admin.system.model.resp.message.MessageDetailResp;
import top.continew.admin.system.model.resp.message.MessageResp;
import top.continew.starter.data.mp.base.BaseMapper;
import top.continew.starter.data.mapper.BaseMapper;
import java.util.List;

View File

@@ -18,7 +18,7 @@ package top.continew.admin.system.mapper;
import org.apache.ibatis.annotations.Mapper;
import top.continew.admin.system.model.entity.NoticeLogDO;
import top.continew.starter.data.mp.base.BaseMapper;
import top.continew.starter.data.mapper.BaseMapper;
/**
* 公告日志 Mapper

View File

@@ -24,7 +24,7 @@ import top.continew.admin.system.model.entity.NoticeDO;
import top.continew.admin.system.model.query.NoticeQuery;
import top.continew.admin.system.model.resp.dashboard.DashboardNoticeResp;
import top.continew.admin.system.model.resp.notice.NoticeResp;
import top.continew.starter.data.mp.base.BaseMapper;
import top.continew.starter.data.mapper.BaseMapper;
import java.util.List;

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