mirror of
https://github.com/continew-org/continew-admin.git
synced 2025-09-08 12:57:13 +08:00
chore: continew-starter 2.7.4 => 2.7.5
1.BaseServiceImpl 所在包调整 2.BaseController 改为在 Admin common 模块编写(重构权限校验 checkPermission 处理) 3.CRUD ValidateGroup => CrudValidationGroup 4.Admin ValidateGroup => ValidationGroup 5.修复 Query 查询数组范围报错 Closes #IB8711
This commit is contained in:
@@ -13,7 +13,7 @@
|
||||
<img src="https://sonarcloud.io/api/project_badges/measure?project=Charles7c_continew-admin&metric=alert_status" alt="Sonar Status" />
|
||||
</a>
|
||||
<a href="https://github.com/continew-org/continew-starter" target="_blank">
|
||||
<img src="https://img.shields.io/badge/ContiNew Starter-2.7.4-%236CB52D.svg" alt="ContiNew Starter" />
|
||||
<img src="https://img.shields.io/badge/ContiNew Starter-2.7.5-%236CB52D.svg" alt="ContiNew Starter" />
|
||||
</a>
|
||||
<a href="https://spring.io/projects/spring-boot" target="_blank">
|
||||
<img src="https://img.shields.io/badge/Spring Boot-3.2.10-%236CB52D.svg?logo=Spring-Boot" alt="Spring Boot" />
|
||||
@@ -225,7 +225,7 @@ public class DeptController extends BaseController<DeptService, DeptResp, DeptDe
|
||||
| <a href="https://arco.design/vue/docs/start" target="_blank">Arco Design</a> | 2.56.0 | 字节跳动推出的前端 UI 框架,年轻化的色彩和组件设计。 |
|
||||
| <a href="https://www.typescriptlang.org/zh/" target="_blank">TypeScript</a> | 5.0.4 | TypeScript 是微软开发的一个开源的编程语言,通过在 JavaScript 的基础上添加静态类型定义构建而成。 |
|
||||
| <a href="https://cn.vitejs.dev/" target="_blank">Vite</a> | 5.1.5 | 下一代的前端工具链,为开发提供极速响应。 |
|
||||
| [ContiNew Starter](https://github.com/continew-org/continew-starter) | 2.7.4 | ContiNew Starter 包含了一系列经过企业实践优化的依赖包(如 MyBatis-Plus、SaToken),可轻松集成到应用中,为开发人员减少手动引入依赖及配置的麻烦,为 Spring Boot Web 项目的灵活快速构建提供支持。 |
|
||||
| [ContiNew Starter](https://github.com/continew-org/continew-starter) | 2.7.5 | ContiNew Starter 包含了一系列经过企业实践优化的依赖包(如 MyBatis-Plus、SaToken),可轻松集成到应用中,为开发人员减少手动引入依赖及配置的麻烦,为 Spring Boot Web 项目的灵活快速构建提供支持。 |
|
||||
| <a href="https://spring.io/projects/spring-boot" target="_blank">Spring Boot</a> | 3.2.10 | 简化 Spring 应用的初始搭建和开发过程,基于“约定优于配置”的理念,使开发人员不再需要定义样板化的配置。(Spring Boot 3.0 开始,要求 Java 17 作为最低版本) |
|
||||
| <a href="https://undertow.io/" target="_blank">Undertow</a> | 2.3.13.Final | 采用 Java 开发的灵活的高性能 Web 服务器,提供包括阻塞和基于 NIO 的非堵塞机制。 |
|
||||
| <a href="https://sa-token.dev33.cn/" target="_blank">Sa-Token + JWT</a> | 1.39.0 | 轻量级 Java 权限认证框架,让鉴权变得简单、优雅。 |
|
||||
|
@@ -58,30 +58,36 @@
|
||||
<artifactId>continew-starter-extension-crud-mp</artifactId>
|
||||
</dependency>
|
||||
|
||||
<!-- ContiNew Starter 认证模块 - SaToken -->
|
||||
<dependency>
|
||||
<groupId>top.continew</groupId>
|
||||
<artifactId>continew-starter-auth-satoken</artifactId>
|
||||
<exclusions>
|
||||
<exclusion>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-starter-web</artifactId>
|
||||
</exclusion>
|
||||
</exclusions>
|
||||
</dependency>
|
||||
|
||||
<!-- ContiNew Starter 认证模块 - JustAuth -->
|
||||
<dependency>
|
||||
<groupId>top.continew</groupId>
|
||||
<artifactId>continew-starter-auth-justauth</artifactId>
|
||||
</dependency>
|
||||
|
||||
<!-- ContiNew Starter 数据权限模块 - MyBatis Plus -->
|
||||
<dependency>
|
||||
<groupId>top.continew</groupId>
|
||||
<artifactId>continew-starter-extension-datapermission-mp</artifactId>
|
||||
</dependency>
|
||||
|
||||
<!-- ContiNew Starter 数据访问模块 - MyBatis Plus -->
|
||||
<dependency>
|
||||
<groupId>top.continew</groupId>
|
||||
<artifactId>continew-starter-data-mp</artifactId>
|
||||
</dependency>
|
||||
|
||||
<!-- ContiNew Starter 缓存模块 - JetCache -->
|
||||
<dependency>
|
||||
<groupId>top.continew</groupId>
|
||||
<artifactId>continew-starter-cache-jetcache</artifactId>
|
||||
</dependency>
|
||||
|
||||
<!-- ContiNew Starter 数据权限模块 - MyBatis Plus -->
|
||||
<dependency>
|
||||
<groupId>top.continew</groupId>
|
||||
<artifactId>continew-starter-extension-datapermission-mp</artifactId>
|
||||
</dependency>
|
||||
|
||||
<!-- ContiNew Starter 消息模块 - WebSocket -->
|
||||
<dependency>
|
||||
<groupId>top.continew</groupId>
|
||||
@@ -112,12 +118,6 @@
|
||||
<artifactId>continew-starter-captcha-behavior</artifactId>
|
||||
</dependency>
|
||||
|
||||
<!-- ContiNew Starter 文件处理模块 - Excel -->
|
||||
<dependency>
|
||||
<groupId>top.continew</groupId>
|
||||
<artifactId>continew-starter-file-excel</artifactId>
|
||||
</dependency>
|
||||
|
||||
<!-- ContiNew Starter 安全模块 - 限流器 -->
|
||||
<dependency>
|
||||
<groupId>top.continew</groupId>
|
||||
@@ -142,12 +142,6 @@
|
||||
<artifactId>continew-starter-security-password</artifactId>
|
||||
</dependency>
|
||||
|
||||
<!-- ContiNew Starter API 文档模块 -->
|
||||
<dependency>
|
||||
<groupId>top.continew</groupId>
|
||||
<artifactId>continew-starter-api-doc</artifactId>
|
||||
</dependency>
|
||||
|
||||
<!-- ContiNew Starter JSON 模块 - Jackson -->
|
||||
<dependency>
|
||||
<groupId>top.continew</groupId>
|
||||
|
@@ -0,0 +1,68 @@
|
||||
/*
|
||||
* 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;
|
||||
|
||||
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.stp.StpUtil;
|
||||
import cn.hutool.core.annotation.AnnotationUtil;
|
||||
import cn.hutool.core.text.CharSequenceUtil;
|
||||
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.enums.Api;
|
||||
import top.continew.starter.extension.crud.model.req.BaseReq;
|
||||
import top.continew.starter.extension.crud.service.BaseService;
|
||||
|
||||
import java.lang.reflect.Method;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 控制器基类
|
||||
*
|
||||
* @param <S> 业务接口
|
||||
* @param <L> 列表类型
|
||||
* @param <D> 详情类型
|
||||
* @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 BaseReq> extends AbstractBaseController<S, L, D, Q, C> {
|
||||
|
||||
@Override
|
||||
public void preHandle(CrudApi crudApi, Object[] args, Method targetMethod, Class<?> targetClass) throws Exception {
|
||||
SaRequest saRequest = SaHolder.getRequest();
|
||||
List<String> paramNames = saRequest.getParamNames();
|
||||
if (paramNames.stream().anyMatch(SaSignTemplate.sign::equals)) {
|
||||
return;
|
||||
}
|
||||
if (AnnotationUtil.hasAnnotation(targetMethod, SaIgnore.class) || AnnotationUtil
|
||||
.hasAnnotation(targetClass, SaIgnore.class)) {
|
||||
return;
|
||||
}
|
||||
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();
|
||||
StpUtil.checkPermission("%s:%s".formatted(prefix, apiName.toLowerCase()));
|
||||
}
|
||||
}
|
@@ -25,7 +25,7 @@ import org.hibernate.validator.constraints.Length;
|
||||
import top.continew.admin.common.constant.RegexConstants;
|
||||
import top.continew.admin.common.enums.DisEnableStatusEnum;
|
||||
import top.continew.admin.system.enums.StorageTypeEnum;
|
||||
import top.continew.admin.system.util.ValidateGroup;
|
||||
import top.continew.admin.system.validation.ValidationGroup;
|
||||
import top.continew.starter.extension.crud.model.req.BaseReq;
|
||||
|
||||
import java.io.Serial;
|
||||
@@ -71,14 +71,14 @@ public class StorageReq extends BaseReq {
|
||||
*/
|
||||
@Schema(description = "访问密钥", example = "")
|
||||
@Length(max = 255, message = "访问密钥长度不能超过 {max} 个字符")
|
||||
@NotBlank(message = "访问密钥不能为空", groups = ValidateGroup.Storage.S3.class)
|
||||
@NotBlank(message = "访问密钥不能为空", groups = ValidationGroup.Storage.S3.class)
|
||||
private String accessKey;
|
||||
|
||||
/**
|
||||
* 私有密钥
|
||||
*/
|
||||
@Schema(description = "私有密钥", example = "")
|
||||
@NotBlank(message = "私有密钥不能为空", groups = ValidateGroup.Storage.S3.class)
|
||||
@NotBlank(message = "私有密钥不能为空", groups = ValidationGroup.Storage.S3.class)
|
||||
private String secretKey;
|
||||
|
||||
/**
|
||||
@@ -86,7 +86,7 @@ public class StorageReq extends BaseReq {
|
||||
*/
|
||||
@Schema(description = "终端节点", example = "")
|
||||
@Length(max = 255, message = "终端节点长度不能超过 {max} 个字符")
|
||||
@NotBlank(message = "终端节点不能为空", groups = ValidateGroup.Storage.S3.class)
|
||||
@NotBlank(message = "终端节点不能为空", groups = ValidationGroup.Storage.S3.class)
|
||||
private String endpoint;
|
||||
|
||||
/**
|
||||
@@ -94,8 +94,8 @@ public class StorageReq extends BaseReq {
|
||||
*/
|
||||
@Schema(description = "桶名称", example = "C:/continew-admin/data/file/")
|
||||
@Length(max = 255, message = "桶名称长度不能超过 {max} 个字符")
|
||||
@NotBlank(message = "桶名称不能为空", groups = ValidateGroup.Storage.S3.class)
|
||||
@NotBlank(message = "存储路径不能为空", groups = ValidateGroup.Storage.Local.class)
|
||||
@NotBlank(message = "桶名称不能为空", groups = ValidationGroup.Storage.S3.class)
|
||||
@NotBlank(message = "存储路径不能为空", groups = ValidationGroup.Storage.Local.class)
|
||||
private String bucketName;
|
||||
|
||||
/**
|
||||
|
@@ -25,7 +25,7 @@ import lombok.Data;
|
||||
import org.hibernate.validator.constraints.Length;
|
||||
import top.continew.admin.common.constant.RegexConstants;
|
||||
import top.continew.starter.extension.crud.model.req.BaseReq;
|
||||
import top.continew.starter.extension.crud.util.ValidateGroup;
|
||||
import top.continew.starter.extension.crud.validation.CrudValidationGroup;
|
||||
|
||||
import java.io.Serial;
|
||||
|
||||
@@ -59,7 +59,7 @@ public class UserImportRowReq extends BaseReq {
|
||||
/**
|
||||
* 密码
|
||||
*/
|
||||
@NotBlank(message = "密码不能为空", groups = ValidateGroup.Crud.Add.class)
|
||||
@NotBlank(message = "密码不能为空", groups = CrudValidationGroup.Add.class)
|
||||
private String password;
|
||||
|
||||
/**
|
||||
|
@@ -28,7 +28,7 @@ import top.continew.admin.common.constant.RegexConstants;
|
||||
import top.continew.admin.common.enums.DisEnableStatusEnum;
|
||||
import top.continew.admin.common.enums.GenderEnum;
|
||||
import top.continew.starter.extension.crud.model.req.BaseReq;
|
||||
import top.continew.starter.extension.crud.util.ValidateGroup;
|
||||
import top.continew.starter.extension.crud.validation.CrudValidationGroup;
|
||||
|
||||
import java.io.Serial;
|
||||
import java.util.List;
|
||||
@@ -66,7 +66,7 @@ public class UserReq extends BaseReq {
|
||||
* 密码(加密)
|
||||
*/
|
||||
@Schema(description = "密码(加密)", example = "E7c72TH+LDxKTwavjM99W1MdI9Lljh79aPKiv3XB9MXcplhm7qJ1BJCj28yaflbdVbfc366klMtjLIWQGqb0qw==")
|
||||
@NotBlank(message = "密码不能为空", groups = ValidateGroup.Crud.Add.class)
|
||||
@NotBlank(message = "密码不能为空", groups = CrudValidationGroup.Add.class)
|
||||
private String password;
|
||||
|
||||
/**
|
||||
|
@@ -34,7 +34,7 @@ import top.continew.admin.system.service.UserService;
|
||||
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.extension.crud.service.impl.BaseServiceImpl;
|
||||
import top.continew.starter.extension.crud.service.BaseServiceImpl;
|
||||
|
||||
import javax.sql.DataSource;
|
||||
import java.util.ArrayList;
|
||||
|
@@ -35,7 +35,7 @@ import top.continew.starter.core.constant.StringConstants;
|
||||
import top.continew.starter.core.enums.BaseEnum;
|
||||
import top.continew.starter.core.validation.CheckUtils;
|
||||
import top.continew.starter.extension.crud.model.resp.LabelValueResp;
|
||||
import top.continew.starter.extension.crud.service.impl.BaseServiceImpl;
|
||||
import top.continew.starter.extension.crud.service.BaseServiceImpl;
|
||||
|
||||
import java.util.*;
|
||||
import java.util.concurrent.ConcurrentHashMap;
|
||||
|
@@ -27,7 +27,7 @@ import top.continew.admin.system.service.DictItemService;
|
||||
import top.continew.admin.system.service.DictService;
|
||||
import top.continew.starter.core.validation.CheckUtils;
|
||||
import top.continew.starter.extension.crud.model.resp.LabelValueResp;
|
||||
import top.continew.starter.extension.crud.service.impl.BaseServiceImpl;
|
||||
import top.continew.starter.extension.crud.service.BaseServiceImpl;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Optional;
|
||||
|
@@ -44,7 +44,7 @@ import top.continew.starter.core.constant.StringConstants;
|
||||
import top.continew.starter.core.util.StrUtils;
|
||||
import top.continew.starter.core.util.URLUtils;
|
||||
import top.continew.starter.core.validation.CheckUtils;
|
||||
import top.continew.starter.extension.crud.service.impl.BaseServiceImpl;
|
||||
import top.continew.starter.extension.crud.service.BaseServiceImpl;
|
||||
|
||||
import java.time.LocalDate;
|
||||
import java.util.List;
|
||||
|
@@ -34,7 +34,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.validation.CheckUtils;
|
||||
import top.continew.starter.extension.crud.service.impl.BaseServiceImpl;
|
||||
import top.continew.starter.extension.crud.service.BaseServiceImpl;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Set;
|
||||
|
@@ -27,7 +27,7 @@ import top.continew.admin.system.model.resp.dashboard.DashboardNoticeResp;
|
||||
import top.continew.admin.system.model.resp.NoticeDetailResp;
|
||||
import top.continew.admin.system.model.resp.NoticeResp;
|
||||
import top.continew.admin.system.service.NoticeService;
|
||||
import top.continew.starter.extension.crud.service.impl.BaseServiceImpl;
|
||||
import top.continew.starter.extension.crud.service.BaseServiceImpl;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
|
@@ -42,7 +42,7 @@ import top.continew.admin.system.model.resp.RoleDetailResp;
|
||||
import top.continew.admin.system.model.resp.RoleResp;
|
||||
import top.continew.admin.system.service.*;
|
||||
import top.continew.starter.core.validation.CheckUtils;
|
||||
import top.continew.starter.extension.crud.service.impl.BaseServiceImpl;
|
||||
import top.continew.starter.extension.crud.service.BaseServiceImpl;
|
||||
|
||||
import java.util.*;
|
||||
import java.util.stream.Collectors;
|
||||
|
@@ -37,13 +37,13 @@ import top.continew.admin.system.model.req.StorageReq;
|
||||
import top.continew.admin.system.model.resp.StorageResp;
|
||||
import top.continew.admin.system.service.FileService;
|
||||
import top.continew.admin.system.service.StorageService;
|
||||
import top.continew.admin.system.util.ValidateGroup;
|
||||
import top.continew.admin.system.validation.ValidationGroup;
|
||||
import top.continew.starter.core.constant.StringConstants;
|
||||
import top.continew.starter.core.util.ExceptionUtils;
|
||||
import top.continew.starter.core.util.URLUtils;
|
||||
import top.continew.starter.core.validation.CheckUtils;
|
||||
import top.continew.starter.core.validation.ValidationUtils;
|
||||
import top.continew.starter.extension.crud.service.impl.BaseServiceImpl;
|
||||
import top.continew.starter.extension.crud.service.BaseServiceImpl;
|
||||
import top.continew.starter.web.util.SpringWebUtils;
|
||||
|
||||
import java.util.Collections;
|
||||
@@ -129,7 +129,7 @@ public class StorageServiceImpl extends BaseServiceImpl<StorageMapper, StorageDO
|
||||
String bucketName = req.getBucketName();
|
||||
StorageTypeEnum type = req.getType();
|
||||
if (StorageTypeEnum.LOCAL.equals(type)) {
|
||||
ValidationUtils.validate(req, ValidateGroup.Storage.Local.class);
|
||||
ValidationUtils.validate(req, ValidationGroup.Storage.Local.class);
|
||||
req.setBucketName(StrUtil.appendIfMissing(bucketName
|
||||
.replace(StringConstants.BACKSLASH, StringConstants.SLASH), StringConstants.SLASH));
|
||||
FileStorageProperties.LocalPlusConfig config = new FileStorageProperties.LocalPlusConfig();
|
||||
@@ -139,7 +139,7 @@ public class StorageServiceImpl extends BaseServiceImpl<StorageMapper, StorageDO
|
||||
.singletonList(config)));
|
||||
SpringWebUtils.registerResourceHandler(MapUtil.of(URLUtil.url(req.getDomain()).getPath(), bucketName));
|
||||
} else if (StorageTypeEnum.S3.equals(type)) {
|
||||
ValidationUtils.validate(req, ValidateGroup.Storage.S3.class);
|
||||
ValidationUtils.validate(req, ValidationGroup.Storage.S3.class);
|
||||
FileStorageProperties.AmazonS3Config config = new FileStorageProperties.AmazonS3Config();
|
||||
config.setPlatform(req.getCode());
|
||||
config.setAccessKey(req.getAccessKey());
|
||||
|
@@ -82,7 +82,7 @@ import top.continew.starter.extension.crud.model.query.PageQuery;
|
||||
import top.continew.starter.extension.crud.model.query.SortQuery;
|
||||
import top.continew.starter.extension.crud.model.resp.PageResp;
|
||||
import top.continew.starter.extension.crud.service.CommonUserService;
|
||||
import top.continew.starter.extension.crud.service.impl.BaseServiceImpl;
|
||||
import top.continew.starter.extension.crud.service.BaseServiceImpl;
|
||||
import top.continew.starter.web.util.FileUploadUtils;
|
||||
|
||||
import java.io.IOException;
|
||||
|
@@ -14,7 +14,7 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package top.continew.admin.system.util;
|
||||
package top.continew.admin.system.validation;
|
||||
|
||||
import jakarta.validation.groups.Default;
|
||||
|
||||
@@ -24,12 +24,12 @@ import jakarta.validation.groups.Default;
|
||||
* @author Charles7c
|
||||
* @since 2024/7/3 22:01
|
||||
*/
|
||||
public interface ValidateGroup extends Default {
|
||||
public interface ValidationGroup extends Default {
|
||||
|
||||
/**
|
||||
* 分组校验-增删改查
|
||||
*/
|
||||
interface Storage extends ValidateGroup {
|
||||
interface Storage extends ValidationGroup {
|
||||
/**
|
||||
* 本地存储
|
||||
*/
|
@@ -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.starter.extension.crud.controller.BaseController;
|
||||
import top.continew.admin.common.base.BaseController;
|
||||
import ${packageName}.model.query.${classNamePrefix}Query;
|
||||
import ${packageName}.model.req.${classNamePrefix}Req;
|
||||
import ${packageName}.model.resp.${classNamePrefix}DetailResp;
|
||||
|
@@ -4,7 +4,7 @@ import lombok.RequiredArgsConstructor;
|
||||
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import top.continew.starter.extension.crud.service.impl.BaseServiceImpl;
|
||||
import top.continew.starter.extension.crud.service.BaseServiceImpl;
|
||||
import ${packageName}.mapper.${classNamePrefix}Mapper;
|
||||
import ${packageName}.model.entity.${classNamePrefix}DO;
|
||||
import ${packageName}.model.query.${classNamePrefix}Query;
|
||||
|
@@ -30,7 +30,7 @@ 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.impl.BaseServiceImpl;
|
||||
import top.continew.starter.extension.crud.service.BaseServiceImpl;
|
||||
|
||||
/**
|
||||
* 应用业务实现
|
||||
|
@@ -33,7 +33,7 @@ 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.extension.crud.annotation.CrudRequestMapping;
|
||||
import top.continew.starter.extension.crud.controller.BaseController;
|
||||
import top.continew.admin.common.base.BaseController;
|
||||
import top.continew.starter.extension.crud.enums.Api;
|
||||
|
||||
/**
|
||||
|
@@ -63,7 +63,7 @@ public class DemoEnvironmentJob {
|
||||
private static final Long MESSAGE_FLAG = 0L;
|
||||
private static final Long[] USER_FLAG = {1L, 547889293968801831L};
|
||||
private static final Long ROLE_FLAG = 547888897925840928L;
|
||||
private static final Long MENU_FLAG = 10003L;
|
||||
private static final Long MENU_FLAG = 10000L;
|
||||
private static final Long DEPT_FLAG = 547888580614160409L;
|
||||
|
||||
/**
|
||||
|
@@ -30,7 +30,7 @@ import top.continew.admin.schedule.model.req.JobStatusReq;
|
||||
import top.continew.admin.schedule.model.resp.JobResp;
|
||||
import top.continew.admin.schedule.service.JobService;
|
||||
import top.continew.starter.extension.crud.model.resp.PageResp;
|
||||
import top.continew.starter.extension.crud.util.ValidateGroup;
|
||||
import top.continew.starter.extension.crud.validation.CrudValidationGroup;
|
||||
import top.continew.starter.log.core.annotation.Log;
|
||||
|
||||
import java.util.List;
|
||||
@@ -61,7 +61,7 @@ public class JobController {
|
||||
@Operation(summary = "新增任务", description = "新增任务")
|
||||
@SaCheckPermission("schedule:job:add")
|
||||
@PostMapping
|
||||
public void add(@Validated(ValidateGroup.Crud.Add.class) @RequestBody JobReq req) {
|
||||
public void add(@Validated(CrudValidationGroup.Add.class) @RequestBody JobReq req) {
|
||||
baseService.add(req);
|
||||
}
|
||||
|
||||
@@ -69,7 +69,7 @@ public class JobController {
|
||||
@Parameter(name = "id", description = "ID", example = "1", in = ParameterIn.PATH)
|
||||
@SaCheckPermission("schedule:job:update")
|
||||
@PutMapping("/{id}")
|
||||
public void update(@Validated(ValidateGroup.Crud.Update.class) @RequestBody JobReq req, @PathVariable Long id) {
|
||||
public void update(@Validated(CrudValidationGroup.Update.class) @RequestBody JobReq req, @PathVariable Long id) {
|
||||
baseService.update(req, id);
|
||||
}
|
||||
|
||||
|
@@ -18,12 +18,12 @@ package top.continew.admin.controller.system;
|
||||
|
||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
import top.continew.admin.common.base.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;
|
||||
import top.continew.admin.system.service.DeptService;
|
||||
import top.continew.starter.extension.crud.annotation.CrudRequestMapping;
|
||||
import top.continew.starter.extension.crud.controller.BaseController;
|
||||
import top.continew.starter.extension.crud.enums.Api;
|
||||
|
||||
/**
|
||||
|
@@ -23,7 +23,7 @@ import top.continew.admin.system.model.req.DictReq;
|
||||
import top.continew.admin.system.model.resp.DictResp;
|
||||
import top.continew.admin.system.service.DictService;
|
||||
import top.continew.starter.extension.crud.annotation.CrudRequestMapping;
|
||||
import top.continew.starter.extension.crud.controller.BaseController;
|
||||
import top.continew.admin.common.base.BaseController;
|
||||
import top.continew.starter.extension.crud.enums.Api;
|
||||
|
||||
/**
|
||||
|
@@ -23,7 +23,7 @@ import top.continew.admin.system.model.req.DictItemReq;
|
||||
import top.continew.admin.system.model.resp.DictItemResp;
|
||||
import top.continew.admin.system.service.DictItemService;
|
||||
import top.continew.starter.extension.crud.annotation.CrudRequestMapping;
|
||||
import top.continew.starter.extension.crud.controller.BaseController;
|
||||
import top.continew.admin.common.base.BaseController;
|
||||
import top.continew.starter.extension.crud.enums.Api;
|
||||
import top.continew.starter.log.core.annotation.Log;
|
||||
|
||||
|
@@ -27,7 +27,7 @@ import top.continew.admin.system.model.resp.FileResp;
|
||||
import top.continew.admin.system.model.resp.FileStatisticsResp;
|
||||
import top.continew.admin.system.service.FileService;
|
||||
import top.continew.starter.extension.crud.annotation.CrudRequestMapping;
|
||||
import top.continew.starter.extension.crud.controller.BaseController;
|
||||
import top.continew.admin.common.base.BaseController;
|
||||
import top.continew.starter.extension.crud.enums.Api;
|
||||
import top.continew.starter.log.core.annotation.Log;
|
||||
|
||||
|
@@ -19,10 +19,8 @@ package top.continew.admin.controller.system;
|
||||
import cn.hutool.core.util.ObjectUtil;
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
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.RequestBody;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
import top.continew.admin.common.base.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;
|
||||
@@ -30,11 +28,11 @@ import top.continew.admin.system.service.MenuService;
|
||||
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.extension.crud.annotation.CrudApi;
|
||||
import top.continew.starter.extension.crud.annotation.CrudRequestMapping;
|
||||
import top.continew.starter.extension.crud.controller.BaseController;
|
||||
import top.continew.starter.extension.crud.enums.Api;
|
||||
import top.continew.starter.extension.crud.model.resp.BaseIdResp;
|
||||
import top.continew.starter.extension.crud.util.ValidateGroup;
|
||||
|
||||
import java.lang.reflect.Method;
|
||||
|
||||
/**
|
||||
* 菜单管理 API
|
||||
@@ -48,23 +46,13 @@ import top.continew.starter.extension.crud.util.ValidateGroup;
|
||||
public class MenuController extends BaseController<MenuService, MenuResp, MenuResp, MenuQuery, MenuReq> {
|
||||
|
||||
@Override
|
||||
public BaseIdResp<Long> add(@Validated(ValidateGroup.Crud.Add.class) @RequestBody MenuReq req) {
|
||||
this.checkPath(req);
|
||||
return super.add(req);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void update(@Validated(ValidateGroup.Crud.Update.class) @RequestBody MenuReq req, @PathVariable Long id) {
|
||||
this.checkPath(req);
|
||||
super.update(req, id);
|
||||
}
|
||||
|
||||
/**
|
||||
* 检查路由地址格式
|
||||
*
|
||||
* @param req 创建或修改参数
|
||||
*/
|
||||
private void checkPath(MenuReq req) {
|
||||
public void preHandle(CrudApi crudApi, Object[] args, Method targetMethod, Class<?> targetClass) throws Exception {
|
||||
super.preHandle(crudApi, args, targetMethod, targetClass);
|
||||
Api api = crudApi.value();
|
||||
if (!(Api.ADD.equals(api) || Api.UPDATE.equals(api))) {
|
||||
return;
|
||||
}
|
||||
MenuReq req = (MenuReq)args[0];
|
||||
Boolean isExternal = ObjectUtil.defaultIfNull(req.getIsExternal(), false);
|
||||
String path = req.getPath();
|
||||
ValidationUtils.throwIf(Boolean.TRUE.equals(isExternal) && !URLUtils
|
||||
|
@@ -17,10 +17,8 @@
|
||||
package top.continew.admin.controller.system;
|
||||
|
||||
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.RequestBody;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
import top.continew.admin.common.base.BaseController;
|
||||
import top.continew.admin.system.enums.NoticeScopeEnum;
|
||||
import top.continew.admin.system.model.query.NoticeQuery;
|
||||
import top.continew.admin.system.model.req.NoticeReq;
|
||||
@@ -28,12 +26,11 @@ import top.continew.admin.system.model.resp.NoticeDetailResp;
|
||||
import top.continew.admin.system.model.resp.NoticeResp;
|
||||
import top.continew.admin.system.service.NoticeService;
|
||||
import top.continew.starter.core.validation.ValidationUtils;
|
||||
import top.continew.starter.extension.crud.annotation.CrudApi;
|
||||
import top.continew.starter.extension.crud.annotation.CrudRequestMapping;
|
||||
import top.continew.starter.extension.crud.controller.BaseController;
|
||||
import top.continew.starter.extension.crud.enums.Api;
|
||||
import top.continew.starter.extension.crud.model.resp.BaseIdResp;
|
||||
import top.continew.starter.extension.crud.util.ValidateGroup;
|
||||
|
||||
import java.lang.reflect.Method;
|
||||
import java.time.LocalDateTime;
|
||||
|
||||
/**
|
||||
@@ -48,23 +45,13 @@ import java.time.LocalDateTime;
|
||||
public class NoticeController extends BaseController<NoticeService, NoticeResp, NoticeDetailResp, NoticeQuery, NoticeReq> {
|
||||
|
||||
@Override
|
||||
public BaseIdResp<Long> add(@Validated(ValidateGroup.Crud.Add.class) @RequestBody NoticeReq req) {
|
||||
this.check(req);
|
||||
return super.add(req);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void update(@Validated(ValidateGroup.Crud.Update.class) @RequestBody NoticeReq req, @PathVariable Long id) {
|
||||
this.check(req);
|
||||
super.update(req, id);
|
||||
}
|
||||
|
||||
/**
|
||||
* 校验
|
||||
*
|
||||
* @param req 创建或修改参数
|
||||
*/
|
||||
private void check(NoticeReq req) {
|
||||
public void preHandle(CrudApi crudApi, Object[] args, Method targetMethod, Class<?> targetClass) throws Exception {
|
||||
super.preHandle(crudApi, args, targetMethod, targetClass);
|
||||
Api api = crudApi.value();
|
||||
if (!(Api.ADD.equals(api) || Api.UPDATE.equals(api))) {
|
||||
return;
|
||||
}
|
||||
NoticeReq req = (NoticeReq)args[0];
|
||||
// 校验生效时间
|
||||
LocalDateTime effectiveTime = req.getEffectiveTime();
|
||||
LocalDateTime terminateTime = req.getTerminateTime();
|
||||
|
@@ -34,7 +34,7 @@ import top.continew.admin.system.model.resp.RoleResp;
|
||||
import top.continew.admin.system.service.RoleService;
|
||||
import top.continew.admin.system.service.UserRoleService;
|
||||
import top.continew.starter.extension.crud.annotation.CrudRequestMapping;
|
||||
import top.continew.starter.extension.crud.controller.BaseController;
|
||||
import top.continew.admin.common.base.BaseController;
|
||||
import top.continew.starter.extension.crud.enums.Api;
|
||||
|
||||
import java.util.List;
|
||||
|
@@ -23,7 +23,7 @@ import top.continew.admin.system.model.req.StorageReq;
|
||||
import top.continew.admin.system.model.resp.StorageResp;
|
||||
import top.continew.admin.system.service.StorageService;
|
||||
import top.continew.starter.extension.crud.annotation.CrudRequestMapping;
|
||||
import top.continew.starter.extension.crud.controller.BaseController;
|
||||
import top.continew.admin.common.base.BaseController;
|
||||
import top.continew.starter.extension.crud.enums.Api;
|
||||
|
||||
/**
|
||||
|
@@ -44,10 +44,10 @@ 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.extension.crud.annotation.CrudRequestMapping;
|
||||
import top.continew.starter.extension.crud.controller.BaseController;
|
||||
import top.continew.admin.common.base.BaseController;
|
||||
import top.continew.starter.extension.crud.enums.Api;
|
||||
import top.continew.starter.extension.crud.model.resp.BaseIdResp;
|
||||
import top.continew.starter.extension.crud.util.ValidateGroup;
|
||||
import top.continew.starter.extension.crud.validation.CrudValidationGroup;
|
||||
|
||||
import java.io.IOException;
|
||||
|
||||
@@ -68,7 +68,7 @@ public class UserController extends BaseController<UserService, UserResp, UserDe
|
||||
private final UserService userService;
|
||||
|
||||
@Override
|
||||
public BaseIdResp<Long> add(@Validated(ValidateGroup.Crud.Add.class) @RequestBody UserReq req) {
|
||||
public BaseIdResp<Long> add(@Validated(CrudValidationGroup.Add.class) @RequestBody UserReq req) {
|
||||
String rawPassword = ExceptionUtils.exToNull(() -> SecureUtils.decryptByRsaPrivateKey(req.getPassword()));
|
||||
ValidationUtils.throwIfNull(rawPassword, "密码解密失败");
|
||||
ValidationUtils.throwIf(!ReUtil
|
||||
|
@@ -5,5 +5,5 @@
|
||||
\____|\___/ |_| |_| \__||_||_| \_| \___| \_/\_/ /_/ \_\\__,_||_| |_| |_||_||_| |_|
|
||||
|
||||
:: ${project.name} :: v${project.version}
|
||||
:: ContiNew Starter :: v2.7.4
|
||||
:: ContiNew Starter :: v2.7.5
|
||||
:: Spring Boot :: v${spring-boot.version}
|
||||
|
Reference in New Issue
Block a user