mirror of
https://github.com/continew-org/continew-admin.git
synced 2025-09-10 20:57:14 +08:00
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:
@@ -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>
|
||||
|
@@ -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;
|
||||
|
@@ -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);
|
||||
}
|
||||
|
||||
|
@@ -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;
|
||||
|
||||
|
@@ -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
|
||||
|
@@ -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)
|
||||
|
@@ -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;
|
||||
|
@@ -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};
|
||||
|
@@ -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
|
||||
|
@@ -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};
|
||||
|
@@ -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> {}
|
@@ -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;
|
||||
|
@@ -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>
|
||||
|
@@ -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;
|
||||
|
@@ -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());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@@ -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;
|
||||
|
||||
/**
|
||||
|
@@ -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;
|
||||
|
@@ -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;
|
||||
|
@@ -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;
|
||||
|
@@ -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;
|
||||
|
@@ -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;
|
||||
|
||||
/**
|
||||
* 应用业务接口
|
||||
|
@@ -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
|
||||
|
@@ -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;
|
||||
|
||||
|
@@ -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;
|
||||
|
||||
|
@@ -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>
|
||||
|
@@ -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;
|
||||
}
|
||||
}
|
@@ -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);
|
||||
}
|
||||
|
||||
|
@@ -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);
|
||||
}
|
||||
}
|
||||
|
@@ -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;
|
||||
|
@@ -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;
|
||||
|
||||
|
@@ -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>
|
||||
|
Reference in New Issue
Block a user