mirror of
				https://github.com/continew-org/continew-admin.git
				synced 2025-10-31 10:57:13 +08:00 
			
		
		
		
	build: continew-starter 2.13.3 => 2.13.4
1.移除 continew-starter-security-password 模块依赖及相关配置(已融合到 security-crypto 模块) 2.更新 continew-starter-security-crypto 模块配置 3.BaseController 增加跳过 DICT、DICT_TREE 接口权限处理 4.EnableCrudRestController => EnableCrudApi 5.调整 CRUD 相关 Controller API 接口配置,增加 DICT 或 DICT_TREE 接口,移除原 CommonController 接口
This commit is contained in:
		
							
								
								
									
										10
									
								
								README.md
									
									
									
									
									
								
							
							
						
						
									
										10
									
								
								README.md
									
									
									
									
									
								
							| @@ -4,7 +4,7 @@ | ||||
| <img src="https://img.shields.io/badge/SNAPSHOT-v4.0.0-%23ff3f59.svg" alt="Release" /> | ||||
| </a> | ||||
| <a href="https://github.com/continew-org/continew-starter" title="ContiNew Starter" target="_blank"> | ||||
| <img src="https://img.shields.io/badge/ContiNew Starter-2.13.3-%236CB52D.svg" alt="ContiNew Starter" /> | ||||
| <img src="https://img.shields.io/badge/ContiNew Starter-2.13.4-%236CB52D.svg" alt="ContiNew Starter" /> | ||||
| </a> | ||||
| <a href="https://spring.io/projects/spring-boot" title="Spring Boot" target="_blank"> | ||||
| <img src="https://img.shields.io/badge/Spring Boot-3.3.12-%236CB52D.svg?logo=Spring-Boot" alt="Spring Boot" /> | ||||
| @@ -88,12 +88,12 @@ ContiNew Admin(Continue New Admin),页面现代美观,且专注设计与 | ||||
|  | ||||
| 2.**Starter 组件:** 从 v2.1.0 版本开始,抽取并封装后端基础组件及各框架集成配置到 ContiNew Starter 项目,且 **[已发布至 Maven 中央仓库](https://central.sonatype.com/search?q=continew-starter&namespace=top.continew)**,可在你的任意项目中直接引入所需依赖使用。即使你不用脚手架项目,难道能让你搭项目框架更快、更爽、更省力的 Starter 也要 Say No 吗? | ||||
|  | ||||
| 3.**CRUD 套件:** 封装通用增删改查套件,适配后端各分层,几分钟即可提供一套 CRUD API,包括新增、修改、批量删除、查询详情、分页列表查询、全部列表查询、树型列表查询、导出到 Excel,且 API 支持按实际所需开放或扩展。 | ||||
| 3.**CRUD 套件:** 封装通用增删改查套件,适配后端各分层,几分钟即可提供一套 CRUD API,包括新增、修改、批量删除、查询详情、分页列表查询、全部列表查询、树型列表查询、导出到 Excel,甚至是字典列表(用于下拉选项场景),且 API 支持按实际所需开放或扩展。 | ||||
|  | ||||
| ```java | ||||
| @Tag(name = "部门管理 API") | ||||
| @RestController | ||||
| @CrudRequestMapping(value = "/system/dept", api = {Api.TREE, Api.GET, Api.CREATE, Api.UPDATE, Api.DELETE, Api.EXPORT}) | ||||
| @CrudRequestMapping(value = "/system/dept", api = {Api.TREE, Api.GET, Api.CREATE, Api.UPDATE, Api.DELETE, Api.EXPORT, Api.DICT_TREE}) | ||||
| public class DeptController extends BaseController<DeptService, DeptResp, DeptDetailResp, DeptQuery, DeptReq> {} | ||||
| ``` | ||||
|  | ||||
| @@ -231,7 +231,7 @@ public class DeptController extends BaseController<DeptService, DeptResp, DeptDe | ||||
| | <a href="https://arco.design/vue/docs/start" target="_blank">Arco Design</a> | 2.57.0       | 字节跳动推出的前端 UI 框架,年轻化的色彩和组件设计。         | | ||||
| | <a href="https://www.typescriptlang.org/zh/" target="_blank">TypeScript</a> | 5.0.4        | TypeScript 是微软开发的一个开源的编程语言,通过在 JavaScript 的基础上添加静态类型定义构建而成。 | | ||||
| | <a href="https://vite.dev/" target="_blank">Vite</a>         | 5.1.5        | 下一代的前端工具链,为开发提供极速响应。                     | | ||||
| | [ContiNew Starter](https://github.com/continew-org/continew-starter) | 2.13.3       | ContiNew Starter 包含了一系列经过企业实践优化的依赖包(如 MyBatis-Plus、SaToken),可轻松集成到应用中,为开发人员减少手动引入依赖及配置的麻烦,为 Spring Boot Web 项目的灵活快速构建提供支持。 | | ||||
| | [ContiNew Starter](https://github.com/continew-org/continew-starter) | 2.13.4       | ContiNew Starter 包含了一系列经过企业实践优化的依赖包(如 MyBatis-Plus、SaToken),可轻松集成到应用中,为开发人员减少手动引入依赖及配置的麻烦,为 Spring Boot Web 项目的灵活快速构建提供支持。 | | ||||
| | <a href="https://spring.io/projects/spring-boot" target="_blank">Spring Boot</a> | 3.3.12       | 简化 Spring 应用的初始搭建和开发过程,基于“约定优于配置”的理念,使开发人员不再需要定义样板化的配置。(Spring Boot 3.0 开始,要求 Java 17 作为最低版本) | | ||||
| | <a href="https://undertow.io/" target="_blank">Undertow</a>  | 2.3.18.Final | 采用 Java 开发的灵活的高性能 Web 服务器,提供包括阻塞和基于 NIO 的非堵塞机制。 | | ||||
| | <a href="https://sa-token.dev33.cn/" target="_blank">Sa-Token + JWT</a> | 1.44.0       | 轻量级 Java 权限认证框架,让鉴权变得简单、优雅。             | | ||||
| @@ -253,7 +253,7 @@ public class DeptController extends BaseController<DeptService, DeptResp, DeptDe | ||||
| | [AJ-Captcha](https://ajcaptcha.beliefteam.cn/captcha-doc/)   | 1.3.0        | Java 行为验证码,包含滑动拼图、文字点选两种方式,UI支持弹出和嵌入两种方式。 | | ||||
| | Easy Captcha                                                 | 1.6.2        | Java 图形验证码,支持 gif、中文、算术等类型,可用于 Java Web、JavaSE 等项目。 | | ||||
| | [Crane4j](https://createsequence.gitee.io/crane4j-doc/#/)    | 2.9.0        | 一个基于注解的,用于完成一切 “根据 A 的 key 值拿到 B,再把 B 的属性映射到 A” 这类需求的字段填充框架。 | | ||||
| | [SpEL Validator](https://spel-validator.sticki.cn/)          | 0.5.1-beta   | 基于 SpEL 的 jakarta.validation-api 扩展增强包。             | | ||||
| | [SpEL Validator](https://spel-validator.sticki.cn/)          | 0.5.2-beta   | 基于 SpEL 的 jakarta.validation-api 扩展增强包。             | | ||||
| | [CosID](https://cosid.ahoo.me/guide/getting-started.html)    | 2.13.0       | 旨在提供通用、灵活、高性能的分布式 ID 生成器。               | | ||||
| | [Graceful Response](https://doc.feiniaojin.com/graceful-response/home.html) | 5.0.4-boot3  | 一个Spring Boot技术栈下的优雅响应处理组件,可以帮助开发者完成响应数据封装、异常处理、错误码填充等过程,提高开发效率,提高代码质量。 | | ||||
| | <a href="https://doc.xiaominfo.com/" target="_blank">Knife4j</a> | 4.5.0        | 前身是 swagger-bootstrap-ui,集 Swagger2 和 OpenAPI3 为一体的增强解决方案。 | | ||||
|   | ||||
| @@ -102,12 +102,6 @@ | ||||
|             <artifactId>continew-starter-auth-justauth</artifactId> | ||||
|         </dependency> | ||||
|  | ||||
|         <!-- ContiNew Starter 安全模块 - 密码编码器 --> | ||||
|         <dependency> | ||||
|             <groupId>top.continew.starter</groupId> | ||||
|             <artifactId>continew-starter-security-password</artifactId> | ||||
|         </dependency> | ||||
|  | ||||
|         <!-- ContiNew Starter 安全模块 - 加密 --> | ||||
|         <dependency> | ||||
|             <groupId>top.continew.starter</groupId> | ||||
|   | ||||
| @@ -73,6 +73,10 @@ public class BaseController<S extends BaseService<L, D, Q, C>, L, D, Q, C> exten | ||||
|                 return; | ||||
|             } | ||||
|         } | ||||
|         // 不需要校验 DICT、DICT_TREE 接口权限 | ||||
|         if (Api.DICT.equals(crudApi.value()) || Api.DICT_TREE.equals(crudApi.value())) { | ||||
|             return; | ||||
|         } | ||||
|         // 校验权限,例如:创建用户接口(POST /system/user) => 校验 system:user:create 权限 | ||||
|         String permissionPrefix = CrudApiPermissionPrefixCache.get(targetClass); | ||||
|         String apiName = getApiName(crudApi.value()); | ||||
|   | ||||
| @@ -19,14 +19,16 @@ package top.continew.admin.common.config.doc; | ||||
| import cn.dev33.satoken.annotation.SaCheckPermission; | ||||
| import cn.dev33.satoken.annotation.SaCheckRole; | ||||
| import cn.dev33.satoken.annotation.SaMode; | ||||
| import cn.hutool.core.text.CharSequenceUtil; | ||||
| import org.springframework.web.method.HandlerMethod; | ||||
| import top.continew.admin.common.base.controller.BaseController; | ||||
| import top.continew.admin.common.config.crud.CrudApiPermissionPrefixCache; | ||||
| 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.enums.Api; | ||||
|  | ||||
| import java.lang.annotation.Annotation; | ||||
| import java.lang.reflect.Method; | ||||
| import java.util.ArrayList; | ||||
| import java.util.List; | ||||
|  | ||||
| @@ -160,18 +162,21 @@ public class OperationDescriptionCustomizer { | ||||
|      * | ||||
|      * @param handlerMethod 处理程序方法 | ||||
|      * @return 拼接好的权限信息字符串 | ||||
|      * @see BaseController#preHandle(CrudApi, Object[], Method, Class) | ||||
|      */ | ||||
|     private String getCrudPermissionInfo(HandlerMethod handlerMethod) { | ||||
|         CrudRequestMapping crudRequestMapping = handlerMethod.getBeanType().getAnnotation(CrudRequestMapping.class); | ||||
|         Class<?> targetClass = handlerMethod.getBeanType(); | ||||
|         CrudRequestMapping crudRequestMapping = targetClass.getAnnotation(CrudRequestMapping.class); | ||||
|         CrudApi crudApi = handlerMethod.getMethodAnnotation(CrudApi.class); | ||||
|         if (crudRequestMapping == null || crudApi == null) { | ||||
|             return StringConstants.EMPTY; | ||||
|         } | ||||
|  | ||||
|         String path = crudRequestMapping.value(); | ||||
|         String prefix = String.join(StringConstants.COLON, CharSequenceUtil.splitTrim(path, StringConstants.SLASH)); | ||||
|         if (Api.DICT.equals(crudApi.value()) || Api.DICT_TREE.equals(crudApi.value())) { | ||||
|             return StringConstants.EMPTY; | ||||
|         } | ||||
|         String permissionPrefix = CrudApiPermissionPrefixCache.get(targetClass); | ||||
|         String apiName = BaseController.getApiName(crudApi.value()); | ||||
|         String permission = "%s:%s".formatted(prefix, apiName.toLowerCase()); | ||||
|         String permission = "%s:%s".formatted(permissionPrefix, apiName.toLowerCase()); | ||||
|         return "<font style=\"color:red\" class=\"light-red\">CRUD 权限校验:</font></br><font style=\"color:red\" class=\"light-red\">方法:</font><font style=\"color:red\" class=\"light-red\">" + permission + "</font>"; | ||||
|     } | ||||
| } | ||||
|   | ||||
| @@ -22,5 +22,5 @@ import ${packageName}.service.${classNamePrefix}Service; | ||||
|  */ | ||||
| @Tag(name = "${businessName}管理 API") | ||||
| @RestController | ||||
| @CrudRequestMapping(value = "/${apiModuleName}/${apiName}", api = {Api.PAGE, Api.GET, Api.CREATE, Api.UPDATE, Api.BATCH_DELETE, Api.EXPORT}) | ||||
| @CrudRequestMapping(value = "/${apiModuleName}/${apiName}", api = {Api.PAGE, Api.GET, Api.CREATE, Api.UPDATE, Api.BATCH_DELETE, Api.EXPORT, Api.DICT}) | ||||
| public class ${className} extends BaseController<${classNamePrefix}Service, ${classNamePrefix}Resp, ${classNamePrefix}DetailResp, ${classNamePrefix}Query, ${classNamePrefix}Req> {} | ||||
| @@ -1,4 +1,5 @@ | ||||
| import http from '@/utils/http' | ||||
| import type { LabelValueState } from '@/types/global' | ||||
|  | ||||
| const BASE_URL = '/${apiModuleName}/${apiName}' | ||||
|  | ||||
| @@ -64,3 +65,8 @@ export function delete${classNamePrefix}(id: string) { | ||||
| export function export${classNamePrefix}(query: ${classNamePrefix}Query) { | ||||
|   return http.download(`${'$'}{BASE_URL}/export`, query) | ||||
| } | ||||
|  | ||||
| /** @desc 查询${businessName}字典 */ | ||||
| export function list${classNamePrefix}Dict(query?: ${classNamePrefix}Query) { | ||||
| return http.get<LabelValueState[]>(`${BASE_URL}/dict`, query) | ||||
| } | ||||
|   | ||||
| @@ -1,5 +1,5 @@ | ||||
| <template> | ||||
|   <div class="gi_table_page"> | ||||
|   <GiPageLayout> | ||||
|     <GiTable | ||||
|       title="${businessName}管理" | ||||
|       row-key="id" | ||||
| @@ -102,7 +102,7 @@ | ||||
|  | ||||
|     <${classNamePrefix}AddModal ref="${classNamePrefix}AddModalRef" @save-success="search" /> | ||||
|     <${classNamePrefix}DetailDrawer ref="${classNamePrefix}DetailDrawerRef" /> | ||||
|   </div> | ||||
|   </GiPageLayout> | ||||
| </template> | ||||
|  | ||||
| <script setup lang="ts"> | ||||
|   | ||||
| @@ -25,16 +25,10 @@ import org.springframework.web.bind.annotation.GetMapping; | ||||
| import org.springframework.web.bind.annotation.RequestMapping; | ||||
| import org.springframework.web.bind.annotation.RequestParam; | ||||
| import org.springframework.web.bind.annotation.RestController; | ||||
| import top.continew.admin.tenant.model.query.PackageQuery; | ||||
| import top.continew.admin.tenant.service.PackageService; | ||||
| import top.continew.admin.tenant.service.TenantService; | ||||
| import top.continew.starter.extension.crud.model.query.SortQuery; | ||||
| import top.continew.starter.extension.crud.model.resp.LabelValueResp; | ||||
| import top.continew.starter.extension.tenant.annotation.TenantIgnore; | ||||
| import top.continew.starter.log.annotation.Log; | ||||
|  | ||||
| import java.util.List; | ||||
|  | ||||
| /** | ||||
|  * 公共 API | ||||
|  * | ||||
| @@ -49,16 +43,8 @@ import java.util.List; | ||||
| @RequestMapping("/tenant/common") | ||||
| public class CommonController { | ||||
|  | ||||
|     private final PackageService packageService; | ||||
|  | ||||
|     private final TenantService tenantService; | ||||
|  | ||||
|     @Operation(summary = "查询套餐字典", description = "查询套餐字典列表") | ||||
|     @GetMapping("/dict/package") | ||||
|     public List<LabelValueResp> listPackageDict(PackageQuery query, SortQuery sortQuery) { | ||||
|         return packageService.listDict(query, sortQuery); | ||||
|     } | ||||
|  | ||||
|     @SaIgnore | ||||
|     @TenantIgnore | ||||
|     @Operation(summary = "根据域名查询租户 ID", description = "根据域名查询租户 ID") | ||||
|   | ||||
| @@ -46,7 +46,7 @@ import java.util.List; | ||||
| @Tag(name = "套餐管理 API") | ||||
| @RestController | ||||
| @RequiredArgsConstructor | ||||
| @CrudRequestMapping(value = "/tenant/package", api = {Api.LIST, Api.PAGE, Api.GET, Api.CREATE, Api.UPDATE, Api.DELETE}) | ||||
| @CrudRequestMapping(value = "/tenant/package", api = {Api.LIST, Api.PAGE, Api.GET, Api.CREATE, Api.UPDATE, Api.DELETE, Api.DICT}) | ||||
| public class PackageController extends BaseController<PackageService, PackageResp, PackageDetailResp, PackageQuery, PackageReq> { | ||||
|  | ||||
|     private final TenantExtensionProperties tenantExtensionProperties; | ||||
|   | ||||
| @@ -36,7 +36,7 @@ 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.application.ApplicationProperties; | ||||
| import top.continew.starter.extension.crud.annotation.EnableCrudRestController; | ||||
| import top.continew.starter.extension.crud.annotation.EnableCrudApi; | ||||
| import top.continew.starter.web.annotation.EnableGlobalResponse; | ||||
| import top.continew.starter.web.model.R; | ||||
|  | ||||
| @@ -47,10 +47,10 @@ import top.continew.starter.web.model.R; | ||||
|  * @since 2022/12/8 23:15 | ||||
|  */ | ||||
| @Slf4j | ||||
| @EnableCrudApi | ||||
| @EnableGlobalResponse | ||||
| @EnableFileStorage | ||||
| @EnableMethodCache(basePackages = "top.continew.admin") | ||||
| @EnableGlobalResponse | ||||
| @EnableCrudRestController | ||||
| @EnableFeignClients | ||||
| @RestController | ||||
| @SpringBootApplication | ||||
|   | ||||
| @@ -119,9 +119,8 @@ logging: | ||||
|   file: | ||||
|     path: ./logs | ||||
|  | ||||
| --- ### 安全配置:字段加/解密配置 | ||||
| continew-starter.security: | ||||
|   crypto: | ||||
| --- ### 安全配置:加/解密配置 | ||||
| continew-starter.security.crypto: | ||||
|   enabled: true | ||||
|   # 默认算法,即 @FieldEncrypt 默认采用的算法(默认:AES 对称加密算法) | ||||
|   algorithm: AES | ||||
| @@ -130,6 +129,11 @@ continew-starter.security: | ||||
|   # 非对称加密算法密钥(在线生成 RSA 密钥对:http://web.chacuo.net/netrsakeypair) | ||||
|   public-key: MFwwDQYJKoZIhvcNAQEBBQADSwAwSAJBAM51dgYtMyF+tTQt80sfFOpSV27a7t9uaUVeFrdGiVxscuizE7H8SMntYqfn9lp8a5GH5P1/GGehVjUD2gF/4kcCAwEAAQ== | ||||
|   private-key: MIIBVQIBADANBgkqhkiG9w0BAQEFAASCAT8wggE7AgEAAkEAznV2Bi0zIX61NC3zSx8U6lJXbtru325pRV4Wt0aJXGxy6LMTsfxIye1ip+f2WnxrkYfk/X8YZ6FWNQPaAX/iRwIDAQABAkEAk/VcAusrpIqA5Ac2P5Tj0VX3cOuXmyouaVcXonr7f+6y2YTjLQuAnkcfKKocQI/juIRQBFQIqqW/m1nmz1wGeQIhAO8XaA/KxzOIgU0l/4lm0A2Wne6RokJ9HLs1YpOzIUmVAiEA3Q9DQrpAlIuiT1yWAGSxA9RxcjUM/1kdVLTkv0avXWsCIE0X8woEjK7lOSwzMG6RpEx9YHdopjViOj1zPVH61KTxAiBmv/dlhqkJ4rV46fIXELZur0pj6WC3N7a4brR8a+CLLQIhAMQyerWl2cPNVtE/8tkziHKbwW3ZUiBXU24wFxedT9iV | ||||
|   ## 密码编码器配置 | ||||
|   password-encoder: | ||||
|     enabled: true | ||||
|     # 默认启用的编码器算法(默认:BCrypt 加密算法) | ||||
|     algorithm: BCRYPT | ||||
|  | ||||
| --- ### 验证码配置 | ||||
| continew-starter.captcha: | ||||
|   | ||||
| @@ -128,9 +128,8 @@ logging: | ||||
|   file: | ||||
|     path: ../logs | ||||
|  | ||||
| --- ### 安全配置:字段加/解密配置 | ||||
| continew-starter.security: | ||||
|   crypto: | ||||
| --- ### 安全配置:加/解密配置 | ||||
| continew-starter.security.crypto: | ||||
|   enabled: true | ||||
|   # 默认算法,即 @FieldEncrypt 默认采用的算法(默认:AES 对称加密算法) | ||||
|   algorithm: AES | ||||
| @@ -139,6 +138,11 @@ continew-starter.security: | ||||
|   # 非对称加密算法密钥(在线生成 RSA 密钥对:http://web.chacuo.net/netrsakeypair) | ||||
|   public-key: MFwwDQYJKoZIhvcNAQEBBQADSwAwSAJBAM51dgYtMyF+tTQt80sfFOpSV27a7t9uaUVeFrdGiVxscuizE7H8SMntYqfn9lp8a5GH5P1/GGehVjUD2gF/4kcCAwEAAQ== | ||||
|   private-key: MIIBVQIBADANBgkqhkiG9w0BAQEFAASCAT8wggE7AgEAAkEAznV2Bi0zIX61NC3zSx8U6lJXbtru325pRV4Wt0aJXGxy6LMTsfxIye1ip+f2WnxrkYfk/X8YZ6FWNQPaAX/iRwIDAQABAkEAk/VcAusrpIqA5Ac2P5Tj0VX3cOuXmyouaVcXonr7f+6y2YTjLQuAnkcfKKocQI/juIRQBFQIqqW/m1nmz1wGeQIhAO8XaA/KxzOIgU0l/4lm0A2Wne6RokJ9HLs1YpOzIUmVAiEA3Q9DQrpAlIuiT1yWAGSxA9RxcjUM/1kdVLTkv0avXWsCIE0X8woEjK7lOSwzMG6RpEx9YHdopjViOj1zPVH61KTxAiBmv/dlhqkJ4rV46fIXELZur0pj6WC3N7a4brR8a+CLLQIhAMQyerWl2cPNVtE/8tkziHKbwW3ZUiBXU24wFxedT9iV | ||||
|   ## 密码编码器配置 | ||||
|   password-encoder: | ||||
|     enabled: true | ||||
|     # 默认启用的编码器算法(默认:BCrypt 加密算法) | ||||
|     algorithm: BCRYPT | ||||
|  | ||||
| --- ### 验证码配置 | ||||
| continew-starter.captcha: | ||||
|   | ||||
| @@ -7,7 +7,7 @@ application: | ||||
|   description: 持续迭代优化的前后端分离中后台管理系统框架,开箱即用,持续提供舒适的开发体验。 | ||||
|   # 版本 | ||||
|   version: 4.0.0-SNAPSHOT | ||||
|   starter: 2.13.3 | ||||
|   starter: 2.13.4 | ||||
|   # 基本包 | ||||
|   base-package: top.continew.admin | ||||
|   ## 作者信息配置 | ||||
| @@ -89,8 +89,7 @@ spring.task: | ||||
|       await-termination-period: 30s | ||||
|  | ||||
| --- ### 文件上传配置 | ||||
| spring.servlet: | ||||
|   multipart: | ||||
| spring.servlet.multipart: | ||||
|   enabled: true | ||||
|   # 单文件上传大小限制 | ||||
|   max-file-size: 10MB | ||||
| @@ -135,8 +134,7 @@ knife4j: | ||||
|     footer-custom-content: 'Copyright © 2022-present [${application.contact.name}](${application.contact.url}) ⋅ [${application.name}](${application.url}) v${application.version}' | ||||
|  | ||||
| --- ### 全局响应配置 | ||||
| continew-starter.web: | ||||
|   response: | ||||
| continew-starter.web.response: | ||||
|   # 是否开启国际化(默认:false) | ||||
|   i18n: false | ||||
|   # 自定义失败 HTTP 状态码(默认:200,建议业务和通信状态码区分) | ||||
| @@ -182,13 +180,6 @@ continew-starter.trace: | ||||
|     pattern: '[$spanId][$traceId]' | ||||
|     mdc-enable: false | ||||
|  | ||||
| --- ### 安全配置:密码编码器配置 | ||||
| continew-starter.security: | ||||
|   password: | ||||
|     enabled: true | ||||
|     # 默认启用的编码器算法(默认:BCrypt 加密算法) | ||||
|     algorithm: BCRYPT | ||||
|  | ||||
| --- ### CRUD 配置 | ||||
| continew-starter.crud: | ||||
|   ## 全局树结构配置(简单树,对应前端 UI) | ||||
| @@ -237,8 +228,7 @@ continew-starter.tenant: | ||||
|     - 9000 # 开发工具 | ||||
|  | ||||
| --- ### 限流器配置 | ||||
| continew-starter: | ||||
|   rate-limiter: | ||||
| continew-starter.rate-limiter: | ||||
|   enabled: true | ||||
|   key-prefix: RateLimiter | ||||
|  | ||||
|   | ||||
| @@ -38,7 +38,7 @@ public class DictApiImpl implements DictApi { | ||||
|  | ||||
|     @Override | ||||
|     public List<LabelValueResp> listAll() { | ||||
|         List<LabelValueResp> list = baseService.listDict(null, null); | ||||
|         List<LabelValueResp> list = baseService.dict(null, null); | ||||
|         list.addAll(baseService.listEnumDict()); | ||||
|         return list; | ||||
|     } | ||||
|   | ||||
| @@ -17,7 +17,6 @@ | ||||
| package top.continew.admin.system.controller; | ||||
|  | ||||
| import cn.dev33.satoken.annotation.SaIgnore; | ||||
| import cn.hutool.core.lang.tree.Tree; | ||||
| import cn.hutool.core.util.StrUtil; | ||||
| import com.alicp.jetcache.anno.Cached; | ||||
| import io.swagger.v3.oas.annotations.Operation; | ||||
| @@ -32,11 +31,10 @@ import org.springframework.web.bind.annotation.*; | ||||
| import org.springframework.web.multipart.MultipartFile; | ||||
| import top.continew.admin.common.constant.CacheConstants; | ||||
| import top.continew.admin.system.enums.OptionCategoryEnum; | ||||
| import top.continew.admin.system.model.query.*; | ||||
| import top.continew.admin.system.model.query.OptionQuery; | ||||
| import top.continew.admin.system.model.resp.file.FileUploadResp; | ||||
| import top.continew.admin.system.service.*; | ||||
| 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.extension.tenant.annotation.TenantIgnore; | ||||
| import top.continew.starter.extension.tenant.context.TenantContextHolder; | ||||
| @@ -60,10 +58,6 @@ import java.util.List; | ||||
| public class CommonController { | ||||
|  | ||||
|     private final FileService fileService; | ||||
|     private final DeptService deptService; | ||||
|     private final MenuService menuService; | ||||
|     private final UserService userService; | ||||
|     private final RoleService roleService; | ||||
|     private final DictItemService dictItemService; | ||||
|     private final OptionService optionService; | ||||
|  | ||||
| @@ -82,30 +76,6 @@ public class CommonController { | ||||
|             .build(); | ||||
|     } | ||||
|  | ||||
|     @Operation(summary = "查询部门树", description = "查询树结构的部门列表") | ||||
|     @GetMapping("/tree/dept") | ||||
|     public List<Tree<Long>> listDeptTree(DeptQuery query, SortQuery sortQuery) { | ||||
|         return deptService.tree(query, sortQuery, true); | ||||
|     } | ||||
|  | ||||
|     @Operation(summary = "查询菜单树", description = "查询树结构的菜单列表") | ||||
|     @GetMapping("/tree/menu") | ||||
|     public List<Tree<Long>> listMenuTree(MenuQuery query, SortQuery sortQuery) { | ||||
|         return menuService.tree(query, sortQuery, true); | ||||
|     } | ||||
|  | ||||
|     @Operation(summary = "查询用户字典", description = "查询用户字典列表") | ||||
|     @GetMapping("/dict/user") | ||||
|     public List<LabelValueResp> listUserDict(UserQuery query, SortQuery sortQuery) { | ||||
|         return userService.listDict(query, sortQuery); | ||||
|     } | ||||
|  | ||||
|     @Operation(summary = "查询角色字典", description = "查询角色字典列表") | ||||
|     @GetMapping("/dict/role") | ||||
|     public List<LabelValueResp> listRoleDict(RoleQuery query, SortQuery sortQuery) { | ||||
|         return roleService.listDict(query, sortQuery); | ||||
|     } | ||||
|  | ||||
|     @Operation(summary = "查询字典", description = "查询字典列表") | ||||
|     @Parameter(name = "code", description = "字典编码", example = "notice_type", in = ParameterIn.PATH) | ||||
|     @GetMapping("/dict/{code}") | ||||
|   | ||||
| @@ -35,6 +35,6 @@ import top.continew.starter.extension.crud.enums.Api; | ||||
| @Tag(name = "部门管理 API") | ||||
| @RestController | ||||
| @CrudRequestMapping(value = "/system/dept", api = {Api.TREE, Api.GET, Api.CREATE, Api.UPDATE, Api.BATCH_DELETE, | ||||
|     Api.EXPORT}) | ||||
|     Api.EXPORT, Api.DICT_TREE}) | ||||
| public class DeptController extends BaseController<DeptService, DeptResp, DeptResp, DeptQuery, DeptReq> { | ||||
| } | ||||
|   | ||||
| @@ -55,7 +55,7 @@ import java.util.List; | ||||
| @Tag(name = "菜单管理 API") | ||||
| @RestController | ||||
| @RequiredArgsConstructor | ||||
| @CrudRequestMapping(value = "/system/menu", api = {Api.TREE, Api.GET, Api.CREATE, Api.UPDATE, Api.BATCH_DELETE}) | ||||
| @CrudRequestMapping(value = "/system/menu", api = {Api.TREE, Api.GET, Api.CREATE, Api.UPDATE, Api.BATCH_DELETE, Api.DICT_TREE}) | ||||
| public class MenuController extends BaseController<MenuService, MenuResp, MenuResp, MenuQuery, MenuReq> { | ||||
|  | ||||
|     private final MenuService menuService; | ||||
|   | ||||
| @@ -53,7 +53,7 @@ import java.util.List; | ||||
| @Validated | ||||
| @RestController | ||||
| @RequiredArgsConstructor | ||||
| @CrudRequestMapping(value = "/system/role", api = {Api.LIST, Api.GET, Api.CREATE, Api.UPDATE, Api.BATCH_DELETE}) | ||||
| @CrudRequestMapping(value = "/system/role", api = {Api.LIST, Api.GET, Api.CREATE, Api.UPDATE, Api.BATCH_DELETE, Api.DICT}) | ||||
| public class RoleController extends BaseController<RoleService, RoleResp, RoleDetailResp, RoleQuery, RoleReq> { | ||||
|  | ||||
|     private final UserRoleService userRoleService; | ||||
|   | ||||
| @@ -59,7 +59,7 @@ import java.io.IOException; | ||||
| @RestController | ||||
| @RequiredArgsConstructor | ||||
| @CrudRequestMapping(value = "/system/user", api = {Api.PAGE, Api.LIST, Api.GET, Api.CREATE, Api.UPDATE, | ||||
|     Api.BATCH_DELETE, Api.EXPORT}) | ||||
|     Api.BATCH_DELETE, Api.EXPORT, Api.DICT}) | ||||
| public class UserController extends BaseController<UserService, UserResp, UserDetailResp, UserQuery, UserReq> { | ||||
|  | ||||
|     @Override | ||||
|   | ||||
| @@ -134,9 +134,9 @@ public class RoleServiceImpl extends BaseServiceImpl<RoleMapper, RoleDO, RoleRes | ||||
|     } | ||||
|  | ||||
|     @Override | ||||
|     public List<LabelValueResp> listDict(RoleQuery query, SortQuery sortQuery) { | ||||
|     public List<LabelValueResp> dict(RoleQuery query, SortQuery sortQuery) { | ||||
|         query.setExcludeRoleCodes(RoleCodeEnum.getSuperRoleCodes()); | ||||
|         return super.listDict(query, sortQuery); | ||||
|         return super.dict(query, sortQuery); | ||||
|     } | ||||
|  | ||||
|     @Override | ||||
|   | ||||
		Reference in New Issue
	
	Block a user