mirror of
				https://github.com/continew-org/continew-admin.git
				synced 2025-10-31 00:57:13 +08:00 
			
		
		
		
	chore: continew-starter 2.6.0 => 2.7.0
移除多数据源(有需要自行引入) 引入数据权限组件(独立出来) 调整包名及其他命名调整
This commit is contained in:
		
							
								
								
									
										18
									
								
								README.md
									
									
									
									
									
								
							
							
						
						
									
										18
									
								
								README.md
									
									
									
									
									
								
							| @@ -13,10 +13,10 @@ | |||||||
| <img src="https://sonarcloud.io/api/project_badges/measure?project=Charles7c_continew-admin&metric=alert_status" alt="Sonar Status" /> | <img src="https://sonarcloud.io/api/project_badges/measure?project=Charles7c_continew-admin&metric=alert_status" alt="Sonar Status" /> | ||||||
| </a> | </a> | ||||||
| <a href="https://github.com/continew-org/continew-starter" target="_blank"> | <a href="https://github.com/continew-org/continew-starter" target="_blank"> | ||||||
| <img src="https://img.shields.io/badge/ContiNew Starter-2.6.0-%236CB52D.svg" alt="ContiNew Starter" /> | <img src="https://img.shields.io/badge/ContiNew Starter-2.7.1-%236CB52D.svg" alt="ContiNew Starter" /> | ||||||
| </a> | </a> | ||||||
| <a href="https://spring.io/projects/spring-boot" target="_blank"> | <a href="https://spring.io/projects/spring-boot" target="_blank"> | ||||||
| <img src="https://img.shields.io/badge/Spring Boot-3.2.7-%236CB52D.svg?logo=Spring-Boot" alt="Spring Boot" /> | <img src="https://img.shields.io/badge/Spring Boot-3.2.10-%236CB52D.svg?logo=Spring-Boot" alt="Spring Boot" /> | ||||||
| </a> | </a> | ||||||
| <a href="https://github.com/continew-org/continew-starter" target="_blank"> | <a href="https://github.com/continew-org/continew-starter" target="_blank"> | ||||||
| <img src="https://img.shields.io/badge/Open JDK-17-%236CB52D.svg?logo=OpenJDK&logoColor=FFF" alt="Open JDK" /> | <img src="https://img.shields.io/badge/Open JDK-17-%236CB52D.svg?logo=OpenJDK&logoColor=FFF" alt="Open JDK" /> | ||||||
| @@ -211,16 +211,16 @@ public class DeptController extends BaseController<DeptService, DeptResp, DeptDe | |||||||
| ## 核心技术栈 | ## 核心技术栈 | ||||||
|  |  | ||||||
| | 名称                                                         | 版本           | 简介                                                         | | | 名称                                                         | 版本           | 简介                                                         | | ||||||
| | :----------------------------------------------------------- | :----------- | :----------------------------------------------------------- | | | :----------------------------------------------------------- |:-------------| :----------------------------------------------------------- | | ||||||
| | <a href="https://cn.vuejs.org/" target="_blank">Vue</a>      | 3.4.21       | 渐进式 JavaScript 框架,易学易用,性能出色,适用场景丰富的 Web 前端框架。 | | | <a href="https://cn.vuejs.org/" target="_blank">Vue</a>      | 3.4.21       | 渐进式 JavaScript 框架,易学易用,性能出色,适用场景丰富的 Web 前端框架。 | | ||||||
| | <a href="https://arco.design/vue/docs/start" target="_blank">Arco Design</a> | 2.56.0       | 字节跳动推出的前端 UI 框架,年轻化的色彩和组件设计。         | | | <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://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        | 下一代的前端工具链,为开发提供极速响应。                     | | | <a href="https://cn.vitejs.dev/" target="_blank">Vite</a>    | 5.1.5        | 下一代的前端工具链,为开发提供极速响应。                     | | ||||||
| | [ContiNew Starter](https://github.com/continew-org/continew-starter) | 2.6.0        | ContiNew Starter 包含了一系列经过企业实践优化的依赖包(如 MyBatis-Plus、SaToken),可轻松集成到应用中,为开发人员减少手动引入依赖及配置的麻烦,为 Spring Boot Web 项目的灵活快速构建提供支持。 | | | [ContiNew Starter](https://github.com/continew-org/continew-starter) | 2.7.1        | ContiNew Starter 包含了一系列经过企业实践优化的依赖包(如 MyBatis-Plus、SaToken),可轻松集成到应用中,为开发人员减少手动引入依赖及配置的麻烦,为 Spring Boot Web 项目的灵活快速构建提供支持。 | | ||||||
| | <a href="https://spring.io/projects/spring-boot" target="_blank">Spring Boot</a> | 3.2.7        | 简化 Spring 应用的初始搭建和开发过程,基于“约定优于配置”的理念,使开发人员不再需要定义样板化的配置。(Spring Boot 3.0 开始,要求 Java 17 作为最低版本) | | | <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://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 权限认证框架,让鉴权变得简单、优雅。             | | | <a href="https://sa-token.dev33.cn/" target="_blank">Sa-Token + JWT</a> | 1.39.0       | 轻量级 Java 权限认证框架,让鉴权变得简单、优雅。             | | ||||||
| | <a href="https://baomidou.com/" target="_blank">MyBatis Plus</a> | 3.5.7        | MyBatis 的增强工具,在 MyBatis 的基础上只做增强不做改变,简化开发、提高效率。 | | | <a href="https://baomidou.com/" target="_blank">MyBatis Plus</a> | 3.5.8        | MyBatis 的增强工具,在 MyBatis 的基础上只做增强不做改变,简化开发、提高效率。 | | ||||||
| | <a href="https://www.kancloud.cn/tracy5546/dynamic-datasource/2264611" target="_blank">dynamic-datasource-spring-boot-starter</a> | 4.3.1        | 基于 Spring Boot 的快速集成多数据源的启动器。                | | | <a href="https://www.kancloud.cn/tracy5546/dynamic-datasource/2264611" target="_blank">dynamic-datasource-spring-boot-starter</a> | 4.3.1        | 基于 Spring Boot 的快速集成多数据源的启动器。                | | ||||||
| | Hikari                                                       | 5.0.1        | JDBC 连接池,号称 “史上最快连接池”,SpringBoot 在 2.0 之后,采用的默认数据库连接池就是 Hikari。 | | | Hikari                                                       | 5.0.1        | JDBC 连接池,号称 “史上最快连接池”,SpringBoot 在 2.0 之后,采用的默认数据库连接池就是 Hikari。 | | ||||||
| | <a href="https://dev.mysql.com/downloads/mysql/" target="_blank">MySQL</a> | 8.0.33       | 体积小、速度快、总体拥有成本低,是最流行的关系型数据库管理系统之一。 | | | <a href="https://dev.mysql.com/downloads/mysql/" target="_blank">MySQL</a> | 8.0.33       | 体积小、速度快、总体拥有成本低,是最流行的关系型数据库管理系统之一。 | | ||||||
| @@ -228,17 +228,17 @@ public class DeptController extends BaseController<DeptService, DeptResp, DeptDe | |||||||
| | <a href="https://github.com/p6spy/p6spy" target="_blank">P6Spy</a> | 3.9.1        | SQL 性能分析组件。                                           | | | <a href="https://github.com/p6spy/p6spy" target="_blank">P6Spy</a> | 3.9.1        | SQL 性能分析组件。                                           | | ||||||
| | <a href="https://github.com/liquibase/liquibase" target="_blank">Liquibase</a> | 4.24.0       | 用于管理数据库版本,跟踪、管理和应用数据库变化。             | | | <a href="https://github.com/liquibase/liquibase" target="_blank">Liquibase</a> | 4.24.0       | 用于管理数据库版本,跟踪、管理和应用数据库变化。             | | ||||||
| | [JetCache](https://github.com/alibaba/jetcache/blob/master/docs/CN/Readme.md) | 2.7.6        | 一个基于 Java 的缓存系统封装,提供统一的 API 和注解来简化缓存的使用。提供了比 SpringCache 更加强大的注解,可以原生的支持 TTL、两级缓存、分布式自动刷新,还提供了 Cache 接口用于手工缓存操作。 | | | [JetCache](https://github.com/alibaba/jetcache/blob/master/docs/CN/Readme.md) | 2.7.6        | 一个基于 Java 的缓存系统封装,提供统一的 API 和注解来简化缓存的使用。提供了比 SpringCache 更加强大的注解,可以原生的支持 TTL、两级缓存、分布式自动刷新,还提供了 Cache 接口用于手工缓存操作。 | | ||||||
| | <a href="https://github.com/redisson/redisson/wiki/Redisson%E9%A1%B9%E7%9B%AE%E4%BB%8B%E7%BB%8D" target="_blank">Redisson</a> | 3.35.0       | 不仅仅是一个 Redis Java 客户端,Redisson 充分的利用了 Redis 键值数据库提供的一系列优势,为使用者提供了一系列具有分布式特性的常用工具:分布式锁、限流器等。 | | | <a href="https://github.com/redisson/redisson/wiki/Redisson%E9%A1%B9%E7%9B%AE%E4%BB%8B%E7%BB%8D" target="_blank">Redisson</a> | 3.36.0       | 不仅仅是一个 Redis Java 客户端,Redisson 充分的利用了 Redis 键值数据库提供的一系列优势,为使用者提供了一系列具有分布式特性的常用工具:分布式锁、限流器等。 | | ||||||
| | <a href="https://redis.io/" target="_blank">Redis</a>        | 7.2.3        | 高性能的 key-value 数据库。                                  | | | <a href="https://redis.io/" target="_blank">Redis</a>        | 7.2.3        | 高性能的 key-value 数据库。                                  | | ||||||
| | [Snail Job](https://snailjob.opensnail.com/)                 | 1.1.2        | 灵活,可靠和快速的分布式任务重试和分布式任务调度平台。       | | | [Snail Job](https://snailjob.opensnail.com/)                 | 1.1.2        | 灵活,可靠和快速的分布式任务重试和分布式任务调度平台。       | | ||||||
| | [X File Storage](https://x-file-storage.xuyanwu.cn/#/)       | 2.2.1        | 一行代码将文件存储到本地、FTP、SFTP、WebDAV、阿里云 OSS、华为云 OBS...等其它兼容 S3 协议的存储平台。 | | | [X File Storage](https://x-file-storage.xuyanwu.cn/#/)       | 2.2.1        | 一行代码将文件存储到本地、FTP、SFTP、WebDAV、阿里云 OSS、华为云 OBS...等其它兼容 S3 协议的存储平台。 | | ||||||
| | <a href="https://sms4j.com/" target="_blank">SMS4J</a>       | 3.3.2        | 短信聚合框架,轻松集成多家短信服务,解决接入多个短信 SDK 的繁琐流程。 | | | <a href="https://sms4j.com/" target="_blank">SMS4J</a>       | 3.3.3        | 短信聚合框架,轻松集成多家短信服务,解决接入多个短信 SDK 的繁琐流程。 | | ||||||
| | <a href="https://justauth.cn/" target="_blank">Just Auth</a> | 1.16.6       | 开箱即用的整合第三方登录的开源组件,脱离繁琐的第三方登录 SDK,让登录变得 So easy! | | | <a href="https://justauth.cn/" target="_blank">Just Auth</a> | 1.16.6       | 开箱即用的整合第三方登录的开源组件,脱离繁琐的第三方登录 SDK,让登录变得 So easy! | | ||||||
| | <a href="https://easyexcel.opensource.alibaba.com/" target="_blank">Easy Excel</a> | 4.0.1        | 一个基于 Java 的、快速、简洁、解决大文件内存溢出的 Excel 处理工具。 | | | <a href="https://easyexcel.opensource.alibaba.com/" target="_blank">Easy Excel</a> | 4.0.1        | 一个基于 Java 的、快速、简洁、解决大文件内存溢出的 Excel 处理工具。 | | ||||||
| | [AJ-Captcha](https://ajcaptcha.beliefteam.cn/captcha-doc/)   | 1.3.0        | Java 行为验证码,包含滑动拼图、文字点选两种方式,UI支持弹出和嵌入两种方式。 | | | [AJ-Captcha](https://ajcaptcha.beliefteam.cn/captcha-doc/)   | 1.3.0        | Java 行为验证码,包含滑动拼图、文字点选两种方式,UI支持弹出和嵌入两种方式。 | | ||||||
| | Easy Captcha                                                 | 1.6.2        | Java 图形验证码,支持 gif、中文、算术等类型,可用于 Java Web、JavaSE 等项目。 | | | 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” 这类需求的字段填充框架。 | | | [Crane4j](https://createsequence.gitee.io/crane4j-doc/#/)    | 2.9.0        | 一个基于注解的,用于完成一切 “根据 A 的 key 值拿到 B,再把 B 的属性映射到 A” 这类需求的字段填充框架。 | | ||||||
| | [CosID](https://cosid.ahoo.me/guide/getting-started.html)    | 2.9.6        | 旨在提供通用、灵活、高性能的分布式 ID 生成器。               | | | [CosID](https://cosid.ahoo.me/guide/getting-started.html)    | 2.9.8        | 旨在提供通用、灵活、高性能的分布式 ID 生成器。               | | ||||||
| | [Graceful Response](https://doc.feiniaojin.com/graceful-response/home.html) | 5.0.0-boot3  | 一个Spring Boot技术栈下的优雅响应处理组件,可以帮助开发者完成响应数据封装、异常处理、错误码填充等过程,提高开发效率,提高代码质量。 | | | [Graceful Response](https://doc.feiniaojin.com/graceful-response/home.html) | 5.0.0-boot3  | 一个Spring Boot技术栈下的优雅响应处理组件,可以帮助开发者完成响应数据封装、异常处理、错误码填充等过程,提高开发效率,提高代码质量。 | | ||||||
| | <a href="https://doc.xiaominfo.com/" target="_blank">Knife4j</a> | 4.5.0        | 前身是 swagger-bootstrap-ui,集 Swagger2 和 OpenAPI3 为一体的增强解决方案。 | | | <a href="https://doc.xiaominfo.com/" target="_blank">Knife4j</a> | 4.5.0        | 前身是 swagger-bootstrap-ui,集 Swagger2 和 OpenAPI3 为一体的增强解决方案。 | | ||||||
| | <a href="https://www.hutool.cn/" target="_blank">Hutool</a>  | 5.8.32       | 小而全的 Java 工具类库,通过静态方法封装,降低相关 API 的学习成本,提高工作效率,使 Java 拥有函数式语言般的优雅,让 Java 语言也可以“甜甜的”。 | | | <a href="https://www.hutool.cn/" target="_blank">Hutool</a>  | 5.8.32       | 小而全的 Java 工具类库,通过静态方法封装,降低相关 API 的学习成本,提高工作效率,使 Java 拥有函数式语言般的优雅,让 Java 语言也可以“甜甜的”。 | | ||||||
|   | |||||||
| @@ -64,6 +64,12 @@ | |||||||
|             <artifactId>continew-starter-auth-justauth</artifactId> |             <artifactId>continew-starter-auth-justauth</artifactId> | ||||||
|         </dependency> |         </dependency> | ||||||
|  |  | ||||||
|  |         <!-- ContiNew Starter 数据权限模块 - MyBatis Plus --> | ||||||
|  |         <dependency> | ||||||
|  |             <groupId>top.continew</groupId> | ||||||
|  |             <artifactId>continew-starter-extension-datapermission-mp</artifactId> | ||||||
|  |         </dependency> | ||||||
|  |  | ||||||
|         <!-- ContiNew Starter 数据访问模块 - MyBatis Plus --> |         <!-- ContiNew Starter 数据访问模块 - MyBatis Plus --> | ||||||
|         <dependency> |         <dependency> | ||||||
|             <groupId>top.continew</groupId> |             <groupId>top.continew</groupId> | ||||||
|   | |||||||
| @@ -21,7 +21,7 @@ import com.baomidou.mybatisplus.core.metadata.IPage; | |||||||
| import com.baomidou.mybatisplus.core.toolkit.Constants; | import com.baomidou.mybatisplus.core.toolkit.Constants; | ||||||
| import org.apache.ibatis.annotations.Param; | import org.apache.ibatis.annotations.Param; | ||||||
| import top.continew.starter.data.mp.base.BaseMapper; | import top.continew.starter.data.mp.base.BaseMapper; | ||||||
| import top.continew.starter.data.mp.datapermission.DataPermission; | import top.continew.starter.extension.datapermission.annotation.DataPermission; | ||||||
|  |  | ||||||
| import java.util.List; | import java.util.List; | ||||||
|  |  | ||||||
|   | |||||||
| @@ -19,19 +19,20 @@ package top.continew.admin.common.config.mybatis; | |||||||
| import cn.hutool.core.convert.Convert; | import cn.hutool.core.convert.Convert; | ||||||
| import top.continew.admin.common.model.dto.LoginUser; | import top.continew.admin.common.model.dto.LoginUser; | ||||||
| import top.continew.admin.common.util.helper.LoginHelper; | import top.continew.admin.common.util.helper.LoginHelper; | ||||||
| import top.continew.starter.data.mp.datapermission.DataPermissionCurrentUser; | import top.continew.starter.extension.datapermission.enums.DataScope; | ||||||
| import top.continew.starter.data.mp.datapermission.DataPermissionFilter; | import top.continew.starter.extension.datapermission.filter.DataPermissionUserContextProvider; | ||||||
| import top.continew.starter.data.mp.datapermission.DataScope; | import top.continew.starter.extension.datapermission.model.RoleContext; | ||||||
|  | import top.continew.starter.extension.datapermission.model.UserContext; | ||||||
| 
 | 
 | ||||||
| import java.util.stream.Collectors; | import java.util.stream.Collectors; | ||||||
| 
 | 
 | ||||||
| /** | /** | ||||||
|  * 数据权限过滤器实现类 |  * 数据权限用户上下文提供者 | ||||||
|  * |  * | ||||||
|  * @author Charles7c |  * @author Charles7c | ||||||
|  * @since 2023/12/21 21:19 |  * @since 2023/12/21 21:19 | ||||||
|  */ |  */ | ||||||
| public class DataPermissionFilterImpl implements DataPermissionFilter { | public class DefaultDataPermissionUserContextProvider implements DataPermissionUserContextProvider { | ||||||
| 
 | 
 | ||||||
|     @Override |     @Override | ||||||
|     public boolean isFilter() { |     public boolean isFilter() { | ||||||
| @@ -40,17 +41,15 @@ public class DataPermissionFilterImpl implements DataPermissionFilter { | |||||||
|     } |     } | ||||||
| 
 | 
 | ||||||
|     @Override |     @Override | ||||||
|     public DataPermissionCurrentUser getCurrentUser() { |     public UserContext getUserContext() { | ||||||
|         LoginUser loginUser = LoginHelper.getLoginUser(); |         LoginUser loginUser = LoginHelper.getLoginUser(); | ||||||
|         DataPermissionCurrentUser currentUser = new DataPermissionCurrentUser(); |         UserContext userContext = new UserContext(); | ||||||
|         currentUser.setUserId(Convert.toStr(loginUser.getId())); |         userContext.setUserId(Convert.toStr(loginUser.getId())); | ||||||
|         currentUser.setDeptId(Convert.toStr(loginUser.getDeptId())); |         userContext.setDeptId(Convert.toStr(loginUser.getDeptId())); | ||||||
|         currentUser.setRoles(loginUser.getRoles() |         userContext.setRoles(loginUser.getRoles() | ||||||
|             .stream() |             .stream() | ||||||
|             .map(r -> new DataPermissionCurrentUser.CurrentUserRole(Convert.toStr(r.getId()), DataScope.valueOf(r |             .map(r -> new RoleContext(Convert.toStr(r.getId()), DataScope.valueOf(r.getDataScope().name()))) | ||||||
|                 .getDataScope() |  | ||||||
|                 .name()))) |  | ||||||
|             .collect(Collectors.toSet())); |             .collect(Collectors.toSet())); | ||||||
|         return currentUser; |         return userContext; | ||||||
|     } |     } | ||||||
| } | } | ||||||
| @@ -20,7 +20,7 @@ import com.baomidou.mybatisplus.core.handlers.MetaObjectHandler; | |||||||
| import org.springframework.context.annotation.Bean; | import org.springframework.context.annotation.Bean; | ||||||
| import org.springframework.context.annotation.Configuration; | import org.springframework.context.annotation.Configuration; | ||||||
| import org.springframework.security.crypto.password.PasswordEncoder; | import org.springframework.security.crypto.password.PasswordEncoder; | ||||||
| import top.continew.starter.data.mp.datapermission.DataPermissionFilter; | import top.continew.starter.extension.datapermission.filter.DataPermissionUserContextProvider; | ||||||
|  |  | ||||||
| /** | /** | ||||||
|  * MyBatis Plus 配置 |  * MyBatis Plus 配置 | ||||||
| @@ -40,11 +40,11 @@ public class MybatisPlusConfiguration { | |||||||
|     } |     } | ||||||
|  |  | ||||||
|     /** |     /** | ||||||
|      * 数据权限过滤器 |      * 数据权限用户上下文提供者 | ||||||
|      */ |      */ | ||||||
|     @Bean |     @Bean | ||||||
|     public DataPermissionFilter dataPermissionFilter() { |     public DataPermissionUserContextProvider dataPermissionUserContextProvider() { | ||||||
|         return new DataPermissionFilterImpl(); |         return new DefaultDataPermissionUserContextProvider(); | ||||||
|     } |     } | ||||||
|  |  | ||||||
|     /** |     /** | ||||||
|   | |||||||
| @@ -24,7 +24,7 @@ import org.apache.ibatis.annotations.Select; | |||||||
| import top.continew.admin.common.config.mybatis.DataPermissionMapper; | import top.continew.admin.common.config.mybatis.DataPermissionMapper; | ||||||
| import top.continew.admin.system.model.entity.UserDO; | import top.continew.admin.system.model.entity.UserDO; | ||||||
| import top.continew.admin.system.model.resp.UserDetailResp; | import top.continew.admin.system.model.resp.UserDetailResp; | ||||||
| import top.continew.starter.data.mp.datapermission.DataPermission; | import top.continew.starter.extension.datapermission.annotation.DataPermission; | ||||||
| import top.continew.starter.security.crypto.annotation.FieldEncrypt; | import top.continew.starter.security.crypto.annotation.FieldEncrypt; | ||||||
|  |  | ||||||
| import java.util.List; | import java.util.List; | ||||||
| @@ -97,6 +97,7 @@ public interface UserMapper extends DataPermissionMapper<UserDO> { | |||||||
|      * 根据邮箱查询数量 |      * 根据邮箱查询数量 | ||||||
|      * |      * | ||||||
|      * @param email 邮箱 |      * @param email 邮箱 | ||||||
|  |      * @param id    ID | ||||||
|      * @return 用户数量 |      * @return 用户数量 | ||||||
|      */ |      */ | ||||||
|     Long selectCountByEmail(@FieldEncrypt @Param("email") String email, @Param("id") Long id); |     Long selectCountByEmail(@FieldEncrypt @Param("email") String email, @Param("id") Long id); | ||||||
| @@ -105,6 +106,7 @@ public interface UserMapper extends DataPermissionMapper<UserDO> { | |||||||
|      * 根据手机号查询数量 |      * 根据手机号查询数量 | ||||||
|      * |      * | ||||||
|      * @param phone 手机号 |      * @param phone 手机号 | ||||||
|  |      * @param id    ID | ||||||
|      * @return 用户数量 |      * @return 用户数量 | ||||||
|      */ |      */ | ||||||
|     Long selectCountByPhone(@FieldEncrypt @Param("phone") String phone, @Param("id") Long id); |     Long selectCountByPhone(@FieldEncrypt @Param("phone") String phone, @Param("id") Long id); | ||||||
|   | |||||||
| @@ -18,8 +18,6 @@ package top.continew.admin.system.service.impl; | |||||||
|  |  | ||||||
| import cn.hutool.core.collection.CollUtil; | import cn.hutool.core.collection.CollUtil; | ||||||
| import cn.hutool.core.util.ObjectUtil; | import cn.hutool.core.util.ObjectUtil; | ||||||
| import cn.hutool.extra.spring.SpringUtil; |  | ||||||
| import com.baomidou.dynamic.datasource.DynamicRoutingDataSource; |  | ||||||
| import com.baomidou.mybatisplus.core.toolkit.Wrappers; | import com.baomidou.mybatisplus.core.toolkit.Wrappers; | ||||||
| import jakarta.annotation.Resource; | import jakarta.annotation.Resource; | ||||||
| import lombok.RequiredArgsConstructor; | import lombok.RequiredArgsConstructor; | ||||||
| @@ -38,7 +36,11 @@ import top.continew.starter.data.core.enums.DatabaseType; | |||||||
| import top.continew.starter.data.core.util.MetaUtils; | import top.continew.starter.data.core.util.MetaUtils; | ||||||
| import top.continew.starter.extension.crud.service.impl.BaseServiceImpl; | import top.continew.starter.extension.crud.service.impl.BaseServiceImpl; | ||||||
|  |  | ||||||
| import java.util.*; | import javax.sql.DataSource; | ||||||
|  | import java.util.ArrayList; | ||||||
|  | import java.util.Collections; | ||||||
|  | import java.util.List; | ||||||
|  | import java.util.Optional; | ||||||
|  |  | ||||||
| /** | /** | ||||||
|  * 部门业务实现 |  * 部门业务实现 | ||||||
| @@ -53,11 +55,12 @@ public class DeptServiceImpl extends BaseServiceImpl<DeptMapper, DeptDO, DeptRes | |||||||
|     @Resource |     @Resource | ||||||
|     private UserService userService; |     private UserService userService; | ||||||
|     private final RoleDeptService roleDeptService; |     private final RoleDeptService roleDeptService; | ||||||
|  |     @Resource | ||||||
|  |     private DataSource dataSource; | ||||||
|  |  | ||||||
|     @Override |     @Override | ||||||
|     public List<DeptDO> listChildren(Long id) { |     public List<DeptDO> listChildren(Long id) { | ||||||
|         DatabaseType databaseType = MetaUtils.getDatabaseTypeOrDefault(SpringUtil |         DatabaseType databaseType = MetaUtils.getDatabaseTypeOrDefault(dataSource, DatabaseType.MYSQL); | ||||||
|             .getBean(DynamicRoutingDataSource.class), DatabaseType.MYSQL); |  | ||||||
|         return baseMapper.lambdaQuery().apply(databaseType.findInSet(id, "ancestors")).list(); |         return baseMapper.lambdaQuery().apply(databaseType.findInSet(id, "ancestors")).list(); | ||||||
|     } |     } | ||||||
|  |  | ||||||
| @@ -184,8 +187,7 @@ public class DeptServiceImpl extends BaseServiceImpl<DeptMapper, DeptDO, DeptRes | |||||||
|         if (CollUtil.isEmpty(ids)) { |         if (CollUtil.isEmpty(ids)) { | ||||||
|             return 0L; |             return 0L; | ||||||
|         } |         } | ||||||
|         DatabaseType databaseType = MetaUtils.getDatabaseTypeOrDefault(SpringUtil |         DatabaseType databaseType = MetaUtils.getDatabaseTypeOrDefault(dataSource, DatabaseType.MYSQL); | ||||||
|             .getBean(DynamicRoutingDataSource.class), DatabaseType.MYSQL); |  | ||||||
|         return ids.stream() |         return ids.stream() | ||||||
|             .mapToLong(id -> baseMapper.lambdaQuery().apply(databaseType.findInSet(id, "ancestors")).count()) |             .mapToLong(id -> baseMapper.lambdaQuery().apply(databaseType.findInSet(id, "ancestors")).count()) | ||||||
|             .sum(); |             .sum(); | ||||||
|   | |||||||
| @@ -74,7 +74,7 @@ | |||||||
|                 <configuration> |                 <configuration> | ||||||
|                     <!-- 排除配置文件 --> |                     <!-- 排除配置文件 --> | ||||||
|                     <excludes> |                     <excludes> | ||||||
|                         <exclude>${config-path}/</exclude> |                         <exclude>${config-path}</exclude> | ||||||
|                         <exclude>db/</exclude> |                         <exclude>db/</exclude> | ||||||
|                         <exclude>templates/</exclude> |                         <exclude>templates/</exclude> | ||||||
|                         <exclude>logback-spring.xml</exclude> |                         <exclude>logback-spring.xml</exclude> | ||||||
|   | |||||||
| @@ -5,5 +5,5 @@ | |||||||
|   \____|\___/ |_| |_| \__||_||_| \_| \___|  \_/\_/       /_/   \_\\__,_||_| |_| |_||_||_| |_| |   \____|\___/ |_| |_| \__||_||_| \_| \___|  \_/\_/       /_/   \_\\__,_||_| |_| |_||_||_| |_| | ||||||
|  |  | ||||||
|  :: ${project.name}   ::                                               v${project.version} |  :: ${project.name}   ::                                               v${project.version} | ||||||
|  :: ContiNew Starter ::                                               v2.6.0 |  :: ContiNew Starter ::                                               v2.7.1 | ||||||
|  :: Spring Boot      ::                                               v${spring-boot.version} |  :: Spring Boot      ::                                               v${spring-boot.version} | ||||||
|   | |||||||
| @@ -11,42 +11,20 @@ server: | |||||||
| --- ### 数据源配置 | --- ### 数据源配置 | ||||||
| spring.datasource: | spring.datasource: | ||||||
|   type: com.zaxxer.hikari.HikariDataSource |   type: com.zaxxer.hikari.HikariDataSource | ||||||
|   ## 动态数据源配置(可配多主多从:m1、s1...;纯粹多库:mysql、oracle...;混合配置:m1、s1、oracle...) |   url: jdbc:p6spy:mysql://${DB_HOST:127.0.0.1}:${DB_PORT:3306}/${DB_NAME:continew_admin}?serverTimezone=Asia/Shanghai&useUnicode=true&characterEncoding=utf8&useSSL=false&allowMultiQueries=true&rewriteBatchedStatements=true&autoReconnect=true&maxReconnects=10&failOverReadOnly=false | ||||||
|   dynamic: |  | ||||||
|     # 是否启用 P6Spy(SQL 性能分析组件,该插件有性能损耗,不建议生产环境使用) |  | ||||||
|     p6spy: true |  | ||||||
|     # 设置默认的数据源或者数据源组(默认:master) |  | ||||||
|     primary: master |  | ||||||
|     # 严格匹配数据源(true:未匹配到指定数据源时抛异常;false:使用默认数据源;默认 false) |  | ||||||
|     strict: false |  | ||||||
|     datasource: |  | ||||||
|       # 主库配置(可配多个,构成多主) |  | ||||||
|       master: |  | ||||||
|         url: jdbc:mysql://${DB_HOST:127.0.0.1}:${DB_PORT:3306}/${DB_NAME:continew_admin}?serverTimezone=Asia/Shanghai&useUnicode=true&characterEncoding=utf8&useSSL=false&allowMultiQueries=true&autoReconnect=true&maxReconnects=10&failOverReadOnly=false |  | ||||||
|   username: ${DB_USER:root} |   username: ${DB_USER:root} | ||||||
|   password: ${DB_PWD:123456} |   password: ${DB_PWD:123456} | ||||||
|         driver-class-name: com.mysql.cj.jdbc.Driver |   driver-class-name: com.p6spy.engine.spy.P6SpyDriver | ||||||
|         type: ${spring.datasource.type} |   # PostgreSQL 配置 | ||||||
| #      # 从库配置(可配多个,构成多从) | #  url: jdbc:p6spy:postgresql://${DB_HOST:127.0.0.1}:${DB_PORT:5432}/${DB_NAME:continew_admin}?serverTimezone=Asia/Shanghai&useUnicode=true&characterEncoding=utf8&useSSL=false&allowMultiQueries=true&rewriteBatchedStatements=true&autoReconnect=true&maxReconnects=10&failOverReadOnly=false | ||||||
| #      slave_1: |  | ||||||
| #        url: jdbc:mysql://${DB_HOST:127.0.0.1}:${DB_PORT:3306}/${DB_NAME:continew_admin}?serverTimezone=Asia/Shanghai&useUnicode=true&characterEncoding=utf8&useSSL=false&allowMultiQueries=true&rewriteBatchedStatements=true&autoReconnect=true&maxReconnects=10&failOverReadOnly=false |  | ||||||
| #        username: |  | ||||||
| #        password: |  | ||||||
| #        lazy: true |  | ||||||
| #        driver-class-name: com.mysql.cj.jdbc.Driver |  | ||||||
| #        type: ${spring.datasource.type} |  | ||||||
| #      # PostgreSQL 库配置 |  | ||||||
| #      postgresql: |  | ||||||
| #        url: jdbc:postgresql://${DB_HOST:127.0.0.1}:${DB_PORT:5432}/${DB_NAME:continew_admin}?serverTimezone=Asia/Shanghai&useUnicode=true&characterEncoding=utf8&useSSL=false&allowMultiQueries=true&rewriteBatchedStatements=true&autoReconnect=true&maxReconnects=10&failOverReadOnly=false |  | ||||||
| #  username: ${DB_USER:root} | #  username: ${DB_USER:root} | ||||||
| #  password: ${DB_PWD:123456} | #  password: ${DB_PWD:123456} | ||||||
| #        driver-class-name: org.postgresql.Driver | #  driver-class-name: com.p6spy.engine.spy.P6SpyDriver | ||||||
| #        type: ${spring.datasource.type} |  | ||||||
|   # Hikari 连接池配置(完整配置请参阅:https://github.com/brettwooldridge/HikariCP) |   # Hikari 连接池配置(完整配置请参阅:https://github.com/brettwooldridge/HikariCP) | ||||||
|   hikari: |   hikari: | ||||||
|     # 最大连接数量(默认 10,根据实际环境调整) |     # 最大连接数量(默认 10,根据实际环境调整) | ||||||
|     # 注意:当连接达到上限,并且没有空闲连接可用时,获取连接将在超时前阻塞最多 connectionTimeout 毫秒 |     # 注意:当连接达到上限,并且没有空闲连接可用时,获取连接将在超时前阻塞最多 connectionTimeout 毫秒 | ||||||
|       max-pool-size: 20 |     maximum-pool-size: 20 | ||||||
|     # 获取连接超时时间(默认 30000 毫秒,30 秒) |     # 获取连接超时时间(默认 30000 毫秒,30 秒) | ||||||
|     connection-timeout: 30000 |     connection-timeout: 30000 | ||||||
|     # 空闲连接最大存活时间(默认 600000 毫秒,10 分钟) |     # 空闲连接最大存活时间(默认 600000 毫秒,10 分钟) | ||||||
|   | |||||||
| @@ -13,42 +13,21 @@ server: | |||||||
| --- ### 数据源配置 | --- ### 数据源配置 | ||||||
| spring.datasource: | spring.datasource: | ||||||
|   type: com.zaxxer.hikari.HikariDataSource |   type: com.zaxxer.hikari.HikariDataSource | ||||||
|   ## 动态数据源配置(可配多主多从:m1、s1...;纯粹多库:mysql、oracle...;混合配置:m1、s1、oracle...) |  | ||||||
|   dynamic: |  | ||||||
|     # 是否启用 P6Spy(SQL 性能分析组件,该插件有性能损耗,不建议生产环境使用) |  | ||||||
|     p6spy: false |  | ||||||
|     # 设置默认的数据源或者数据源组(默认:master) |  | ||||||
|     primary: master |  | ||||||
|     # 严格匹配数据源(true:未匹配到指定数据源时抛异常;false:使用默认数据源;默认 false) |  | ||||||
|     strict: false |  | ||||||
|     datasource: |  | ||||||
|       # 主库配置(可配多个,构成多主) |  | ||||||
|       master: |  | ||||||
|   url: jdbc:mysql://${DB_HOST:127.0.0.1}:${DB_PORT:3306}/${DB_NAME:continew_admin}?serverTimezone=Asia/Shanghai&useUnicode=true&characterEncoding=utf8&useSSL=false&allowMultiQueries=true&autoReconnect=true&maxReconnects=10&failOverReadOnly=false |   url: jdbc:mysql://${DB_HOST:127.0.0.1}:${DB_PORT:3306}/${DB_NAME:continew_admin}?serverTimezone=Asia/Shanghai&useUnicode=true&characterEncoding=utf8&useSSL=false&allowMultiQueries=true&autoReconnect=true&maxReconnects=10&failOverReadOnly=false | ||||||
|   username: ${DB_USER:root} |   username: ${DB_USER:root} | ||||||
|   password: ${DB_PWD:123456} |   password: ${DB_PWD:123456} | ||||||
|   driver-class-name: com.mysql.cj.jdbc.Driver |   driver-class-name: com.mysql.cj.jdbc.Driver | ||||||
|         type: ${spring.datasource.type} |   # PostgreSQL 配置 | ||||||
| #      # 从库配置(可配多个,构成多从) |  | ||||||
| #      slave_1: |  | ||||||
| #        url: jdbc:mysql://${DB_HOST:127.0.0.1}:${DB_PORT:3306}/${DB_NAME:continew_admin}?serverTimezone=Asia/Shanghai&useUnicode=true&characterEncoding=utf8&useSSL=false&allowMultiQueries=true&rewriteBatchedStatements=true&autoReconnect=true&maxReconnects=10&failOverReadOnly=false |  | ||||||
| #        username: |  | ||||||
| #        password: |  | ||||||
| #        lazy: true |  | ||||||
| #        driver-class-name: com.mysql.cj.jdbc.Driver |  | ||||||
| #        type: ${spring.datasource.type} |  | ||||||
| #      # PostgreSQL 库配置 |  | ||||||
| #  postgresql: | #  postgresql: | ||||||
| #    url: jdbc:postgresql://${DB_HOST:127.0.0.1}:${DB_PORT:5432}/${DB_NAME:continew_admin}?serverTimezone=Asia/Shanghai&useUnicode=true&characterEncoding=utf8&useSSL=false&allowMultiQueries=true&rewriteBatchedStatements=true&autoReconnect=true&maxReconnects=10&failOverReadOnly=false | #    url: jdbc:postgresql://${DB_HOST:127.0.0.1}:${DB_PORT:5432}/${DB_NAME:continew_admin}?serverTimezone=Asia/Shanghai&useUnicode=true&characterEncoding=utf8&useSSL=false&allowMultiQueries=true&rewriteBatchedStatements=true&autoReconnect=true&maxReconnects=10&failOverReadOnly=false | ||||||
| #    username: ${DB_USER:root} | #    username: ${DB_USER:root} | ||||||
| #    password: ${DB_PWD:123456} | #    password: ${DB_PWD:123456} | ||||||
| #    driver-class-name: org.postgresql.Driver | #    driver-class-name: org.postgresql.Driver | ||||||
| #        type: ${spring.datasource.type} |  | ||||||
|   # Hikari 连接池配置(完整配置请参阅:https://github.com/brettwooldridge/HikariCP) |   # Hikari 连接池配置(完整配置请参阅:https://github.com/brettwooldridge/HikariCP) | ||||||
|   hikari: |   hikari: | ||||||
|     # 最大连接数量(默认 10,根据实际环境调整) |     # 最大连接数量(默认 10,根据实际环境调整) | ||||||
|     # 注意:当连接达到上限,并且没有空闲连接可用时,获取连接将在超时前阻塞最多 connectionTimeout 毫秒 |     # 注意:当连接达到上限,并且没有空闲连接可用时,获取连接将在超时前阻塞最多 connectionTimeout 毫秒 | ||||||
|       max-pool-size: 20 |     maximum-pool-size: 20 | ||||||
|     # 获取连接超时时间(默认 30000 毫秒,30 秒) |     # 获取连接超时时间(默认 30000 毫秒,30 秒) | ||||||
|     connection-timeout: 30000 |     connection-timeout: 30000 | ||||||
|     # 空闲连接最大存活时间(默认 600000 毫秒,10 分钟) |     # 空闲连接最大存活时间(默认 600000 毫秒,10 分钟) | ||||||
|   | |||||||
| @@ -41,7 +41,7 @@ logging: | |||||||
| continew-starter.web: | continew-starter.web: | ||||||
|   trace: |   trace: | ||||||
|     enabled: true |     enabled: true | ||||||
|     header-name: traceId |     trace-id-name: traceId | ||||||
|     ## TLog 配置 |     ## TLog 配置 | ||||||
|     tlog: |     tlog: | ||||||
|       enable-invoke-time-print: false |       enable-invoke-time-print: false | ||||||
| @@ -166,9 +166,6 @@ mybatis-plus: | |||||||
|     # ID 生成器配置 |     # ID 生成器配置 | ||||||
|     id-generator: |     id-generator: | ||||||
|       type: COSID |       type: COSID | ||||||
|     # 数据权限配置 |  | ||||||
|     data-permission: |  | ||||||
|       enabled: true |  | ||||||
|     # 分页插件配置 |     # 分页插件配置 | ||||||
|     pagination: |     pagination: | ||||||
|       enabled: true |       enabled: true | ||||||
|   | |||||||
							
								
								
									
										2
									
								
								pom.xml
									
									
									
									
									
								
							
							
						
						
									
										2
									
								
								pom.xml
									
									
									
									
									
								
							| @@ -13,7 +13,7 @@ | |||||||
|     <parent> |     <parent> | ||||||
|         <groupId>top.continew</groupId> |         <groupId>top.continew</groupId> | ||||||
|         <artifactId>continew-starter</artifactId> |         <artifactId>continew-starter</artifactId> | ||||||
|         <version>2.6.0</version> |         <version>2.7.1</version> | ||||||
|     </parent> |     </parent> | ||||||
|  |  | ||||||
|     <groupId>top.continew</groupId> |     <groupId>top.continew</groupId> | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user