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-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;