mirror of
				https://github.com/dromara/RuoYi-Vue-Plus.git
				synced 2025-10-31 22:33:48 +08:00 
			
		
		
		
	Compare commits
	
		
			150 Commits
		
	
	
		
			v4.2.0
			...
			v4.3.0-bet
		
	
	| Author | SHA1 | Date | |
|---|---|---|---|
|  | 67e20711d4 | ||
|  | d1681dc18c | ||
|  | 0c58ba5057 | ||
|  | 34997ef3e1 | ||
|  | 7d57725490 | ||
|  | 0fa0070062 | ||
|  | 9f2fe90e50 | ||
|  | d351c59b38 | ||
|  | 8837119aad | ||
|  | f9a9431958 | ||
|  | 56d209cd20 | ||
|  | 0936aaccea | ||
|  | 89c1e4f91d | ||
|  | 5d367b7bf8 | ||
|  | 138842e9ba | ||
|  | 07f3517b6f | ||
|  | 1a8e2b3e63 | ||
|  | e57682aa53 | ||
|  | 46287da60e | ||
|  | 0cecbec3b3 | ||
|  | 515657616a | ||
|  | be7766b5f0 | ||
|  | 168d49fe0b | ||
|  | cbedec7ca6 | ||
|  | fb1bac2114 | ||
|  | d0f399a66a | ||
|  | e73dbd470a | ||
|  | e0cd5381e2 | ||
|  | 8fe07a7e6d | ||
|  | 4a796d0e81 | ||
|  | aee5d417ed | ||
|  | 250c5ba226 | ||
|  | b91c848962 | ||
|  | 027cd821a2 | ||
|  | e3e9fe5106 | ||
|  | 26b0dc336a | ||
|  | d4475d0e8d | ||
|  | 1c935819db | ||
|  | 0c9398776a | ||
|  | aff54ab5fe | ||
|  | 06177addf5 | ||
|  | 9f3b91fe57 | ||
|  | 80d25863db | ||
|  | cf8a7f8678 | ||
|  | a8d798c38a | ||
|  | 975b84a394 | ||
|  | ef121fa664 | ||
|  | f4c1816084 | ||
|  | 86fc709b03 | ||
|  | afc4f9552f | ||
|  | b8b58cb202 | ||
|  | 96970ff951 | ||
|  | c2c0a03932 | ||
|  | 9bc2d2981b | ||
|  | 7cc9d17424 | ||
|  | bc8b5f1079 | ||
|  | 5ec5e1a65d | ||
|  | 1f0e742710 | ||
|  | 801615f780 | ||
|  | 28b9fbb4d2 | ||
|  | d51b77f42b | ||
|  | 6f83ed3285 | ||
|  | 369e4be31c | ||
|  | 5c9fe22780 | ||
|  | a2843b599d | ||
|  | 55ba098e50 | ||
|  | 1fdd81b4fa | ||
|  | d4af02f600 | ||
|  | d7cf341eb3 | ||
|  | 079e6f7c20 | ||
|  | 8a930bd7d5 | ||
|  | 2c79dc906e | ||
|  | 1852017ecc | ||
|  | ca301891db | ||
|  | ce7536df9f | ||
|  | 424d11896a | ||
|  | ae707d340b | ||
|  | edefee46b2 | ||
|  | 77ac99a1d0 | ||
|  | 918708a227 | ||
|  | 3ba8cf4102 | ||
|  | 73db68b08b | ||
|  | ecc4aa5571 | ||
|  | a1a13708be | ||
|  | c7c3da2038 | ||
|  | eb9f3d3772 | ||
|  | 1a61790407 | ||
|  | fe98fba5b5 | ||
|  | ff3ad74fb4 | ||
|  | 7cf93278d3 | ||
|  | 1d9f2d2ce7 | ||
|  | f109bd4a02 | ||
|  | aeebf7fa95 | ||
|  | c57ab693e4 | ||
|  | af54608f62 | ||
|  | f2d502faf8 | ||
|  | 6c1e146bc1 | ||
|  | 15d5eb858c | ||
|  | ac1d7aa69f | ||
|  | da4077f3b7 | ||
|  | 25f9f72366 | ||
|  | 7f04327625 | ||
|  | dd25573ebc | ||
|  | d9e54388e7 | ||
|  | 0b07780619 | ||
|  | 48cb0a1bb1 | ||
|  | 84f00e7cad | ||
|  | a46a7458e1 | ||
|  | c33aa5c969 | ||
|  | 0ee5fd1ac0 | ||
|  | 4eb8809a8a | ||
|  | 9315417935 | ||
|  | 1bb1b3886b | ||
|  | 9cd4f0c332 | ||
|  | 0d8510b8b3 | ||
|  | 6b57a8161c | ||
|  | 0a893d196e | ||
|  | a0a09c23da | ||
|  | 1270b6717f | ||
|  | d1f8b2ed17 | ||
|  | 765deae84d | ||
|  | 686068c8ed | ||
|  | ec45cf04af | ||
|  | b9931cda30 | ||
|  | 8a97d2717b | ||
|  | b80f733cdb | ||
|  | c6b0e61f44 | ||
|  | b2a927cc5e | ||
|  | b73324e800 | ||
|  | 23cbed3aac | ||
|  | 2bd6ad9963 | ||
|  | ea3d66fda3 | ||
|  | 8acce4a7fc | ||
|  | 181eaefea8 | ||
|  | 5e73b88a8a | ||
|  | 5e6d0b79e3 | ||
|  | bf362b9aba | ||
|  | 6b0d9214a9 | ||
|  | 6f48fc3c58 | ||
|  | 8558954da7 | ||
|  | 2ae41df23b | ||
|  | 47b8daf69c | ||
|  | ef31a0de42 | ||
|  | 8c956d681b | ||
|  | 89eb44afbc | ||
|  | 9d7e32fb07 | ||
|  | abb88d622a | ||
|  | 1ccdd75019 | ||
|  | aaedafff52 | ||
|  | 3ccf5c0e50 | 
							
								
								
									
										20
									
								
								README.md
									
									
									
									
									
								
							
							
						
						
									
										20
									
								
								README.md
									
									
									
									
									
								
							| @@ -4,13 +4,16 @@ | |||||||
| [](https://gitee.com/JavaLionLi/RuoYi-Vue-Plus/blob/master/LICENSE) | [](https://gitee.com/JavaLionLi/RuoYi-Vue-Plus/blob/master/LICENSE) | ||||||
| [](https://www.jetbrains.com/?from=RuoYi-Vue-Plus) | [](https://www.jetbrains.com/?from=RuoYi-Vue-Plus) | ||||||
| <br> | <br> | ||||||
| [](https://gitee.com/JavaLionLi/RuoYi-Vue-Plus) | [](https://gitee.com/JavaLionLi/RuoYi-Vue-Plus) | ||||||
| []() | []() | ||||||
| []() | []() | ||||||
| []() | []() | ||||||
|  |  | ||||||
| > RuoYi-Vue-Plus 是重写 RuoYi-Vue 针对 `分布式集群` 场景全方位升级(不兼容原框架) | > RuoYi-Vue-Plus 是重写 RuoYi-Vue 针对 `分布式集群` 场景全方位升级(不兼容原框架) | ||||||
|  |  | ||||||
|  | > 项目代码、文档 均开源免费可商用 遵循开源协议在项目中保留开源协议文件即可<br> | ||||||
|  | 活到老写到老 为兴趣而开源 为学习而开源 为让大家真正可以学到技术而开源 | ||||||
|  |  | ||||||
| > 系统演示: [传送门](https://gitee.com/JavaLionLi/RuoYi-Vue-Plus/wikis/系统演示?sort_id=4836388) | > 系统演示: [传送门](https://gitee.com/JavaLionLi/RuoYi-Vue-Plus/wikis/系统演示?sort_id=4836388) | ||||||
|  |  | ||||||
| | 功能介绍     | 使用技术                | 文档地址                                                                                              | 特性注意事项                     | | | 功能介绍     | 使用技术                | 文档地址                                                                                              | 特性注意事项                     | | ||||||
| @@ -46,7 +49,7 @@ | |||||||
| | 监控框架     | SpringBoot-Admin    | [SpringBoot-Admin文档](https://codecentric.github.io/spring-boot-admin/current/)                    | 全方位服务监控                    | | | 监控框架     | SpringBoot-Admin    | [SpringBoot-Admin文档](https://codecentric.github.io/spring-boot-admin/current/)                    | 全方位服务监控                    | | ||||||
| | 校验框架     | Validation          | [Validation文档](https://docs.jboss.org/hibernate/stable/validator/reference/en-US/html_single/)    | 增强接口安全性、严谨性 支持国际化          | | | 校验框架     | Validation          | [Validation文档](https://docs.jboss.org/hibernate/stable/validator/reference/en-US/html_single/)    | 增强接口安全性、严谨性 支持国际化          | | ||||||
| | Excel框架  | Alibaba EasyExcel   | [EasyExcel文档](https://www.yuque.com/easyexcel/doc/easyexcel)                                      | 性能优异 扩展性强                  | | | Excel框架  | Alibaba EasyExcel   | [EasyExcel文档](https://www.yuque.com/easyexcel/doc/easyexcel)                                      | 性能优异 扩展性强                  | | ||||||
| | 文档框架     | Knife4j             | [Knife4j文档](https://doc.xiaominfo.com/knife4j/documentation/)                                     | 美化接口文档                     | | | 文档框架     | SpringDoc、javadoc   | [接口文档](https://gitee.com/JavaLionLi/RuoYi-Vue-Plus/wikis/pages?sort_id=5805266&doc_id=1469725)    | 无注解零入侵基于java注释             | | ||||||
| | 工具类框架    | Hutool、Lombok       | [Hutool文档](https://www.hutool.cn/docs/)                                                           | 减少代码冗余 增加安全性               | | | 工具类框架    | Hutool、Lombok       | [Hutool文档](https://www.hutool.cn/docs/)                                                           | 减少代码冗余 增加安全性               | | ||||||
| | 代码生成器    | 适配MP、Knife4j规范化代码   | [Hutool文档](https://www.hutool.cn/docs/)                                                           | 一键生成前后端代码                  | | | 代码生成器    | 适配MP、Knife4j规范化代码   | [Hutool文档](https://www.hutool.cn/docs/)                                                           | 一键生成前后端代码                  | | ||||||
| | 部署方式     | Docker              | [Docker文档](https://docs.docker.com/)                                                              | 容器编排 一键部署业务集群              | | | 部署方式     | Docker              | [Docker文档](https://docs.docker.com/)                                                              | 容器编排 一键部署业务集群              | | ||||||
| @@ -56,11 +59,14 @@ | |||||||
|  |  | ||||||
| 使用框架前请仔细阅读文档重点注意事项 | 使用框架前请仔细阅读文档重点注意事项 | ||||||
| <br> | <br> | ||||||
| >[初始化项目 必看](https://gitee.com/JavaLionLi/RuoYi-Vue-Plus/wikis/关于初始化项目?sort_id=4164117) | >[初始化项目 必看](https://gitee.com/JavaLionLi/RuoYi-Vue-Plus/wikis/pages?sort_id=4164117&doc_id=1469725) | ||||||
| >>[https://gitee.com/JavaLionLi/RuoYi-Vue-Plus/wikis/关于初始化项目?sort_id=4164117](https://gitee.com/JavaLionLi/RuoYi-Vue-Plus/wikis/关于初始化项目?sort_id=4164117) | >>[https://gitee.com/JavaLionLi/RuoYi-Vue-Plus/wikis/pages?sort_id=4164117&doc_id=1469725](https://gitee.com/JavaLionLi/RuoYi-Vue-Plus/wikis/pages?sort_id=4164117&doc_id=1469725) | ||||||
| > | > | ||||||
| >[部署项目 必看](https://gitee.com/JavaLionLi/RuoYi-Vue-Plus/wikis/关于应用部署?sort_id=4219382) | >[专栏与视频 入门必看](https://gitee.com/JavaLionLi/RuoYi-Vue-Plus/wikis/pages?sort_id=5473272&doc_id=1469725) | ||||||
| >>[https://gitee.com/JavaLionLi/RuoYi-Vue-Plus/wikis/关于应用部署?sort_id=4219382](https://gitee.com/JavaLionLi/RuoYi-Vue-Plus/wikis/关于应用部署?sort_id=4219382) | >>[https://gitee.com/JavaLionLi/RuoYi-Vue-Plus/wikis/pages?sort_id=5473272&doc_id=1469725](https://gitee.com/JavaLionLi/RuoYi-Vue-Plus/wikis/pages?sort_id=5473272&doc_id=1469725) | ||||||
|  | > | ||||||
|  | >[部署项目 必看](https://gitee.com/JavaLionLi/RuoYi-Vue-Plus/wikis/pages?sort_id=4219382&doc_id=1469725) | ||||||
|  | >>[https://gitee.com/JavaLionLi/RuoYi-Vue-Plus/wikis/pages?sort_id=4219382&doc_id=1469725](https://gitee.com/JavaLionLi/RuoYi-Vue-Plus/wikis/pages?sort_id=4219382&doc_id=1469725) | ||||||
| >  | >  | ||||||
| >[参考文档 Wiki](https://gitee.com/JavaLionLi/RuoYi-Vue-Plus/wikis/pages) | >[参考文档 Wiki](https://gitee.com/JavaLionLi/RuoYi-Vue-Plus/wikis/pages) | ||||||
| >>[https://gitee.com/JavaLionLi/RuoYi-Vue-Plus/wikis/pages](https://gitee.com/JavaLionLi/RuoYi-Vue-Plus/wikis/pages) | >>[https://gitee.com/JavaLionLi/RuoYi-Vue-Plus/wikis/pages](https://gitee.com/JavaLionLi/RuoYi-Vue-Plus/wikis/pages) | ||||||
|   | |||||||
							
								
								
									
										75
									
								
								pom.xml
									
									
									
									
									
								
							
							
						
						
									
										75
									
								
								pom.xml
									
									
									
									
									
								
							| @@ -6,46 +6,46 @@ | |||||||
|  |  | ||||||
|     <groupId>com.ruoyi</groupId> |     <groupId>com.ruoyi</groupId> | ||||||
|     <artifactId>ruoyi-vue-plus</artifactId> |     <artifactId>ruoyi-vue-plus</artifactId> | ||||||
|     <version>4.2.0</version> |     <version>4.3.0-beta2</version> | ||||||
|  |  | ||||||
|     <name>RuoYi-Vue-Plus</name> |     <name>RuoYi-Vue-Plus</name> | ||||||
|     <url>https://gitee.com/JavaLionLi/RuoYi-Vue-Plus</url> |     <url>https://gitee.com/JavaLionLi/RuoYi-Vue-Plus</url> | ||||||
|     <description>RuoYi-Vue-Plus后台管理系统</description> |     <description>RuoYi-Vue-Plus后台管理系统</description> | ||||||
|  |  | ||||||
|     <properties> |     <properties> | ||||||
|         <ruoyi-vue-plus.version>4.2.0</ruoyi-vue-plus.version> |         <ruoyi-vue-plus.version>4.3.0-beta2</ruoyi-vue-plus.version> | ||||||
|         <spring-boot.version>2.6.9</spring-boot.version> |         <spring-boot.version>2.7.2</spring-boot.version> | ||||||
|         <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding> |         <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding> | ||||||
|         <project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding> |         <project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding> | ||||||
|         <java.version>1.8</java.version> |         <java.version>1.8</java.version> | ||||||
|         <maven-jar-plugin.version>3.2.2</maven-jar-plugin.version> |         <maven-jar-plugin.version>3.2.2</maven-jar-plugin.version> | ||||||
|         <spring-boot.mybatis>2.2.2</spring-boot.mybatis> |         <spring-boot.mybatis>2.2.2</spring-boot.mybatis> | ||||||
|         <druid.version>1.2.11</druid.version> |         <druid.version>1.2.11</druid.version> | ||||||
|         <knife4j.version>3.0.3</knife4j.version> |         <springdoc.version>1.6.9</springdoc.version> | ||||||
|         <swagger-annotations.version>1.5.22</swagger-annotations.version> |  | ||||||
|         <poi.version>5.2.2</poi.version> |         <poi.version>5.2.2</poi.version> | ||||||
|         <easyexcel.version>3.1.1</easyexcel.version> |         <easyexcel.version>3.1.1</easyexcel.version> | ||||||
|         <velocity.version>2.3</velocity.version> |         <velocity.version>2.3</velocity.version> | ||||||
|         <satoken.version>1.30.0</satoken.version> |         <satoken.version>1.30.0</satoken.version> | ||||||
|         <mybatis-plus.version>3.5.2</mybatis-plus.version> |         <mybatis-plus.version>3.5.2</mybatis-plus.version> | ||||||
|         <p6spy.version>3.9.1</p6spy.version> |         <p6spy.version>3.9.1</p6spy.version> | ||||||
|         <hutool.version>5.8.3</hutool.version> |         <hutool.version>5.8.5</hutool.version> | ||||||
|         <okhttp.version>4.9.3</okhttp.version> |         <okhttp.version>4.10.0</okhttp.version> | ||||||
|         <spring-boot-admin.version>2.6.7</spring-boot-admin.version> |         <spring-boot-admin.version>2.7.3</spring-boot-admin.version> | ||||||
|         <redisson.version>3.17.4</redisson.version> |         <redisson.version>3.17.5</redisson.version> | ||||||
|         <lock4j.version>2.2.1</lock4j.version> |         <lock4j.version>2.2.2</lock4j.version> | ||||||
|         <dynamic-ds.version>3.5.1</dynamic-ds.version> |         <dynamic-ds.version>3.5.1</dynamic-ds.version> | ||||||
|         <tlog.version>1.4.3</tlog.version> |         <tlog.version>1.4.3</tlog.version> | ||||||
|         <xxl-job.version>2.3.1</xxl-job.version> |         <xxl-job.version>2.3.1</xxl-job.version> | ||||||
|  |         <lombok.version>1.18.24</lombok.version> | ||||||
|  |  | ||||||
|         <!-- 统一 guava 版本 解决隐式漏洞问题 --> |         <!-- 统一 guava 版本 解决隐式漏洞问题 --> | ||||||
|         <guava.version>30.0-jre</guava.version> |         <guava.version>31.1-jre</guava.version> | ||||||
|  |  | ||||||
|         <!-- OSS 配置 --> |         <!-- OSS 配置 --> | ||||||
|         <aws-java-sdk-s3.version>1.12.248</aws-java-sdk-s3.version> |         <aws-java-sdk-s3.version>1.12.264</aws-java-sdk-s3.version> | ||||||
|         <!-- SMS 配置 --> |         <!-- SMS 配置 --> | ||||||
|         <aliyun.sms.version>2.0.9</aliyun.sms.version> |         <aliyun.sms.version>2.0.16</aliyun.sms.version> | ||||||
|         <tencent.sms.version>3.1.537</tencent.sms.version> |         <tencent.sms.version>3.1.555</tencent.sms.version> | ||||||
|  |  | ||||||
|         <!-- docker 配置 --> |         <!-- docker 配置 --> | ||||||
|         <docker.registry.url>localhost</docker.registry.url> |         <docker.registry.url>localhost</docker.registry.url> | ||||||
| @@ -85,21 +85,21 @@ | |||||||
|             </dependency> |             </dependency> | ||||||
|  |  | ||||||
|             <dependency> |             <dependency> | ||||||
|                 <groupId>com.github.xiaoymin</groupId> |                 <groupId>org.springdoc</groupId> | ||||||
|                 <artifactId>knife4j-spring-boot-starter</artifactId> |                 <artifactId>springdoc-openapi-webmvc-core</artifactId> | ||||||
|                 <version>${knife4j.version}</version> |                 <version>${springdoc.version}</version> | ||||||
|                 <exclusions> |  | ||||||
|                     <exclusion> |  | ||||||
|                         <artifactId>swagger-annotations</artifactId> |  | ||||||
|                         <groupId>io.swagger</groupId> |  | ||||||
|                     </exclusion> |  | ||||||
|                 </exclusions> |  | ||||||
|             </dependency> |             </dependency> | ||||||
|  |  | ||||||
|             <dependency> |             <dependency> | ||||||
|                 <groupId>io.swagger</groupId> |                 <groupId>org.springdoc</groupId> | ||||||
|                 <artifactId>swagger-annotations</artifactId> |                 <artifactId>springdoc-openapi-javadoc</artifactId> | ||||||
|                 <version>${swagger-annotations.version}</version> |                 <version>${springdoc.version}</version> | ||||||
|  |             </dependency> | ||||||
|  |  | ||||||
|  |             <dependency> | ||||||
|  |                 <groupId>org.projectlombok</groupId> | ||||||
|  |                 <artifactId>lombok</artifactId> | ||||||
|  |                 <version>${lombok.version}</version> | ||||||
|             </dependency> |             </dependency> | ||||||
|  |  | ||||||
|             <dependency> |             <dependency> | ||||||
| @@ -338,6 +338,23 @@ | |||||||
|                     <source>${java.version}</source> |                     <source>${java.version}</source> | ||||||
|                     <target>${java.version}</target> |                     <target>${java.version}</target> | ||||||
|                     <encoding>${project.build.sourceEncoding}</encoding> |                     <encoding>${project.build.sourceEncoding}</encoding> | ||||||
|  |                     <annotationProcessorPaths> | ||||||
|  |                         <path> | ||||||
|  |                             <groupId>com.github.therapi</groupId> | ||||||
|  |                             <artifactId>therapi-runtime-javadoc-scribe</artifactId> | ||||||
|  |                             <version>0.13.0</version> | ||||||
|  |                         </path> | ||||||
|  |                         <path> | ||||||
|  |                             <groupId>org.projectlombok</groupId> | ||||||
|  |                             <artifactId>lombok</artifactId> | ||||||
|  |                             <version>${lombok.version}</version> | ||||||
|  |                         </path> | ||||||
|  |                         <path> | ||||||
|  |                             <groupId>org.springframework.boot</groupId> | ||||||
|  |                             <artifactId>spring-boot-configuration-processor</artifactId> | ||||||
|  |                             <version>${spring-boot.version}</version> | ||||||
|  |                         </path> | ||||||
|  |                     </annotationProcessorPaths> | ||||||
|                 </configuration> |                 </configuration> | ||||||
|             </plugin> |             </plugin> | ||||||
|         </plugins> |         </plugins> | ||||||
| @@ -393,8 +410,6 @@ | |||||||
|                 <!-- 环境标识,需要与配置文件的名称相对应 --> |                 <!-- 环境标识,需要与配置文件的名称相对应 --> | ||||||
|                 <profiles.active>local</profiles.active> |                 <profiles.active>local</profiles.active> | ||||||
|                 <logging.level>debug</logging.level> |                 <logging.level>debug</logging.level> | ||||||
|                 <knife4j.production>false</knife4j.production> |  | ||||||
|                 <endpoints.include>'*'</endpoints.include> |  | ||||||
|             </properties> |             </properties> | ||||||
|         </profile> |         </profile> | ||||||
|         <profile> |         <profile> | ||||||
| @@ -403,8 +418,6 @@ | |||||||
|                 <!-- 环境标识,需要与配置文件的名称相对应 --> |                 <!-- 环境标识,需要与配置文件的名称相对应 --> | ||||||
|                 <profiles.active>dev</profiles.active> |                 <profiles.active>dev</profiles.active> | ||||||
|                 <logging.level>debug</logging.level> |                 <logging.level>debug</logging.level> | ||||||
|                 <knife4j.production>false</knife4j.production> |  | ||||||
|                 <endpoints.include>'*'</endpoints.include> |  | ||||||
|             </properties> |             </properties> | ||||||
|             <activation> |             <activation> | ||||||
|                 <!-- 默认环境 --> |                 <!-- 默认环境 --> | ||||||
| @@ -416,8 +429,6 @@ | |||||||
|             <properties> |             <properties> | ||||||
|                 <profiles.active>prod</profiles.active> |                 <profiles.active>prod</profiles.active> | ||||||
|                 <logging.level>warn</logging.level> |                 <logging.level>warn</logging.level> | ||||||
|                 <knife4j.production>true</knife4j.production> |  | ||||||
|                 <endpoints.include>health, info, logfile</endpoints.include> |  | ||||||
|             </properties> |             </properties> | ||||||
|         </profile> |         </profile> | ||||||
|     </profiles> |     </profiles> | ||||||
|   | |||||||
| @@ -8,8 +8,10 @@ RUN mkdir -p /ruoyi/server/temp | |||||||
|  |  | ||||||
| WORKDIR /ruoyi/server | WORKDIR /ruoyi/server | ||||||
|  |  | ||||||
| EXPOSE 8080 | ENV SERVER_PORT=8080 | ||||||
|  |  | ||||||
|  | EXPOSE ${SERVER_PORT} | ||||||
|  |  | ||||||
| ADD ./target/ruoyi-admin.jar ./app.jar | ADD ./target/ruoyi-admin.jar ./app.jar | ||||||
|  |  | ||||||
| ENTRYPOINT ["java", "-Djava.security.egd=file:/dev/./urandom", "-jar", "app.jar"] | ENTRYPOINT ["java", "-Djava.security.egd=file:/dev/./urandom", "-Dserver.port=${SERVER_PORT}","-jar", "app.jar"] | ||||||
|   | |||||||
| @@ -5,7 +5,7 @@ | |||||||
|     <parent> |     <parent> | ||||||
|         <artifactId>ruoyi-vue-plus</artifactId> |         <artifactId>ruoyi-vue-plus</artifactId> | ||||||
|         <groupId>com.ruoyi</groupId> |         <groupId>com.ruoyi</groupId> | ||||||
|         <version>4.2.0</version> |         <version>4.3.0-beta2</version> | ||||||
|     </parent> |     </parent> | ||||||
|     <modelVersion>4.0.0</modelVersion> |     <modelVersion>4.0.0</modelVersion> | ||||||
|     <packaging>jar</packaging> |     <packaging>jar</packaging> | ||||||
|   | |||||||
| @@ -6,6 +6,7 @@ import cn.hutool.core.convert.Convert; | |||||||
| import cn.hutool.core.util.IdUtil; | import cn.hutool.core.util.IdUtil; | ||||||
| import cn.hutool.core.util.RandomUtil; | import cn.hutool.core.util.RandomUtil; | ||||||
| import com.ruoyi.common.annotation.Anonymous; | import com.ruoyi.common.annotation.Anonymous; | ||||||
|  | import com.ruoyi.common.constant.CacheConstants; | ||||||
| import com.ruoyi.common.constant.Constants; | import com.ruoyi.common.constant.Constants; | ||||||
| import com.ruoyi.common.core.domain.R; | import com.ruoyi.common.core.domain.R; | ||||||
| import com.ruoyi.common.enums.CaptchaType; | import com.ruoyi.common.enums.CaptchaType; | ||||||
| @@ -18,9 +19,6 @@ import com.ruoyi.sms.config.properties.SmsProperties; | |||||||
| import com.ruoyi.sms.core.SmsTemplate; | import com.ruoyi.sms.core.SmsTemplate; | ||||||
| import com.ruoyi.sms.entity.SmsResult; | import com.ruoyi.sms.entity.SmsResult; | ||||||
| import com.ruoyi.system.service.ISysConfigService; | import com.ruoyi.system.service.ISysConfigService; | ||||||
| import io.swagger.annotations.Api; |  | ||||||
| import io.swagger.annotations.ApiOperation; |  | ||||||
| import io.swagger.annotations.ApiParam; |  | ||||||
| import lombok.RequiredArgsConstructor; | import lombok.RequiredArgsConstructor; | ||||||
| import lombok.extern.slf4j.Slf4j; | import lombok.extern.slf4j.Slf4j; | ||||||
| import org.springframework.validation.annotation.Validated; | import org.springframework.validation.annotation.Validated; | ||||||
| @@ -40,7 +38,6 @@ import java.util.Map; | |||||||
| @Anonymous | @Anonymous | ||||||
| @Slf4j | @Slf4j | ||||||
| @Validated | @Validated | ||||||
| @Api(value = "验证码操作处理", tags = {"验证码管理"}) |  | ||||||
| @RequiredArgsConstructor | @RequiredArgsConstructor | ||||||
| @RestController | @RestController | ||||||
| public class CaptchaController { | public class CaptchaController { | ||||||
| @@ -51,16 +48,16 @@ public class CaptchaController { | |||||||
|  |  | ||||||
|     /** |     /** | ||||||
|      * 短信验证码 |      * 短信验证码 | ||||||
|  |      * | ||||||
|  |      * @param phonenumber 用户手机号 | ||||||
|      */ |      */ | ||||||
|     @ApiOperation("短信验证码") |  | ||||||
|     @GetMapping("/captchaSms") |     @GetMapping("/captchaSms") | ||||||
|     public R<Void> smsCaptcha(@ApiParam("用户手机号") |     public R<Void> smsCaptcha(@NotBlank(message = "{user.phonenumber.not.blank}") | ||||||
|                               @NotBlank(message = "{user.phonenumber.not.blank}") |  | ||||||
|                               String phonenumber) { |                               String phonenumber) { | ||||||
|         if (smsProperties.getEnabled()) { |         if (!smsProperties.getEnabled()) { | ||||||
|             R.fail("当前系统没有开启短信功能!"); |             return R.fail("当前系统没有开启短信功能!"); | ||||||
|         } |         } | ||||||
|         String key = Constants.CAPTCHA_CODE_KEY + phonenumber; |         String key = CacheConstants.CAPTCHA_CODE_KEY + phonenumber; | ||||||
|         String code = RandomUtil.randomNumbers(4); |         String code = RandomUtil.randomNumbers(4); | ||||||
|         RedisUtils.setCacheObject(key, code, Duration.ofMinutes(Constants.CAPTCHA_EXPIRATION)); |         RedisUtils.setCacheObject(key, code, Duration.ofMinutes(Constants.CAPTCHA_EXPIRATION)); | ||||||
|         // 验证码模板id 自行处理 (查数据库或写死均可) |         // 验证码模板id 自行处理 (查数据库或写死均可) | ||||||
| @@ -79,18 +76,17 @@ public class CaptchaController { | |||||||
|     /** |     /** | ||||||
|      * 生成验证码 |      * 生成验证码 | ||||||
|      */ |      */ | ||||||
|     @ApiOperation("生成验证码") |  | ||||||
|     @GetMapping("/captchaImage") |     @GetMapping("/captchaImage") | ||||||
|     public R<Map<String, Object>> getCode() { |     public R<Map<String, Object>> getCode() { | ||||||
|         Map<String, Object> ajax = new HashMap<>(); |         Map<String, Object> ajax = new HashMap<>(); | ||||||
|         boolean captchaOnOff = configService.selectCaptchaOnOff(); |         boolean captchaEnabled = configService.selectCaptchaEnabled(); | ||||||
|         ajax.put("captchaOnOff", captchaOnOff); |         ajax.put("captchaEnabled", captchaEnabled); | ||||||
|         if (!captchaOnOff) { |         if (!captchaEnabled) { | ||||||
|             return R.ok(ajax); |             return R.ok(ajax); | ||||||
|         } |         } | ||||||
|         // 保存验证码信息 |         // 保存验证码信息 | ||||||
|         String uuid = IdUtil.simpleUUID(); |         String uuid = IdUtil.simpleUUID(); | ||||||
|         String verifyKey = Constants.CAPTCHA_CODE_KEY + uuid; |         String verifyKey = CacheConstants.CAPTCHA_CODE_KEY + uuid; | ||||||
|         // 生成验证码 |         // 生成验证码 | ||||||
|         CaptchaType captchaType = captchaProperties.getType(); |         CaptchaType captchaType = captchaProperties.getType(); | ||||||
|         boolean isMath = CaptchaType.MATH == captchaType; |         boolean isMath = CaptchaType.MATH == captchaType; | ||||||
|   | |||||||
| @@ -1,40 +1,59 @@ | |||||||
| package com.ruoyi.web.controller.monitor; | package com.ruoyi.web.controller.monitor; | ||||||
|  |  | ||||||
| import cn.dev33.satoken.annotation.SaCheckPermission; | import cn.dev33.satoken.annotation.SaCheckPermission; | ||||||
|  | import cn.hutool.core.collection.CollUtil; | ||||||
|  | import com.ruoyi.common.constant.CacheConstants; | ||||||
|  | import com.ruoyi.common.constant.CacheNames; | ||||||
| import com.ruoyi.common.core.domain.R; | import com.ruoyi.common.core.domain.R; | ||||||
|  | import com.ruoyi.common.utils.JsonUtils; | ||||||
| import com.ruoyi.common.utils.StringUtils; | import com.ruoyi.common.utils.StringUtils; | ||||||
| import io.swagger.annotations.Api; | import com.ruoyi.common.utils.redis.CacheUtils; | ||||||
| import io.swagger.annotations.ApiOperation; | import com.ruoyi.common.utils.redis.RedisUtils; | ||||||
|  | import com.ruoyi.system.domain.SysCache; | ||||||
| import lombok.RequiredArgsConstructor; | import lombok.RequiredArgsConstructor; | ||||||
| import org.springframework.data.redis.connection.RedisServerCommands; | import org.redisson.spring.data.connection.RedissonConnectionFactory; | ||||||
| import org.springframework.data.redis.core.RedisCallback; | import org.springframework.data.redis.connection.RedisConnection; | ||||||
| import org.springframework.data.redis.core.RedisTemplate; | import org.springframework.web.bind.annotation.*; | ||||||
| import org.springframework.web.bind.annotation.GetMapping; |  | ||||||
| import org.springframework.web.bind.annotation.RequestMapping; |  | ||||||
| import org.springframework.web.bind.annotation.RestController; |  | ||||||
|  |  | ||||||
| import java.util.*; | import java.util.*; | ||||||
|  | import java.util.stream.Collectors; | ||||||
|  |  | ||||||
| /** | /** | ||||||
|  * 缓存监控 |  * 缓存监控 | ||||||
|  * |  * | ||||||
|  * @author Lion Li |  * @author Lion Li | ||||||
|  */ |  */ | ||||||
| @Api(value = "缓存监控", tags = {"缓存监控管理"}) |  | ||||||
| @RequiredArgsConstructor | @RequiredArgsConstructor | ||||||
| @RestController | @RestController | ||||||
| @RequestMapping("/monitor/cache") | @RequestMapping("/monitor/cache") | ||||||
| public class CacheController { | public class CacheController { | ||||||
|  |  | ||||||
|     private final RedisTemplate<String, String> redisTemplate; |     private final RedissonConnectionFactory connectionFactory; | ||||||
|  |  | ||||||
|     @ApiOperation("获取缓存监控详细信息") |     private final static List<SysCache> CACHES = new ArrayList<>(); | ||||||
|  |  | ||||||
|  |     static { | ||||||
|  |         CACHES.add(new SysCache(CacheConstants.LOGIN_TOKEN_KEY, "用户信息")); | ||||||
|  |         CACHES.add(new SysCache(CacheNames.ONLINE_TOKEN, "在线用户")); | ||||||
|  |         CACHES.add(new SysCache(CacheNames.SYS_CONFIG, "配置信息")); | ||||||
|  |         CACHES.add(new SysCache(CacheNames.SYS_DICT, "数据字典")); | ||||||
|  |         CACHES.add(new SysCache(CacheConstants.CAPTCHA_CODE_KEY, "验证码")); | ||||||
|  |         CACHES.add(new SysCache(CacheConstants.REPEAT_SUBMIT_KEY, "防重提交")); | ||||||
|  |         CACHES.add(new SysCache(CacheConstants.RATE_LIMIT_KEY, "限流处理")); | ||||||
|  |         CACHES.add(new SysCache(CacheNames.SYS_OSS_CONFIG, "OSS配置")); | ||||||
|  |         CACHES.add(new SysCache(CacheConstants.PWD_ERR_CNT_KEY, "密码错误次数")); | ||||||
|  |     } | ||||||
|  |  | ||||||
|  |     /** | ||||||
|  |      * 获取缓存监控列表 | ||||||
|  |      */ | ||||||
|     @SaCheckPermission("monitor:cache:list") |     @SaCheckPermission("monitor:cache:list") | ||||||
|     @GetMapping() |     @GetMapping() | ||||||
|     public R<Map<String, Object>> getInfo() throws Exception { |     public R<Map<String, Object>> getInfo() throws Exception { | ||||||
|         Properties info = (Properties) redisTemplate.execute((RedisCallback<Object>) RedisServerCommands::info); |         RedisConnection connection = connectionFactory.getConnection(); | ||||||
|         Properties commandStats = (Properties) redisTemplate.execute((RedisCallback<Object>) connection -> connection.info("commandstats")); |         Properties info = connection.info(); | ||||||
|         Object dbSize = redisTemplate.execute((RedisCallback<Object>) RedisServerCommands::dbSize); |         Properties commandStats = connection.info("commandstats"); | ||||||
|  |         Long dbSize = connection.dbSize(); | ||||||
|  |  | ||||||
|         Map<String, Object> result = new HashMap<>(3); |         Map<String, Object> result = new HashMap<>(3); | ||||||
|         result.put("info", info); |         result.put("info", info); | ||||||
| @@ -53,4 +72,98 @@ public class CacheController { | |||||||
|         result.put("commandStats", pieList); |         result.put("commandStats", pieList); | ||||||
|         return R.ok(result); |         return R.ok(result); | ||||||
|     } |     } | ||||||
|  |  | ||||||
|  |     /** | ||||||
|  |      * 获取缓存监控缓存名列表 | ||||||
|  |      */ | ||||||
|  |     @SaCheckPermission("monitor:cache:list") | ||||||
|  |     @GetMapping("/getNames") | ||||||
|  |     public R<List<SysCache>> cache() { | ||||||
|  |         return R.ok(CACHES); | ||||||
|  |     } | ||||||
|  |  | ||||||
|  |     /** | ||||||
|  |      * 获取缓存监控Key列表 | ||||||
|  |      * | ||||||
|  |      * @param cacheName 缓存名 | ||||||
|  |      */ | ||||||
|  |     @SaCheckPermission("monitor:cache:list") | ||||||
|  |     @GetMapping("/getKeys/{cacheName}") | ||||||
|  |     public R<Collection<String>> getCacheKeys(@PathVariable String cacheName) { | ||||||
|  |         Collection<String> cacheKeys = new HashSet<>(0); | ||||||
|  |         if (isCacheNames(cacheName)) { | ||||||
|  |             Set<Object> keys = CacheUtils.keys(cacheName); | ||||||
|  |             if (CollUtil.isNotEmpty(keys)) { | ||||||
|  |                 cacheKeys = keys.stream().map(Object::toString).collect(Collectors.toList()); | ||||||
|  |             } | ||||||
|  |         } else { | ||||||
|  |             cacheKeys = RedisUtils.keys(cacheName + "*"); | ||||||
|  |         } | ||||||
|  |         return R.ok(cacheKeys); | ||||||
|  |     } | ||||||
|  |  | ||||||
|  |     /** | ||||||
|  |      * 获取缓存监控缓存值详情 | ||||||
|  |      * | ||||||
|  |      * @param cacheName 缓存名 | ||||||
|  |      * @param cacheKey  缓存key | ||||||
|  |      */ | ||||||
|  |     @SaCheckPermission("monitor:cache:list") | ||||||
|  |     @GetMapping("/getValue/{cacheName}/{cacheKey}") | ||||||
|  |     public R<SysCache> getCacheValue(@PathVariable String cacheName, @PathVariable String cacheKey) { | ||||||
|  |         Object cacheValue; | ||||||
|  |         if (isCacheNames(cacheName)) { | ||||||
|  |             cacheValue = CacheUtils.get(cacheName, cacheKey); | ||||||
|  |         } else { | ||||||
|  |             cacheValue = RedisUtils.getCacheObject(cacheKey); | ||||||
|  |         } | ||||||
|  |         SysCache sysCache = new SysCache(cacheName, cacheKey, JsonUtils.toJsonString(cacheValue)); | ||||||
|  |         return R.ok(sysCache); | ||||||
|  |     } | ||||||
|  |  | ||||||
|  |     /** | ||||||
|  |      * 清理缓存监控缓存名 | ||||||
|  |      * | ||||||
|  |      * @param cacheName 缓存名 | ||||||
|  |      */ | ||||||
|  |     @SaCheckPermission("monitor:cache:list") | ||||||
|  |     @DeleteMapping("/clearCacheName/{cacheName}") | ||||||
|  |     public R<Void> clearCacheName(@PathVariable String cacheName) { | ||||||
|  |         if (isCacheNames(cacheName)) { | ||||||
|  |             CacheUtils.clear(cacheName); | ||||||
|  |         } else { | ||||||
|  |             RedisUtils.deleteKeys(cacheName + "*"); | ||||||
|  |         } | ||||||
|  |         return R.ok(); | ||||||
|  |     } | ||||||
|  |  | ||||||
|  |     /** | ||||||
|  |      * 清理缓存监控Key | ||||||
|  |      * | ||||||
|  |      * @param cacheKey key名 | ||||||
|  |      */ | ||||||
|  |     @SaCheckPermission("monitor:cache:list") | ||||||
|  |     @DeleteMapping("/clearCacheKey/{cacheName}/{cacheKey}") | ||||||
|  |     public R<Void> clearCacheKey(@PathVariable String cacheName, @PathVariable String cacheKey) { | ||||||
|  |         if (isCacheNames(cacheName)) { | ||||||
|  |             CacheUtils.evict(cacheName, cacheKey); | ||||||
|  |         } else { | ||||||
|  |             RedisUtils.deleteObject(cacheKey); | ||||||
|  |         } | ||||||
|  |         return R.ok(); | ||||||
|  |     } | ||||||
|  |  | ||||||
|  |     /** | ||||||
|  |      * 清理全部缓存监控 | ||||||
|  |      */ | ||||||
|  |     @SaCheckPermission("monitor:cache:list") | ||||||
|  |     @DeleteMapping("/clearCacheAll") | ||||||
|  |     public R<Void> clearCacheAll() { | ||||||
|  |         RedisUtils.deleteKeys("*"); | ||||||
|  |         return R.ok(); | ||||||
|  |     } | ||||||
|  |  | ||||||
|  |     private boolean isCacheNames(String cacheName) { | ||||||
|  |         return !StringUtils.contains(cacheName, ":"); | ||||||
|  |     } | ||||||
| } | } | ||||||
|   | |||||||
| @@ -2,16 +2,16 @@ package com.ruoyi.web.controller.monitor; | |||||||
|  |  | ||||||
| import cn.dev33.satoken.annotation.SaCheckPermission; | import cn.dev33.satoken.annotation.SaCheckPermission; | ||||||
| import com.ruoyi.common.annotation.Log; | import com.ruoyi.common.annotation.Log; | ||||||
|  | import com.ruoyi.common.constant.CacheConstants; | ||||||
| import com.ruoyi.common.core.controller.BaseController; | import com.ruoyi.common.core.controller.BaseController; | ||||||
| import com.ruoyi.common.core.domain.R; |  | ||||||
| import com.ruoyi.common.core.domain.PageQuery; | import com.ruoyi.common.core.domain.PageQuery; | ||||||
|  | import com.ruoyi.common.core.domain.R; | ||||||
| import com.ruoyi.common.core.page.TableDataInfo; | import com.ruoyi.common.core.page.TableDataInfo; | ||||||
| import com.ruoyi.common.enums.BusinessType; | import com.ruoyi.common.enums.BusinessType; | ||||||
| import com.ruoyi.common.utils.poi.ExcelUtil; | import com.ruoyi.common.utils.poi.ExcelUtil; | ||||||
|  | import com.ruoyi.common.utils.redis.RedisUtils; | ||||||
| import com.ruoyi.system.domain.SysLogininfor; | import com.ruoyi.system.domain.SysLogininfor; | ||||||
| import com.ruoyi.system.service.ISysLogininforService; | import com.ruoyi.system.service.ISysLogininforService; | ||||||
| import io.swagger.annotations.Api; |  | ||||||
| import io.swagger.annotations.ApiOperation; |  | ||||||
| import lombok.RequiredArgsConstructor; | import lombok.RequiredArgsConstructor; | ||||||
| import org.springframework.validation.annotation.Validated; | import org.springframework.validation.annotation.Validated; | ||||||
| import org.springframework.web.bind.annotation.*; | import org.springframework.web.bind.annotation.*; | ||||||
| @@ -25,7 +25,6 @@ import java.util.List; | |||||||
|  * @author Lion Li |  * @author Lion Li | ||||||
|  */ |  */ | ||||||
| @Validated | @Validated | ||||||
| @Api(value = "系统访问记录", tags = {"系统访问记录管理"}) |  | ||||||
| @RequiredArgsConstructor | @RequiredArgsConstructor | ||||||
| @RestController | @RestController | ||||||
| @RequestMapping("/monitor/logininfor") | @RequestMapping("/monitor/logininfor") | ||||||
| @@ -33,14 +32,18 @@ public class SysLogininforController extends BaseController { | |||||||
|  |  | ||||||
|     private final ISysLogininforService logininforService; |     private final ISysLogininforService logininforService; | ||||||
|  |  | ||||||
|     @ApiOperation("查询系统访问记录列表") |     /** | ||||||
|  |      * 获取系统访问记录列表 | ||||||
|  |      */ | ||||||
|     @SaCheckPermission("monitor:logininfor:list") |     @SaCheckPermission("monitor:logininfor:list") | ||||||
|     @GetMapping("/list") |     @GetMapping("/list") | ||||||
|     public TableDataInfo<SysLogininfor> list(SysLogininfor logininfor, PageQuery pageQuery) { |     public TableDataInfo<SysLogininfor> list(SysLogininfor logininfor, PageQuery pageQuery) { | ||||||
|         return logininforService.selectPageLogininforList(logininfor, pageQuery); |         return logininforService.selectPageLogininforList(logininfor, pageQuery); | ||||||
|     } |     } | ||||||
|  |  | ||||||
|     @ApiOperation("导出系统访问记录列表") |     /** | ||||||
|  |      * 导出系统访问记录列表 | ||||||
|  |      */ | ||||||
|     @Log(title = "登录日志", businessType = BusinessType.EXPORT) |     @Log(title = "登录日志", businessType = BusinessType.EXPORT) | ||||||
|     @SaCheckPermission("monitor:logininfor:export") |     @SaCheckPermission("monitor:logininfor:export") | ||||||
|     @PostMapping("/export") |     @PostMapping("/export") | ||||||
| @@ -49,7 +52,10 @@ public class SysLogininforController extends BaseController { | |||||||
|         ExcelUtil.exportExcel(list, "登录日志", SysLogininfor.class, response); |         ExcelUtil.exportExcel(list, "登录日志", SysLogininfor.class, response); | ||||||
|     } |     } | ||||||
|  |  | ||||||
|     @ApiOperation("删除系统访问记录") |     /** | ||||||
|  |      * 批量删除登录日志 | ||||||
|  |      * @param infoIds 日志ids | ||||||
|  |      */ | ||||||
|     @SaCheckPermission("monitor:logininfor:remove") |     @SaCheckPermission("monitor:logininfor:remove") | ||||||
|     @Log(title = "登录日志", businessType = BusinessType.DELETE) |     @Log(title = "登录日志", businessType = BusinessType.DELETE) | ||||||
|     @DeleteMapping("/{infoIds}") |     @DeleteMapping("/{infoIds}") | ||||||
| @@ -57,7 +63,9 @@ public class SysLogininforController extends BaseController { | |||||||
|         return toAjax(logininforService.deleteLogininforByIds(infoIds)); |         return toAjax(logininforService.deleteLogininforByIds(infoIds)); | ||||||
|     } |     } | ||||||
|  |  | ||||||
|     @ApiOperation("清空系统访问记录") |     /** | ||||||
|  |      * 清理系统访问记录 | ||||||
|  |      */ | ||||||
|     @SaCheckPermission("monitor:logininfor:remove") |     @SaCheckPermission("monitor:logininfor:remove") | ||||||
|     @Log(title = "登录日志", businessType = BusinessType.CLEAN) |     @Log(title = "登录日志", businessType = BusinessType.CLEAN) | ||||||
|     @DeleteMapping("/clean") |     @DeleteMapping("/clean") | ||||||
| @@ -65,4 +73,16 @@ public class SysLogininforController extends BaseController { | |||||||
|         logininforService.cleanLogininfor(); |         logininforService.cleanLogininfor(); | ||||||
|         return R.ok(); |         return R.ok(); | ||||||
|     } |     } | ||||||
|  |  | ||||||
|  |     @SaCheckPermission("monitor:logininfor:unlock") | ||||||
|  |     @Log(title = "账户解锁", businessType = BusinessType.OTHER) | ||||||
|  |     @GetMapping("/unlock/{userName}") | ||||||
|  |     public R<Void> unlock(@PathVariable("userName") String userName) { | ||||||
|  |         String loginName = CacheConstants.PWD_ERR_CNT_KEY + userName; | ||||||
|  |         if (RedisUtils.hasKey(loginName)) { | ||||||
|  |             RedisUtils.deleteObject(loginName); | ||||||
|  |         } | ||||||
|  |         return R.ok(); | ||||||
|  |     } | ||||||
|  |  | ||||||
| } | } | ||||||
|   | |||||||
| @@ -3,15 +3,13 @@ package com.ruoyi.web.controller.monitor; | |||||||
| import cn.dev33.satoken.annotation.SaCheckPermission; | import cn.dev33.satoken.annotation.SaCheckPermission; | ||||||
| import com.ruoyi.common.annotation.Log; | import com.ruoyi.common.annotation.Log; | ||||||
| import com.ruoyi.common.core.controller.BaseController; | import com.ruoyi.common.core.controller.BaseController; | ||||||
| import com.ruoyi.common.core.domain.R; |  | ||||||
| import com.ruoyi.common.core.domain.PageQuery; | import com.ruoyi.common.core.domain.PageQuery; | ||||||
|  | import com.ruoyi.common.core.domain.R; | ||||||
| import com.ruoyi.common.core.page.TableDataInfo; | import com.ruoyi.common.core.page.TableDataInfo; | ||||||
| import com.ruoyi.common.enums.BusinessType; | import com.ruoyi.common.enums.BusinessType; | ||||||
| import com.ruoyi.common.utils.poi.ExcelUtil; | import com.ruoyi.common.utils.poi.ExcelUtil; | ||||||
| import com.ruoyi.system.domain.SysOperLog; | import com.ruoyi.system.domain.SysOperLog; | ||||||
| import com.ruoyi.system.service.ISysOperLogService; | import com.ruoyi.system.service.ISysOperLogService; | ||||||
| import io.swagger.annotations.Api; |  | ||||||
| import io.swagger.annotations.ApiOperation; |  | ||||||
| import lombok.RequiredArgsConstructor; | import lombok.RequiredArgsConstructor; | ||||||
| import org.springframework.validation.annotation.Validated; | import org.springframework.validation.annotation.Validated; | ||||||
| import org.springframework.web.bind.annotation.*; | import org.springframework.web.bind.annotation.*; | ||||||
| @@ -25,7 +23,6 @@ import java.util.List; | |||||||
|  * @author Lion Li |  * @author Lion Li | ||||||
|  */ |  */ | ||||||
| @Validated | @Validated | ||||||
| @Api(value = "操作日志记录", tags = {"操作日志记录管理"}) |  | ||||||
| @RequiredArgsConstructor | @RequiredArgsConstructor | ||||||
| @RestController | @RestController | ||||||
| @RequestMapping("/monitor/operlog") | @RequestMapping("/monitor/operlog") | ||||||
| @@ -33,14 +30,18 @@ public class SysOperlogController extends BaseController { | |||||||
|  |  | ||||||
|     private final ISysOperLogService operLogService; |     private final ISysOperLogService operLogService; | ||||||
|  |  | ||||||
|     @ApiOperation("查询操作日志记录列表") |     /** | ||||||
|  |      * 获取操作日志记录列表 | ||||||
|  |      */ | ||||||
|     @SaCheckPermission("monitor:operlog:list") |     @SaCheckPermission("monitor:operlog:list") | ||||||
|     @GetMapping("/list") |     @GetMapping("/list") | ||||||
|     public TableDataInfo<SysOperLog> list(SysOperLog operLog, PageQuery pageQuery) { |     public TableDataInfo<SysOperLog> list(SysOperLog operLog, PageQuery pageQuery) { | ||||||
|         return operLogService.selectPageOperLogList(operLog, pageQuery); |         return operLogService.selectPageOperLogList(operLog, pageQuery); | ||||||
|     } |     } | ||||||
|  |  | ||||||
|     @ApiOperation("导出操作日志记录列表") |     /** | ||||||
|  |      * 导出操作日志记录列表 | ||||||
|  |      */ | ||||||
|     @Log(title = "操作日志", businessType = BusinessType.EXPORT) |     @Log(title = "操作日志", businessType = BusinessType.EXPORT) | ||||||
|     @SaCheckPermission("monitor:operlog:export") |     @SaCheckPermission("monitor:operlog:export") | ||||||
|     @PostMapping("/export") |     @PostMapping("/export") | ||||||
| @@ -49,7 +50,10 @@ public class SysOperlogController extends BaseController { | |||||||
|         ExcelUtil.exportExcel(list, "操作日志", SysOperLog.class, response); |         ExcelUtil.exportExcel(list, "操作日志", SysOperLog.class, response); | ||||||
|     } |     } | ||||||
|  |  | ||||||
|     @ApiOperation("删除操作日志记录") |     /** | ||||||
|  |      * 批量删除操作日志记录 | ||||||
|  |      * @param operIds 日志ids | ||||||
|  |      */ | ||||||
|     @Log(title = "操作日志", businessType = BusinessType.DELETE) |     @Log(title = "操作日志", businessType = BusinessType.DELETE) | ||||||
|     @SaCheckPermission("monitor:operlog:remove") |     @SaCheckPermission("monitor:operlog:remove") | ||||||
|     @DeleteMapping("/{operIds}") |     @DeleteMapping("/{operIds}") | ||||||
| @@ -57,7 +61,9 @@ public class SysOperlogController extends BaseController { | |||||||
|         return toAjax(operLogService.deleteOperLogByIds(operIds)); |         return toAjax(operLogService.deleteOperLogByIds(operIds)); | ||||||
|     } |     } | ||||||
|  |  | ||||||
|     @ApiOperation("清空操作日志记录") |     /** | ||||||
|  |      * 清理操作日志记录 | ||||||
|  |      */ | ||||||
|     @Log(title = "操作日志", businessType = BusinessType.CLEAN) |     @Log(title = "操作日志", businessType = BusinessType.CLEAN) | ||||||
|     @SaCheckPermission("monitor:operlog:remove") |     @SaCheckPermission("monitor:operlog:remove") | ||||||
|     @DeleteMapping("/clean") |     @DeleteMapping("/clean") | ||||||
|   | |||||||
| @@ -5,37 +5,40 @@ import cn.dev33.satoken.exception.NotLoginException; | |||||||
| import cn.dev33.satoken.stp.StpUtil; | import cn.dev33.satoken.stp.StpUtil; | ||||||
| import cn.hutool.core.bean.BeanUtil; | import cn.hutool.core.bean.BeanUtil; | ||||||
| import com.ruoyi.common.annotation.Log; | import com.ruoyi.common.annotation.Log; | ||||||
| import com.ruoyi.common.constant.Constants; | import com.ruoyi.common.constant.CacheConstants; | ||||||
|  | import com.ruoyi.common.constant.CacheNames; | ||||||
| import com.ruoyi.common.core.controller.BaseController; | import com.ruoyi.common.core.controller.BaseController; | ||||||
| import com.ruoyi.common.core.domain.R; | import com.ruoyi.common.core.domain.R; | ||||||
| import com.ruoyi.common.core.domain.dto.UserOnlineDTO; | import com.ruoyi.common.core.domain.dto.UserOnlineDTO; | ||||||
| import com.ruoyi.common.core.page.TableDataInfo; | import com.ruoyi.common.core.page.TableDataInfo; | ||||||
| import com.ruoyi.common.enums.BusinessType; | import com.ruoyi.common.enums.BusinessType; | ||||||
|  | import com.ruoyi.common.utils.StreamUtils; | ||||||
| import com.ruoyi.common.utils.StringUtils; | import com.ruoyi.common.utils.StringUtils; | ||||||
| import com.ruoyi.common.utils.redis.RedisUtils; | import com.ruoyi.common.utils.redis.CacheUtils; | ||||||
| import com.ruoyi.system.domain.SysUserOnline; | import com.ruoyi.system.domain.SysUserOnline; | ||||||
| import io.swagger.annotations.Api; |  | ||||||
| import io.swagger.annotations.ApiOperation; |  | ||||||
| import lombok.RequiredArgsConstructor; | import lombok.RequiredArgsConstructor; | ||||||
| import org.springframework.web.bind.annotation.*; | import org.springframework.web.bind.annotation.*; | ||||||
|  |  | ||||||
| import java.util.ArrayList; | import java.util.ArrayList; | ||||||
| import java.util.Collections; | import java.util.Collections; | ||||||
| import java.util.List; | import java.util.List; | ||||||
| import java.util.stream.Collectors; |  | ||||||
|  |  | ||||||
| /** | /** | ||||||
|  * 在线用户监控 |  * 在线用户监控 | ||||||
|  * |  * | ||||||
|  * @author Lion Li |  * @author Lion Li | ||||||
|  */ |  */ | ||||||
| @Api(value = "在线用户监控", tags = {"在线用户监控管理"}) |  | ||||||
| @RequiredArgsConstructor | @RequiredArgsConstructor | ||||||
| @RestController | @RestController | ||||||
| @RequestMapping("/monitor/online") | @RequestMapping("/monitor/online") | ||||||
| public class SysUserOnlineController extends BaseController { | public class SysUserOnlineController extends BaseController { | ||||||
|  |  | ||||||
|     @ApiOperation("在线用户列表") |     /** | ||||||
|  |      * 获取在线用户监控列表 | ||||||
|  |      * | ||||||
|  |      * @param ipaddr   IP地址 | ||||||
|  |      * @param userName 用户名 | ||||||
|  |      */ | ||||||
|     @SaCheckPermission("monitor:online:list") |     @SaCheckPermission("monitor:online:list") | ||||||
|     @GetMapping("/list") |     @GetMapping("/list") | ||||||
|     public TableDataInfo<SysUserOnline> list(String ipaddr, String userName) { |     public TableDataInfo<SysUserOnline> list(String ipaddr, String userName) { | ||||||
| @@ -43,26 +46,27 @@ public class SysUserOnlineController extends BaseController { | |||||||
|         List<String> keys = StpUtil.searchTokenValue("", -1, 0); |         List<String> keys = StpUtil.searchTokenValue("", -1, 0); | ||||||
|         List<UserOnlineDTO> userOnlineDTOList = new ArrayList<>(); |         List<UserOnlineDTO> userOnlineDTOList = new ArrayList<>(); | ||||||
|         for (String key : keys) { |         for (String key : keys) { | ||||||
|             String token = key.replace(Constants.LOGIN_TOKEN_KEY, ""); |             String token = key.replace(CacheConstants.LOGIN_TOKEN_KEY, ""); | ||||||
|             // 如果已经过期则踢下线 |             // 如果已经过期则跳过 | ||||||
|             if (StpUtil.stpLogic.getTokenActivityTimeoutByToken(token) < 0) { |             if (StpUtil.stpLogic.getTokenActivityTimeoutByToken(token) < 0) { | ||||||
|                 continue; |                 continue; | ||||||
|             } |             } | ||||||
|             userOnlineDTOList.add(RedisUtils.getCacheObject(Constants.ONLINE_TOKEN_KEY + token)); |             UserOnlineDTO dto = CacheUtils.get(CacheNames.ONLINE_TOKEN, token); | ||||||
|  |             userOnlineDTOList.add(dto); | ||||||
|         } |         } | ||||||
|         if (StringUtils.isNotEmpty(ipaddr) && StringUtils.isNotEmpty(userName)) { |         if (StringUtils.isNotEmpty(ipaddr) && StringUtils.isNotEmpty(userName)) { | ||||||
|             userOnlineDTOList = userOnlineDTOList.stream().filter(userOnline -> |             userOnlineDTOList = StreamUtils.filter(userOnlineDTOList, userOnline -> | ||||||
|                 StringUtils.equals(ipaddr, userOnline.getIpaddr()) && |                 StringUtils.equals(ipaddr, userOnline.getIpaddr()) && | ||||||
|                     StringUtils.equals(userName, userOnline.getUserName()) |                     StringUtils.equals(userName, userOnline.getUserName()) | ||||||
|             ).collect(Collectors.toList()); |             ); | ||||||
|         } else if (StringUtils.isNotEmpty(ipaddr)) { |         } else if (StringUtils.isNotEmpty(ipaddr)) { | ||||||
|             userOnlineDTOList = userOnlineDTOList.stream().filter(userOnline -> |             userOnlineDTOList = StreamUtils.filter(userOnlineDTOList, userOnline -> | ||||||
|                     StringUtils.equals(ipaddr, userOnline.getIpaddr())) |                 StringUtils.equals(ipaddr, userOnline.getIpaddr()) | ||||||
|                 .collect(Collectors.toList()); |             ); | ||||||
|         } else if (StringUtils.isNotEmpty(userName)) { |         } else if (StringUtils.isNotEmpty(userName)) { | ||||||
|             userOnlineDTOList = userOnlineDTOList.stream().filter(userOnline -> |             userOnlineDTOList = StreamUtils.filter(userOnlineDTOList, userOnline -> | ||||||
|                 StringUtils.equals(userName, userOnline.getUserName()) |                 StringUtils.equals(userName, userOnline.getUserName()) | ||||||
|             ).collect(Collectors.toList()); |             ); | ||||||
|         } |         } | ||||||
|         Collections.reverse(userOnlineDTOList); |         Collections.reverse(userOnlineDTOList); | ||||||
|         userOnlineDTOList.removeAll(Collections.singleton(null)); |         userOnlineDTOList.removeAll(Collections.singleton(null)); | ||||||
| @@ -72,8 +76,9 @@ public class SysUserOnlineController extends BaseController { | |||||||
|  |  | ||||||
|     /** |     /** | ||||||
|      * 强退用户 |      * 强退用户 | ||||||
|  |      * | ||||||
|  |      * @param tokenId token值 | ||||||
|      */ |      */ | ||||||
|     @ApiOperation("强退用户") |  | ||||||
|     @SaCheckPermission("monitor:online:forceLogout") |     @SaCheckPermission("monitor:online:forceLogout") | ||||||
|     @Log(title = "在线用户", businessType = BusinessType.FORCE) |     @Log(title = "在线用户", businessType = BusinessType.FORCE) | ||||||
|     @DeleteMapping("/{tokenId}") |     @DeleteMapping("/{tokenId}") | ||||||
|   | |||||||
| @@ -4,16 +4,13 @@ import cn.dev33.satoken.annotation.SaCheckPermission; | |||||||
| import com.ruoyi.common.annotation.Log; | import com.ruoyi.common.annotation.Log; | ||||||
| import com.ruoyi.common.constant.UserConstants; | import com.ruoyi.common.constant.UserConstants; | ||||||
| import com.ruoyi.common.core.controller.BaseController; | import com.ruoyi.common.core.controller.BaseController; | ||||||
| import com.ruoyi.common.core.domain.R; |  | ||||||
| import com.ruoyi.common.core.domain.PageQuery; | import com.ruoyi.common.core.domain.PageQuery; | ||||||
|  | import com.ruoyi.common.core.domain.R; | ||||||
| import com.ruoyi.common.core.page.TableDataInfo; | import com.ruoyi.common.core.page.TableDataInfo; | ||||||
| import com.ruoyi.common.enums.BusinessType; | import com.ruoyi.common.enums.BusinessType; | ||||||
| import com.ruoyi.common.utils.poi.ExcelUtil; | import com.ruoyi.common.utils.poi.ExcelUtil; | ||||||
| import com.ruoyi.system.domain.SysConfig; | import com.ruoyi.system.domain.SysConfig; | ||||||
| import com.ruoyi.system.service.ISysConfigService; | import com.ruoyi.system.service.ISysConfigService; | ||||||
| import io.swagger.annotations.Api; |  | ||||||
| import io.swagger.annotations.ApiOperation; |  | ||||||
| import io.swagger.annotations.ApiParam; |  | ||||||
| import lombok.RequiredArgsConstructor; | import lombok.RequiredArgsConstructor; | ||||||
| import org.springframework.validation.annotation.Validated; | import org.springframework.validation.annotation.Validated; | ||||||
| import org.springframework.web.bind.annotation.*; | import org.springframework.web.bind.annotation.*; | ||||||
| @@ -27,7 +24,6 @@ import java.util.List; | |||||||
|  * @author Lion Li |  * @author Lion Li | ||||||
|  */ |  */ | ||||||
| @Validated | @Validated | ||||||
| @Api(value = "参数配置控制器", tags = {"参数配置管理"}) |  | ||||||
| @RequiredArgsConstructor | @RequiredArgsConstructor | ||||||
| @RestController | @RestController | ||||||
| @RequestMapping("/system/config") | @RequestMapping("/system/config") | ||||||
| @@ -38,14 +34,15 @@ public class SysConfigController extends BaseController { | |||||||
|     /** |     /** | ||||||
|      * 获取参数配置列表 |      * 获取参数配置列表 | ||||||
|      */ |      */ | ||||||
|     @ApiOperation("获取参数配置列表") |  | ||||||
|     @SaCheckPermission("system:config:list") |     @SaCheckPermission("system:config:list") | ||||||
|     @GetMapping("/list") |     @GetMapping("/list") | ||||||
|     public TableDataInfo<SysConfig> list(SysConfig config, PageQuery pageQuery) { |     public TableDataInfo<SysConfig> list(SysConfig config, PageQuery pageQuery) { | ||||||
|         return configService.selectPageConfigList(config, pageQuery); |         return configService.selectPageConfigList(config, pageQuery); | ||||||
|     } |     } | ||||||
|  |  | ||||||
|     @ApiOperation("导出参数配置列表") |     /** | ||||||
|  |      * 导出参数配置列表 | ||||||
|  |      */ | ||||||
|     @Log(title = "参数管理", businessType = BusinessType.EXPORT) |     @Log(title = "参数管理", businessType = BusinessType.EXPORT) | ||||||
|     @SaCheckPermission("system:config:export") |     @SaCheckPermission("system:config:export") | ||||||
|     @PostMapping("/export") |     @PostMapping("/export") | ||||||
| @@ -56,27 +53,28 @@ public class SysConfigController extends BaseController { | |||||||
|  |  | ||||||
|     /** |     /** | ||||||
|      * 根据参数编号获取详细信息 |      * 根据参数编号获取详细信息 | ||||||
|  |      * | ||||||
|  |      * @param configId 参数ID | ||||||
|      */ |      */ | ||||||
|     @ApiOperation("根据参数编号获取详细信息") |  | ||||||
|     @SaCheckPermission("system:config:query") |     @SaCheckPermission("system:config:query") | ||||||
|     @GetMapping(value = "/{configId}") |     @GetMapping(value = "/{configId}") | ||||||
|     public R<SysConfig> getInfo(@ApiParam("参数ID") @PathVariable Long configId) { |     public R<SysConfig> getInfo(@PathVariable Long configId) { | ||||||
|         return R.ok(configService.selectConfigById(configId)); |         return R.ok(configService.selectConfigById(configId)); | ||||||
|     } |     } | ||||||
|  |  | ||||||
|     /** |     /** | ||||||
|      * 根据参数键名查询参数值 |      * 根据参数键名查询参数值 | ||||||
|  |      * | ||||||
|  |      * @param configKey 参数Key | ||||||
|      */ |      */ | ||||||
|     @ApiOperation("根据参数键名查询参数值") |  | ||||||
|     @GetMapping(value = "/configKey/{configKey}") |     @GetMapping(value = "/configKey/{configKey}") | ||||||
|     public R<Void> getConfigKey(@ApiParam("参数Key") @PathVariable String configKey) { |     public R<Void> getConfigKey(@PathVariable String configKey) { | ||||||
|         return R.ok(configService.selectConfigByKey(configKey)); |         return R.ok(configService.selectConfigByKey(configKey)); | ||||||
|     } |     } | ||||||
|  |  | ||||||
|     /** |     /** | ||||||
|      * 新增参数配置 |      * 新增参数配置 | ||||||
|      */ |      */ | ||||||
|     @ApiOperation("新增参数配置") |  | ||||||
|     @SaCheckPermission("system:config:add") |     @SaCheckPermission("system:config:add") | ||||||
|     @Log(title = "参数管理", businessType = BusinessType.INSERT) |     @Log(title = "参数管理", businessType = BusinessType.INSERT) | ||||||
|     @PostMapping |     @PostMapping | ||||||
| @@ -84,13 +82,13 @@ public class SysConfigController extends BaseController { | |||||||
|         if (UserConstants.NOT_UNIQUE.equals(configService.checkConfigKeyUnique(config))) { |         if (UserConstants.NOT_UNIQUE.equals(configService.checkConfigKeyUnique(config))) { | ||||||
|             return R.fail("新增参数'" + config.getConfigName() + "'失败,参数键名已存在"); |             return R.fail("新增参数'" + config.getConfigName() + "'失败,参数键名已存在"); | ||||||
|         } |         } | ||||||
|         return toAjax(configService.insertConfig(config)); |         configService.insertConfig(config); | ||||||
|  |         return R.ok(); | ||||||
|     } |     } | ||||||
|  |  | ||||||
|     /** |     /** | ||||||
|      * 修改参数配置 |      * 修改参数配置 | ||||||
|      */ |      */ | ||||||
|     @ApiOperation("修改参数配置") |  | ||||||
|     @SaCheckPermission("system:config:edit") |     @SaCheckPermission("system:config:edit") | ||||||
|     @Log(title = "参数管理", businessType = BusinessType.UPDATE) |     @Log(title = "参数管理", businessType = BusinessType.UPDATE) | ||||||
|     @PutMapping |     @PutMapping | ||||||
| @@ -98,28 +96,30 @@ public class SysConfigController extends BaseController { | |||||||
|         if (UserConstants.NOT_UNIQUE.equals(configService.checkConfigKeyUnique(config))) { |         if (UserConstants.NOT_UNIQUE.equals(configService.checkConfigKeyUnique(config))) { | ||||||
|             return R.fail("修改参数'" + config.getConfigName() + "'失败,参数键名已存在"); |             return R.fail("修改参数'" + config.getConfigName() + "'失败,参数键名已存在"); | ||||||
|         } |         } | ||||||
|         return toAjax(configService.updateConfig(config)); |         configService.updateConfig(config); | ||||||
|  |         return R.ok(); | ||||||
|     } |     } | ||||||
|  |  | ||||||
|     /** |     /** | ||||||
|      * 根据参数键名修改参数配置 |      * 根据参数键名修改参数配置 | ||||||
|      */ |      */ | ||||||
|     @ApiOperation("根据参数键名修改参数配置") |  | ||||||
|     @SaCheckPermission("system:config:edit") |     @SaCheckPermission("system:config:edit") | ||||||
|     @Log(title = "参数管理", businessType = BusinessType.UPDATE) |     @Log(title = "参数管理", businessType = BusinessType.UPDATE) | ||||||
|     @PutMapping("/updateByKey") |     @PutMapping("/updateByKey") | ||||||
|     public R<Void> updateByKey(@RequestBody SysConfig config) { |     public R<Void> updateByKey(@RequestBody SysConfig config) { | ||||||
|         return toAjax(configService.updateConfig(config)); |         configService.updateConfig(config); | ||||||
|  |         return R.ok(); | ||||||
|     } |     } | ||||||
|  |  | ||||||
|     /** |     /** | ||||||
|      * 删除参数配置 |      * 删除参数配置 | ||||||
|  |      * | ||||||
|  |      * @param configIds 参数ID串 | ||||||
|      */ |      */ | ||||||
|     @ApiOperation("删除参数配置") |  | ||||||
|     @SaCheckPermission("system:config:remove") |     @SaCheckPermission("system:config:remove") | ||||||
|     @Log(title = "参数管理", businessType = BusinessType.DELETE) |     @Log(title = "参数管理", businessType = BusinessType.DELETE) | ||||||
|     @DeleteMapping("/{configIds}") |     @DeleteMapping("/{configIds}") | ||||||
|     public R<Void> remove(@ApiParam("参数ID串") @PathVariable Long[] configIds) { |     public R<Void> remove(@PathVariable Long[] configIds) { | ||||||
|         configService.deleteConfigByIds(configIds); |         configService.deleteConfigByIds(configIds); | ||||||
|         return R.ok(); |         return R.ok(); | ||||||
|     } |     } | ||||||
| @@ -127,7 +127,6 @@ public class SysConfigController extends BaseController { | |||||||
|     /** |     /** | ||||||
|      * 刷新参数缓存 |      * 刷新参数缓存 | ||||||
|      */ |      */ | ||||||
|     @ApiOperation("刷新参数缓存") |  | ||||||
|     @SaCheckPermission("system:config:remove") |     @SaCheckPermission("system:config:remove") | ||||||
|     @Log(title = "参数管理", businessType = BusinessType.CLEAN) |     @Log(title = "参数管理", businessType = BusinessType.CLEAN) | ||||||
|     @DeleteMapping("/refreshCache") |     @DeleteMapping("/refreshCache") | ||||||
|   | |||||||
| @@ -11,9 +11,6 @@ import com.ruoyi.common.core.domain.entity.SysDept; | |||||||
| import com.ruoyi.common.enums.BusinessType; | import com.ruoyi.common.enums.BusinessType; | ||||||
| import com.ruoyi.common.utils.StringUtils; | import com.ruoyi.common.utils.StringUtils; | ||||||
| import com.ruoyi.system.service.ISysDeptService; | import com.ruoyi.system.service.ISysDeptService; | ||||||
| import io.swagger.annotations.Api; |  | ||||||
| import io.swagger.annotations.ApiOperation; |  | ||||||
| import io.swagger.annotations.ApiParam; |  | ||||||
| import lombok.RequiredArgsConstructor; | import lombok.RequiredArgsConstructor; | ||||||
| import org.springframework.validation.annotation.Validated; | import org.springframework.validation.annotation.Validated; | ||||||
| import org.springframework.web.bind.annotation.*; | import org.springframework.web.bind.annotation.*; | ||||||
| @@ -28,7 +25,6 @@ import java.util.Map; | |||||||
|  * @author Lion Li |  * @author Lion Li | ||||||
|  */ |  */ | ||||||
| @Validated | @Validated | ||||||
| @Api(value = "部门控制器", tags = {"部门管理"}) |  | ||||||
| @RequiredArgsConstructor | @RequiredArgsConstructor | ||||||
| @RestController | @RestController | ||||||
| @RequestMapping("/system/dept") | @RequestMapping("/system/dept") | ||||||
| @@ -39,7 +35,6 @@ public class SysDeptController extends BaseController { | |||||||
|     /** |     /** | ||||||
|      * 获取部门列表 |      * 获取部门列表 | ||||||
|      */ |      */ | ||||||
|     @ApiOperation("获取部门列表") |  | ||||||
|     @SaCheckPermission("system:dept:list") |     @SaCheckPermission("system:dept:list") | ||||||
|     @GetMapping("/list") |     @GetMapping("/list") | ||||||
|     public R<List<SysDept>> list(SysDept dept) { |     public R<List<SysDept>> list(SysDept dept) { | ||||||
| @@ -49,11 +44,12 @@ public class SysDeptController extends BaseController { | |||||||
|  |  | ||||||
|     /** |     /** | ||||||
|      * 查询部门列表(排除节点) |      * 查询部门列表(排除节点) | ||||||
|  |      * | ||||||
|  |      * @param deptId 部门ID | ||||||
|      */ |      */ | ||||||
|     @ApiOperation("查询部门列表(排除节点)") |  | ||||||
|     @SaCheckPermission("system:dept:list") |     @SaCheckPermission("system:dept:list") | ||||||
|     @GetMapping("/list/exclude/{deptId}") |     @GetMapping("/list/exclude/{deptId}") | ||||||
|     public R<List<SysDept>> excludeChild(@ApiParam("部门ID") @PathVariable(value = "deptId", required = false) Long deptId) { |     public R<List<SysDept>> excludeChild(@PathVariable(value = "deptId", required = false) Long deptId) { | ||||||
|         List<SysDept> depts = deptService.selectDeptList(new SysDept()); |         List<SysDept> depts = deptService.selectDeptList(new SysDept()); | ||||||
|         depts.removeIf(d -> d.getDeptId().equals(deptId) |         depts.removeIf(d -> d.getDeptId().equals(deptId) | ||||||
|             || ArrayUtil.contains(StringUtils.split(d.getAncestors(), ","), deptId + "")); |             || ArrayUtil.contains(StringUtils.split(d.getAncestors(), ","), deptId + "")); | ||||||
| @@ -62,11 +58,12 @@ public class SysDeptController extends BaseController { | |||||||
|  |  | ||||||
|     /** |     /** | ||||||
|      * 根据部门编号获取详细信息 |      * 根据部门编号获取详细信息 | ||||||
|  |      * | ||||||
|  |      * @param deptId 部门ID | ||||||
|      */ |      */ | ||||||
|     @ApiOperation("根据部门编号获取详细信息") |  | ||||||
|     @SaCheckPermission("system:dept:query") |     @SaCheckPermission("system:dept:query") | ||||||
|     @GetMapping(value = "/{deptId}") |     @GetMapping(value = "/{deptId}") | ||||||
|     public R<SysDept> getInfo(@ApiParam("部门ID") @PathVariable Long deptId) { |     public R<SysDept> getInfo(@PathVariable Long deptId) { | ||||||
|         deptService.checkDeptDataScope(deptId); |         deptService.checkDeptDataScope(deptId); | ||||||
|         return R.ok(deptService.selectDeptById(deptId)); |         return R.ok(deptService.selectDeptById(deptId)); | ||||||
|     } |     } | ||||||
| @@ -74,7 +71,6 @@ public class SysDeptController extends BaseController { | |||||||
|     /** |     /** | ||||||
|      * 获取部门下拉树列表 |      * 获取部门下拉树列表 | ||||||
|      */ |      */ | ||||||
|     @ApiOperation("获取部门下拉树列表") |  | ||||||
|     @GetMapping("/treeselect") |     @GetMapping("/treeselect") | ||||||
|     public R<List<Tree<Long>>> treeselect(SysDept dept) { |     public R<List<Tree<Long>>> treeselect(SysDept dept) { | ||||||
|         List<SysDept> depts = deptService.selectDeptList(dept); |         List<SysDept> depts = deptService.selectDeptList(dept); | ||||||
| @@ -83,10 +79,11 @@ public class SysDeptController extends BaseController { | |||||||
|  |  | ||||||
|     /** |     /** | ||||||
|      * 加载对应角色部门列表树 |      * 加载对应角色部门列表树 | ||||||
|  |      * | ||||||
|  |      * @param roleId 角色ID | ||||||
|      */ |      */ | ||||||
|     @ApiOperation("加载对应角色部门列表树") |  | ||||||
|     @GetMapping(value = "/roleDeptTreeselect/{roleId}") |     @GetMapping(value = "/roleDeptTreeselect/{roleId}") | ||||||
|     public R<Map<String, Object>> roleDeptTreeselect(@ApiParam("角色ID") @PathVariable("roleId") Long roleId) { |     public R<Map<String, Object>> roleDeptTreeselect(@PathVariable("roleId") Long roleId) { | ||||||
|         List<SysDept> depts = deptService.selectDeptList(new SysDept()); |         List<SysDept> depts = deptService.selectDeptList(new SysDept()); | ||||||
|         Map<String, Object> ajax = new HashMap<>(); |         Map<String, Object> ajax = new HashMap<>(); | ||||||
|         ajax.put("checkedKeys", deptService.selectDeptListByRoleId(roleId)); |         ajax.put("checkedKeys", deptService.selectDeptListByRoleId(roleId)); | ||||||
| @@ -97,7 +94,6 @@ public class SysDeptController extends BaseController { | |||||||
|     /** |     /** | ||||||
|      * 新增部门 |      * 新增部门 | ||||||
|      */ |      */ | ||||||
|     @ApiOperation("新增部门") |  | ||||||
|     @SaCheckPermission("system:dept:add") |     @SaCheckPermission("system:dept:add") | ||||||
|     @Log(title = "部门管理", businessType = BusinessType.INSERT) |     @Log(title = "部门管理", businessType = BusinessType.INSERT) | ||||||
|     @PostMapping |     @PostMapping | ||||||
| @@ -111,7 +107,6 @@ public class SysDeptController extends BaseController { | |||||||
|     /** |     /** | ||||||
|      * 修改部门 |      * 修改部门 | ||||||
|      */ |      */ | ||||||
|     @ApiOperation("修改部门") |  | ||||||
|     @SaCheckPermission("system:dept:edit") |     @SaCheckPermission("system:dept:edit") | ||||||
|     @Log(title = "部门管理", businessType = BusinessType.UPDATE) |     @Log(title = "部门管理", businessType = BusinessType.UPDATE) | ||||||
|     @PutMapping |     @PutMapping | ||||||
| @@ -131,12 +126,13 @@ public class SysDeptController extends BaseController { | |||||||
|  |  | ||||||
|     /** |     /** | ||||||
|      * 删除部门 |      * 删除部门 | ||||||
|  |      * | ||||||
|  |      * @param deptId 部门ID | ||||||
|      */ |      */ | ||||||
|     @ApiOperation("删除部门") |  | ||||||
|     @SaCheckPermission("system:dept:remove") |     @SaCheckPermission("system:dept:remove") | ||||||
|     @Log(title = "部门管理", businessType = BusinessType.DELETE) |     @Log(title = "部门管理", businessType = BusinessType.DELETE) | ||||||
|     @DeleteMapping("/{deptId}") |     @DeleteMapping("/{deptId}") | ||||||
|     public R<Void> remove(@ApiParam("部门ID串") @PathVariable Long deptId) { |     public R<Void> remove(@PathVariable Long deptId) { | ||||||
|         if (deptService.hasChildByDeptId(deptId)) { |         if (deptService.hasChildByDeptId(deptId)) { | ||||||
|             return R.fail("存在下级部门,不允许删除"); |             return R.fail("存在下级部门,不允许删除"); | ||||||
|         } |         } | ||||||
|   | |||||||
| @@ -4,17 +4,14 @@ import cn.dev33.satoken.annotation.SaCheckPermission; | |||||||
| import cn.hutool.core.util.ObjectUtil; | import cn.hutool.core.util.ObjectUtil; | ||||||
| import com.ruoyi.common.annotation.Log; | import com.ruoyi.common.annotation.Log; | ||||||
| import com.ruoyi.common.core.controller.BaseController; | import com.ruoyi.common.core.controller.BaseController; | ||||||
| import com.ruoyi.common.core.domain.R; |  | ||||||
| import com.ruoyi.common.core.domain.PageQuery; | import com.ruoyi.common.core.domain.PageQuery; | ||||||
|  | import com.ruoyi.common.core.domain.R; | ||||||
| import com.ruoyi.common.core.domain.entity.SysDictData; | import com.ruoyi.common.core.domain.entity.SysDictData; | ||||||
| import com.ruoyi.common.core.page.TableDataInfo; | import com.ruoyi.common.core.page.TableDataInfo; | ||||||
| import com.ruoyi.common.enums.BusinessType; | import com.ruoyi.common.enums.BusinessType; | ||||||
| import com.ruoyi.common.utils.poi.ExcelUtil; | import com.ruoyi.common.utils.poi.ExcelUtil; | ||||||
| import com.ruoyi.system.service.ISysDictDataService; | import com.ruoyi.system.service.ISysDictDataService; | ||||||
| import com.ruoyi.system.service.ISysDictTypeService; | import com.ruoyi.system.service.ISysDictTypeService; | ||||||
| import io.swagger.annotations.Api; |  | ||||||
| import io.swagger.annotations.ApiOperation; |  | ||||||
| import io.swagger.annotations.ApiParam; |  | ||||||
| import lombok.RequiredArgsConstructor; | import lombok.RequiredArgsConstructor; | ||||||
| import org.springframework.validation.annotation.Validated; | import org.springframework.validation.annotation.Validated; | ||||||
| import org.springframework.web.bind.annotation.*; | import org.springframework.web.bind.annotation.*; | ||||||
| @@ -29,7 +26,6 @@ import java.util.List; | |||||||
|  * @author Lion Li |  * @author Lion Li | ||||||
|  */ |  */ | ||||||
| @Validated | @Validated | ||||||
| @Api(value = "数据字典信息控制器", tags = {"数据字典信息管理"}) |  | ||||||
| @RequiredArgsConstructor | @RequiredArgsConstructor | ||||||
| @RestController | @RestController | ||||||
| @RequestMapping("/system/dict/data") | @RequestMapping("/system/dict/data") | ||||||
| @@ -38,14 +34,18 @@ public class SysDictDataController extends BaseController { | |||||||
|     private final ISysDictDataService dictDataService; |     private final ISysDictDataService dictDataService; | ||||||
|     private final ISysDictTypeService dictTypeService; |     private final ISysDictTypeService dictTypeService; | ||||||
|  |  | ||||||
|     @ApiOperation("查询字典数据列表") |     /** | ||||||
|  |      * 查询字典数据列表 | ||||||
|  |      */ | ||||||
|     @SaCheckPermission("system:dict:list") |     @SaCheckPermission("system:dict:list") | ||||||
|     @GetMapping("/list") |     @GetMapping("/list") | ||||||
|     public TableDataInfo<SysDictData> list(SysDictData dictData, PageQuery pageQuery) { |     public TableDataInfo<SysDictData> list(SysDictData dictData, PageQuery pageQuery) { | ||||||
|         return dictDataService.selectPageDictDataList(dictData, pageQuery); |         return dictDataService.selectPageDictDataList(dictData, pageQuery); | ||||||
|     } |     } | ||||||
|  |  | ||||||
|     @ApiOperation("导出字典数据列表") |     /** | ||||||
|  |      * 导出字典数据列表 | ||||||
|  |      */ | ||||||
|     @Log(title = "字典数据", businessType = BusinessType.EXPORT) |     @Log(title = "字典数据", businessType = BusinessType.EXPORT) | ||||||
|     @SaCheckPermission("system:dict:export") |     @SaCheckPermission("system:dict:export") | ||||||
|     @PostMapping("/export") |     @PostMapping("/export") | ||||||
| @@ -56,20 +56,22 @@ public class SysDictDataController extends BaseController { | |||||||
|  |  | ||||||
|     /** |     /** | ||||||
|      * 查询字典数据详细 |      * 查询字典数据详细 | ||||||
|  |      * | ||||||
|  |      * @param dictCode 字典code | ||||||
|      */ |      */ | ||||||
|     @ApiOperation("查询字典数据详细") |  | ||||||
|     @SaCheckPermission("system:dict:query") |     @SaCheckPermission("system:dict:query") | ||||||
|     @GetMapping(value = "/{dictCode}") |     @GetMapping(value = "/{dictCode}") | ||||||
|     public R<SysDictData> getInfo(@ApiParam("字典code") @PathVariable Long dictCode) { |     public R<SysDictData> getInfo(@PathVariable Long dictCode) { | ||||||
|         return R.ok(dictDataService.selectDictDataById(dictCode)); |         return R.ok(dictDataService.selectDictDataById(dictCode)); | ||||||
|     } |     } | ||||||
|  |  | ||||||
|     /** |     /** | ||||||
|      * 根据字典类型查询字典数据信息 |      * 根据字典类型查询字典数据信息 | ||||||
|  |      * | ||||||
|  |      * @param dictType 字典类型 | ||||||
|      */ |      */ | ||||||
|     @ApiOperation("根据字典类型查询字典数据信息") |  | ||||||
|     @GetMapping(value = "/type/{dictType}") |     @GetMapping(value = "/type/{dictType}") | ||||||
|     public R<List<SysDictData>> dictType(@ApiParam("字典类型") @PathVariable String dictType) { |     public R<List<SysDictData>> dictType(@PathVariable String dictType) { | ||||||
|         List<SysDictData> data = dictTypeService.selectDictDataByType(dictType); |         List<SysDictData> data = dictTypeService.selectDictDataByType(dictType); | ||||||
|         if (ObjectUtil.isNull(data)) { |         if (ObjectUtil.isNull(data)) { | ||||||
|             data = new ArrayList<>(); |             data = new ArrayList<>(); | ||||||
| @@ -80,33 +82,34 @@ public class SysDictDataController extends BaseController { | |||||||
|     /** |     /** | ||||||
|      * 新增字典类型 |      * 新增字典类型 | ||||||
|      */ |      */ | ||||||
|     @ApiOperation("新增字典类型") |  | ||||||
|     @SaCheckPermission("system:dict:add") |     @SaCheckPermission("system:dict:add") | ||||||
|     @Log(title = "字典数据", businessType = BusinessType.INSERT) |     @Log(title = "字典数据", businessType = BusinessType.INSERT) | ||||||
|     @PostMapping |     @PostMapping | ||||||
|     public R<Void> add(@Validated @RequestBody SysDictData dict) { |     public R<Void> add(@Validated @RequestBody SysDictData dict) { | ||||||
|         return toAjax(dictDataService.insertDictData(dict)); |         dictDataService.insertDictData(dict); | ||||||
|  |         return R.ok(); | ||||||
|     } |     } | ||||||
|  |  | ||||||
|     /** |     /** | ||||||
|      * 修改保存字典类型 |      * 修改保存字典类型 | ||||||
|      */ |      */ | ||||||
|     @ApiOperation("修改保存字典类型") |  | ||||||
|     @SaCheckPermission("system:dict:edit") |     @SaCheckPermission("system:dict:edit") | ||||||
|     @Log(title = "字典数据", businessType = BusinessType.UPDATE) |     @Log(title = "字典数据", businessType = BusinessType.UPDATE) | ||||||
|     @PutMapping |     @PutMapping | ||||||
|     public R<Void> edit(@Validated @RequestBody SysDictData dict) { |     public R<Void> edit(@Validated @RequestBody SysDictData dict) { | ||||||
|         return toAjax(dictDataService.updateDictData(dict)); |         dictDataService.updateDictData(dict); | ||||||
|  |         return R.ok(); | ||||||
|     } |     } | ||||||
|  |  | ||||||
|     /** |     /** | ||||||
|      * 删除字典类型 |      * 删除字典类型 | ||||||
|  |      * | ||||||
|  |      * @param dictCodes 字典code串 | ||||||
|      */ |      */ | ||||||
|     @ApiOperation("删除字典类型") |  | ||||||
|     @SaCheckPermission("system:dict:remove") |     @SaCheckPermission("system:dict:remove") | ||||||
|     @Log(title = "字典类型", businessType = BusinessType.DELETE) |     @Log(title = "字典类型", businessType = BusinessType.DELETE) | ||||||
|     @DeleteMapping("/{dictCodes}") |     @DeleteMapping("/{dictCodes}") | ||||||
|     public R<Void> remove(@ApiParam("字典code串") @PathVariable Long[] dictCodes) { |     public R<Void> remove(@PathVariable Long[] dictCodes) { | ||||||
|         dictDataService.deleteDictDataByIds(dictCodes); |         dictDataService.deleteDictDataByIds(dictCodes); | ||||||
|         return R.ok(); |         return R.ok(); | ||||||
|     } |     } | ||||||
|   | |||||||
| @@ -4,16 +4,13 @@ import cn.dev33.satoken.annotation.SaCheckPermission; | |||||||
| import com.ruoyi.common.annotation.Log; | import com.ruoyi.common.annotation.Log; | ||||||
| import com.ruoyi.common.constant.UserConstants; | import com.ruoyi.common.constant.UserConstants; | ||||||
| import com.ruoyi.common.core.controller.BaseController; | import com.ruoyi.common.core.controller.BaseController; | ||||||
| import com.ruoyi.common.core.domain.R; |  | ||||||
| import com.ruoyi.common.core.domain.PageQuery; | import com.ruoyi.common.core.domain.PageQuery; | ||||||
|  | import com.ruoyi.common.core.domain.R; | ||||||
| import com.ruoyi.common.core.domain.entity.SysDictType; | import com.ruoyi.common.core.domain.entity.SysDictType; | ||||||
| import com.ruoyi.common.core.page.TableDataInfo; | import com.ruoyi.common.core.page.TableDataInfo; | ||||||
| import com.ruoyi.common.enums.BusinessType; | import com.ruoyi.common.enums.BusinessType; | ||||||
| import com.ruoyi.common.utils.poi.ExcelUtil; | import com.ruoyi.common.utils.poi.ExcelUtil; | ||||||
| import com.ruoyi.system.service.ISysDictTypeService; | import com.ruoyi.system.service.ISysDictTypeService; | ||||||
| import io.swagger.annotations.Api; |  | ||||||
| import io.swagger.annotations.ApiOperation; |  | ||||||
| import io.swagger.annotations.ApiParam; |  | ||||||
| import lombok.RequiredArgsConstructor; | import lombok.RequiredArgsConstructor; | ||||||
| import org.springframework.validation.annotation.Validated; | import org.springframework.validation.annotation.Validated; | ||||||
| import org.springframework.web.bind.annotation.*; | import org.springframework.web.bind.annotation.*; | ||||||
| @@ -27,7 +24,6 @@ import java.util.List; | |||||||
|  * @author Lion Li |  * @author Lion Li | ||||||
|  */ |  */ | ||||||
| @Validated | @Validated | ||||||
| @Api(value = "数据字典信息控制器", tags = {"数据字典信息管理"}) |  | ||||||
| @RequiredArgsConstructor | @RequiredArgsConstructor | ||||||
| @RestController | @RestController | ||||||
| @RequestMapping("/system/dict/type") | @RequestMapping("/system/dict/type") | ||||||
| @@ -35,14 +31,18 @@ public class SysDictTypeController extends BaseController { | |||||||
|  |  | ||||||
|     private final ISysDictTypeService dictTypeService; |     private final ISysDictTypeService dictTypeService; | ||||||
|  |  | ||||||
|     @ApiOperation("查询字典类型列表") |     /** | ||||||
|  |      * 查询字典类型列表 | ||||||
|  |      */ | ||||||
|     @SaCheckPermission("system:dict:list") |     @SaCheckPermission("system:dict:list") | ||||||
|     @GetMapping("/list") |     @GetMapping("/list") | ||||||
|     public TableDataInfo<SysDictType> list(SysDictType dictType, PageQuery pageQuery) { |     public TableDataInfo<SysDictType> list(SysDictType dictType, PageQuery pageQuery) { | ||||||
|         return dictTypeService.selectPageDictTypeList(dictType, pageQuery); |         return dictTypeService.selectPageDictTypeList(dictType, pageQuery); | ||||||
|     } |     } | ||||||
|  |  | ||||||
|     @ApiOperation("导出字典类型列表") |     /** | ||||||
|  |      * 导出字典类型列表 | ||||||
|  |      */ | ||||||
|     @Log(title = "字典类型", businessType = BusinessType.EXPORT) |     @Log(title = "字典类型", businessType = BusinessType.EXPORT) | ||||||
|     @SaCheckPermission("system:dict:export") |     @SaCheckPermission("system:dict:export") | ||||||
|     @PostMapping("/export") |     @PostMapping("/export") | ||||||
| @@ -53,18 +53,18 @@ public class SysDictTypeController extends BaseController { | |||||||
|  |  | ||||||
|     /** |     /** | ||||||
|      * 查询字典类型详细 |      * 查询字典类型详细 | ||||||
|  |      * | ||||||
|  |      * @param dictId 字典ID | ||||||
|      */ |      */ | ||||||
|     @ApiOperation("查询字典类型详细") |  | ||||||
|     @SaCheckPermission("system:dict:query") |     @SaCheckPermission("system:dict:query") | ||||||
|     @GetMapping(value = "/{dictId}") |     @GetMapping(value = "/{dictId}") | ||||||
|     public R<SysDictType> getInfo(@ApiParam("字典ID") @PathVariable Long dictId) { |     public R<SysDictType> getInfo(@PathVariable Long dictId) { | ||||||
|         return R.ok(dictTypeService.selectDictTypeById(dictId)); |         return R.ok(dictTypeService.selectDictTypeById(dictId)); | ||||||
|     } |     } | ||||||
|  |  | ||||||
|     /** |     /** | ||||||
|      * 新增字典类型 |      * 新增字典类型 | ||||||
|      */ |      */ | ||||||
|     @ApiOperation("新增字典类型") |  | ||||||
|     @SaCheckPermission("system:dict:add") |     @SaCheckPermission("system:dict:add") | ||||||
|     @Log(title = "字典类型", businessType = BusinessType.INSERT) |     @Log(title = "字典类型", businessType = BusinessType.INSERT) | ||||||
|     @PostMapping |     @PostMapping | ||||||
| @@ -72,13 +72,13 @@ public class SysDictTypeController extends BaseController { | |||||||
|         if (UserConstants.NOT_UNIQUE.equals(dictTypeService.checkDictTypeUnique(dict))) { |         if (UserConstants.NOT_UNIQUE.equals(dictTypeService.checkDictTypeUnique(dict))) { | ||||||
|             return R.fail("新增字典'" + dict.getDictName() + "'失败,字典类型已存在"); |             return R.fail("新增字典'" + dict.getDictName() + "'失败,字典类型已存在"); | ||||||
|         } |         } | ||||||
|         return toAjax(dictTypeService.insertDictType(dict)); |         dictTypeService.insertDictType(dict); | ||||||
|  |         return R.ok(); | ||||||
|     } |     } | ||||||
|  |  | ||||||
|     /** |     /** | ||||||
|      * 修改字典类型 |      * 修改字典类型 | ||||||
|      */ |      */ | ||||||
|     @ApiOperation("修改字典类型") |  | ||||||
|     @SaCheckPermission("system:dict:edit") |     @SaCheckPermission("system:dict:edit") | ||||||
|     @Log(title = "字典类型", businessType = BusinessType.UPDATE) |     @Log(title = "字典类型", businessType = BusinessType.UPDATE) | ||||||
|     @PutMapping |     @PutMapping | ||||||
| @@ -86,17 +86,19 @@ public class SysDictTypeController extends BaseController { | |||||||
|         if (UserConstants.NOT_UNIQUE.equals(dictTypeService.checkDictTypeUnique(dict))) { |         if (UserConstants.NOT_UNIQUE.equals(dictTypeService.checkDictTypeUnique(dict))) { | ||||||
|             return R.fail("修改字典'" + dict.getDictName() + "'失败,字典类型已存在"); |             return R.fail("修改字典'" + dict.getDictName() + "'失败,字典类型已存在"); | ||||||
|         } |         } | ||||||
|         return toAjax(dictTypeService.updateDictType(dict)); |         dictTypeService.updateDictType(dict); | ||||||
|  |         return R.ok(); | ||||||
|     } |     } | ||||||
|  |  | ||||||
|     /** |     /** | ||||||
|      * 删除字典类型 |      * 删除字典类型 | ||||||
|  |      * | ||||||
|  |      * @param dictIds 字典ID串 | ||||||
|      */ |      */ | ||||||
|     @ApiOperation("删除字典类型") |  | ||||||
|     @SaCheckPermission("system:dict:remove") |     @SaCheckPermission("system:dict:remove") | ||||||
|     @Log(title = "字典类型", businessType = BusinessType.DELETE) |     @Log(title = "字典类型", businessType = BusinessType.DELETE) | ||||||
|     @DeleteMapping("/{dictIds}") |     @DeleteMapping("/{dictIds}") | ||||||
|     public R<Void> remove(@ApiParam("字典ID串") @PathVariable Long[] dictIds) { |     public R<Void> remove(@PathVariable Long[] dictIds) { | ||||||
|         dictTypeService.deleteDictTypeByIds(dictIds); |         dictTypeService.deleteDictTypeByIds(dictIds); | ||||||
|         return R.ok(); |         return R.ok(); | ||||||
|     } |     } | ||||||
| @@ -104,7 +106,6 @@ public class SysDictTypeController extends BaseController { | |||||||
|     /** |     /** | ||||||
|      * 刷新字典缓存 |      * 刷新字典缓存 | ||||||
|      */ |      */ | ||||||
|     @ApiOperation("刷新字典缓存") |  | ||||||
|     @SaCheckPermission("system:dict:remove") |     @SaCheckPermission("system:dict:remove") | ||||||
|     @Log(title = "字典类型", businessType = BusinessType.CLEAN) |     @Log(title = "字典类型", businessType = BusinessType.CLEAN) | ||||||
|     @DeleteMapping("/refreshCache") |     @DeleteMapping("/refreshCache") | ||||||
| @@ -116,7 +117,6 @@ public class SysDictTypeController extends BaseController { | |||||||
|     /** |     /** | ||||||
|      * 获取字典选择框列表 |      * 获取字典选择框列表 | ||||||
|      */ |      */ | ||||||
|     @ApiOperation("获取字典选择框列表") |  | ||||||
|     @GetMapping("/optionselect") |     @GetMapping("/optionselect") | ||||||
|     public R<List<SysDictType>> optionselect() { |     public R<List<SysDictType>> optionselect() { | ||||||
|         List<SysDictType> dictTypes = dictTypeService.selectDictTypeAll(); |         List<SysDictType> dictTypes = dictTypeService.selectDictTypeAll(); | ||||||
|   | |||||||
| @@ -1,9 +1,8 @@ | |||||||
| package com.ruoyi.web.controller.system; | package com.ruoyi.web.controller.system; | ||||||
|  |  | ||||||
|  | import com.ruoyi.common.annotation.Anonymous; | ||||||
| import com.ruoyi.common.config.RuoYiConfig; | import com.ruoyi.common.config.RuoYiConfig; | ||||||
| import com.ruoyi.common.utils.StringUtils; | import com.ruoyi.common.utils.StringUtils; | ||||||
| import io.swagger.annotations.Api; |  | ||||||
| import io.swagger.annotations.ApiOperation; |  | ||||||
| import lombok.RequiredArgsConstructor; | import lombok.RequiredArgsConstructor; | ||||||
| import org.springframework.web.bind.annotation.GetMapping; | import org.springframework.web.bind.annotation.GetMapping; | ||||||
| import org.springframework.web.bind.annotation.RestController; | import org.springframework.web.bind.annotation.RestController; | ||||||
| @@ -13,7 +12,6 @@ import org.springframework.web.bind.annotation.RestController; | |||||||
|  * |  * | ||||||
|  * @author Lion Li |  * @author Lion Li | ||||||
|  */ |  */ | ||||||
| @Api(value = "首页控制器", tags = {"首页管理"}) |  | ||||||
| @RequiredArgsConstructor | @RequiredArgsConstructor | ||||||
| @RestController | @RestController | ||||||
| public class SysIndexController { | public class SysIndexController { | ||||||
| @@ -26,7 +24,7 @@ public class SysIndexController { | |||||||
|     /** |     /** | ||||||
|      * 访问首页,提示语 |      * 访问首页,提示语 | ||||||
|      */ |      */ | ||||||
|     @ApiOperation("访问首页,提示语") |     @Anonymous | ||||||
|     @GetMapping("/") |     @GetMapping("/") | ||||||
|     public String index() { |     public String index() { | ||||||
|         return StringUtils.format("欢迎使用{}后台管理框架,当前版本:v{},请通过前端地址访问。", ruoyiConfig.getName(), ruoyiConfig.getVersion()); |         return StringUtils.format("欢迎使用{}后台管理框架,当前版本:v{},请通过前端地址访问。", ruoyiConfig.getName(), ruoyiConfig.getVersion()); | ||||||
|   | |||||||
| @@ -1,7 +1,5 @@ | |||||||
| package com.ruoyi.web.controller.system; | package com.ruoyi.web.controller.system; | ||||||
|  |  | ||||||
| import cn.dev33.satoken.exception.NotLoginException; |  | ||||||
| import cn.dev33.satoken.stp.StpUtil; |  | ||||||
| import com.ruoyi.common.annotation.Anonymous; | import com.ruoyi.common.annotation.Anonymous; | ||||||
| import com.ruoyi.common.constant.Constants; | import com.ruoyi.common.constant.Constants; | ||||||
| import com.ruoyi.common.core.domain.R; | import com.ruoyi.common.core.domain.R; | ||||||
| @@ -15,8 +13,6 @@ import com.ruoyi.system.service.ISysMenuService; | |||||||
| import com.ruoyi.system.service.ISysUserService; | import com.ruoyi.system.service.ISysUserService; | ||||||
| import com.ruoyi.system.service.SysLoginService; | import com.ruoyi.system.service.SysLoginService; | ||||||
| import com.ruoyi.system.service.SysPermissionService; | import com.ruoyi.system.service.SysPermissionService; | ||||||
| import io.swagger.annotations.Api; |  | ||||||
| import io.swagger.annotations.ApiOperation; |  | ||||||
| import lombok.RequiredArgsConstructor; | import lombok.RequiredArgsConstructor; | ||||||
| import org.springframework.validation.annotation.Validated; | import org.springframework.validation.annotation.Validated; | ||||||
| import org.springframework.web.bind.annotation.GetMapping; | import org.springframework.web.bind.annotation.GetMapping; | ||||||
| @@ -36,7 +32,6 @@ import java.util.Set; | |||||||
|  * @author Lion Li |  * @author Lion Li | ||||||
|  */ |  */ | ||||||
| @Validated | @Validated | ||||||
| @Api(value = "登录验证控制器", tags = {"登录验证管理"}) |  | ||||||
| @RequiredArgsConstructor | @RequiredArgsConstructor | ||||||
| @RestController | @RestController | ||||||
| public class SysLoginController { | public class SysLoginController { | ||||||
| @@ -53,7 +48,6 @@ public class SysLoginController { | |||||||
|      * @return 结果 |      * @return 结果 | ||||||
|      */ |      */ | ||||||
|     @Anonymous |     @Anonymous | ||||||
|     @ApiOperation("登录方法") |  | ||||||
|     @PostMapping("/login") |     @PostMapping("/login") | ||||||
|     public R<Map<String, Object>> login(@Validated @RequestBody LoginBody loginBody) { |     public R<Map<String, Object>> login(@Validated @RequestBody LoginBody loginBody) { | ||||||
|         Map<String, Object> ajax = new HashMap<>(); |         Map<String, Object> ajax = new HashMap<>(); | ||||||
| @@ -71,7 +65,6 @@ public class SysLoginController { | |||||||
|      * @return 结果 |      * @return 结果 | ||||||
|      */ |      */ | ||||||
|     @Anonymous |     @Anonymous | ||||||
|     @ApiOperation("短信登录(示例)") |  | ||||||
|     @PostMapping("/smsLogin") |     @PostMapping("/smsLogin") | ||||||
|     public R<Map<String, Object>> smsLogin(@Validated @RequestBody SmsLoginBody smsLoginBody) { |     public R<Map<String, Object>> smsLogin(@Validated @RequestBody SmsLoginBody smsLoginBody) { | ||||||
|         Map<String, Object> ajax = new HashMap<>(); |         Map<String, Object> ajax = new HashMap<>(); | ||||||
| @@ -88,7 +81,6 @@ public class SysLoginController { | |||||||
|      * @return 结果 |      * @return 结果 | ||||||
|      */ |      */ | ||||||
|     @Anonymous |     @Anonymous | ||||||
|     @ApiOperation("小程序登录(示例)") |  | ||||||
|     @PostMapping("/xcxLogin") |     @PostMapping("/xcxLogin") | ||||||
|     public R<Map<String, Object>> xcxLogin(@NotBlank(message = "{xcx.code.not.blank}") String xcxCode) { |     public R<Map<String, Object>> xcxLogin(@NotBlank(message = "{xcx.code.not.blank}") String xcxCode) { | ||||||
|         Map<String, Object> ajax = new HashMap<>(); |         Map<String, Object> ajax = new HashMap<>(); | ||||||
| @@ -98,16 +90,13 @@ public class SysLoginController { | |||||||
|         return R.ok(ajax); |         return R.ok(ajax); | ||||||
|     } |     } | ||||||
|  |  | ||||||
|  |     /** | ||||||
|  |      * 退出登录 | ||||||
|  |      */ | ||||||
|     @Anonymous |     @Anonymous | ||||||
|     @ApiOperation("登出方法") |  | ||||||
|     @PostMapping("/logout") |     @PostMapping("/logout") | ||||||
|     public R<Void> logout() { |     public R<Void> logout() { | ||||||
|         try { |         loginService.logout(); | ||||||
|             String username = LoginHelper.getUsername(); |  | ||||||
|             StpUtil.logout(); |  | ||||||
|             loginService.logout(username); |  | ||||||
|         } catch (NotLoginException e) { |  | ||||||
|         } |  | ||||||
|         return R.ok("退出成功"); |         return R.ok("退出成功"); | ||||||
|     } |     } | ||||||
|  |  | ||||||
| @@ -116,7 +105,6 @@ public class SysLoginController { | |||||||
|      * |      * | ||||||
|      * @return 用户信息 |      * @return 用户信息 | ||||||
|      */ |      */ | ||||||
|     @ApiOperation("获取用户信息") |  | ||||||
|     @GetMapping("getInfo") |     @GetMapping("getInfo") | ||||||
|     public R<Map<String, Object>> getInfo() { |     public R<Map<String, Object>> getInfo() { | ||||||
|         SysUser user = userService.selectUserById(LoginHelper.getUserId()); |         SysUser user = userService.selectUserById(LoginHelper.getUserId()); | ||||||
| @@ -136,7 +124,6 @@ public class SysLoginController { | |||||||
|      * |      * | ||||||
|      * @return 路由信息 |      * @return 路由信息 | ||||||
|      */ |      */ | ||||||
|     @ApiOperation("获取路由信息") |  | ||||||
|     @GetMapping("getRouters") |     @GetMapping("getRouters") | ||||||
|     public R<List<RouterVo>> getRouters() { |     public R<List<RouterVo>> getRouters() { | ||||||
|         Long userId = LoginHelper.getUserId(); |         Long userId = LoginHelper.getUserId(); | ||||||
|   | |||||||
| @@ -10,9 +10,6 @@ import com.ruoyi.common.core.domain.entity.SysMenu; | |||||||
| import com.ruoyi.common.enums.BusinessType; | import com.ruoyi.common.enums.BusinessType; | ||||||
| import com.ruoyi.common.utils.StringUtils; | import com.ruoyi.common.utils.StringUtils; | ||||||
| import com.ruoyi.system.service.ISysMenuService; | import com.ruoyi.system.service.ISysMenuService; | ||||||
| import io.swagger.annotations.Api; |  | ||||||
| import io.swagger.annotations.ApiOperation; |  | ||||||
| import io.swagger.annotations.ApiParam; |  | ||||||
| import lombok.RequiredArgsConstructor; | import lombok.RequiredArgsConstructor; | ||||||
| import org.springframework.validation.annotation.Validated; | import org.springframework.validation.annotation.Validated; | ||||||
| import org.springframework.web.bind.annotation.*; | import org.springframework.web.bind.annotation.*; | ||||||
| @@ -27,7 +24,6 @@ import java.util.Map; | |||||||
|  * @author Lion Li |  * @author Lion Li | ||||||
|  */ |  */ | ||||||
| @Validated | @Validated | ||||||
| @Api(value = "菜单信息控制器", tags = {"菜单信息管理"}) |  | ||||||
| @RequiredArgsConstructor | @RequiredArgsConstructor | ||||||
| @RestController | @RestController | ||||||
| @RequestMapping("/system/menu") | @RequestMapping("/system/menu") | ||||||
| @@ -38,7 +34,6 @@ public class SysMenuController extends BaseController { | |||||||
|     /** |     /** | ||||||
|      * 获取菜单列表 |      * 获取菜单列表 | ||||||
|      */ |      */ | ||||||
|     @ApiOperation("获取菜单列表") |  | ||||||
|     @SaCheckPermission("system:menu:list") |     @SaCheckPermission("system:menu:list") | ||||||
|     @GetMapping("/list") |     @GetMapping("/list") | ||||||
|     public R<List<SysMenu>> list(SysMenu menu) { |     public R<List<SysMenu>> list(SysMenu menu) { | ||||||
| @@ -48,18 +43,18 @@ public class SysMenuController extends BaseController { | |||||||
|  |  | ||||||
|     /** |     /** | ||||||
|      * 根据菜单编号获取详细信息 |      * 根据菜单编号获取详细信息 | ||||||
|  |      * | ||||||
|  |      * @param menuId 菜单ID | ||||||
|      */ |      */ | ||||||
|     @ApiOperation("根据菜单编号获取详细信息") |  | ||||||
|     @SaCheckPermission("system:menu:query") |     @SaCheckPermission("system:menu:query") | ||||||
|     @GetMapping(value = "/{menuId}") |     @GetMapping(value = "/{menuId}") | ||||||
|     public R<SysMenu> getInfo(@ApiParam("菜单ID") @PathVariable Long menuId) { |     public R<SysMenu> getInfo(@PathVariable Long menuId) { | ||||||
|         return R.ok(menuService.selectMenuById(menuId)); |         return R.ok(menuService.selectMenuById(menuId)); | ||||||
|     } |     } | ||||||
|  |  | ||||||
|     /** |     /** | ||||||
|      * 获取菜单下拉树列表 |      * 获取菜单下拉树列表 | ||||||
|      */ |      */ | ||||||
|     @ApiOperation("获取菜单下拉树列表") |  | ||||||
|     @GetMapping("/treeselect") |     @GetMapping("/treeselect") | ||||||
|     public R<List<Tree<Long>>> treeselect(SysMenu menu) { |     public R<List<Tree<Long>>> treeselect(SysMenu menu) { | ||||||
|         List<SysMenu> menus = menuService.selectMenuList(menu, getUserId()); |         List<SysMenu> menus = menuService.selectMenuList(menu, getUserId()); | ||||||
| @@ -68,10 +63,11 @@ public class SysMenuController extends BaseController { | |||||||
|  |  | ||||||
|     /** |     /** | ||||||
|      * 加载对应角色菜单列表树 |      * 加载对应角色菜单列表树 | ||||||
|  |      * | ||||||
|  |      * @param roleId 角色ID | ||||||
|      */ |      */ | ||||||
|     @ApiOperation("加载对应角色菜单列表树") |  | ||||||
|     @GetMapping(value = "/roleMenuTreeselect/{roleId}") |     @GetMapping(value = "/roleMenuTreeselect/{roleId}") | ||||||
|     public R<Map<String, Object>> roleMenuTreeselect(@ApiParam("角色ID") @PathVariable("roleId") Long roleId) { |     public R<Map<String, Object>> roleMenuTreeselect(@PathVariable("roleId") Long roleId) { | ||||||
|         List<SysMenu> menus = menuService.selectMenuList(getUserId()); |         List<SysMenu> menus = menuService.selectMenuList(getUserId()); | ||||||
|         Map<String, Object> ajax = new HashMap<>(); |         Map<String, Object> ajax = new HashMap<>(); | ||||||
|         ajax.put("checkedKeys", menuService.selectMenuListByRoleId(roleId)); |         ajax.put("checkedKeys", menuService.selectMenuListByRoleId(roleId)); | ||||||
| @@ -82,7 +78,6 @@ public class SysMenuController extends BaseController { | |||||||
|     /** |     /** | ||||||
|      * 新增菜单 |      * 新增菜单 | ||||||
|      */ |      */ | ||||||
|     @ApiOperation("新增菜单") |  | ||||||
|     @SaCheckPermission("system:menu:add") |     @SaCheckPermission("system:menu:add") | ||||||
|     @Log(title = "菜单管理", businessType = BusinessType.INSERT) |     @Log(title = "菜单管理", businessType = BusinessType.INSERT) | ||||||
|     @PostMapping |     @PostMapping | ||||||
| @@ -98,7 +93,6 @@ public class SysMenuController extends BaseController { | |||||||
|     /** |     /** | ||||||
|      * 修改菜单 |      * 修改菜单 | ||||||
|      */ |      */ | ||||||
|     @ApiOperation("修改菜单") |  | ||||||
|     @SaCheckPermission("system:menu:edit") |     @SaCheckPermission("system:menu:edit") | ||||||
|     @Log(title = "菜单管理", businessType = BusinessType.UPDATE) |     @Log(title = "菜单管理", businessType = BusinessType.UPDATE) | ||||||
|     @PutMapping |     @PutMapping | ||||||
| @@ -115,12 +109,13 @@ public class SysMenuController extends BaseController { | |||||||
|  |  | ||||||
|     /** |     /** | ||||||
|      * 删除菜单 |      * 删除菜单 | ||||||
|  |      * | ||||||
|  |      * @param menuId 菜单ID | ||||||
|      */ |      */ | ||||||
|     @ApiOperation("删除菜单") |  | ||||||
|     @SaCheckPermission("system:menu:remove") |     @SaCheckPermission("system:menu:remove") | ||||||
|     @Log(title = "菜单管理", businessType = BusinessType.DELETE) |     @Log(title = "菜单管理", businessType = BusinessType.DELETE) | ||||||
|     @DeleteMapping("/{menuId}") |     @DeleteMapping("/{menuId}") | ||||||
|     public R<Void> remove(@ApiParam("菜单ID") @PathVariable("menuId") Long menuId) { |     public R<Void> remove(@PathVariable("menuId") Long menuId) { | ||||||
|         if (menuService.hasChildByMenuId(menuId)) { |         if (menuService.hasChildByMenuId(menuId)) { | ||||||
|             return R.fail("存在子菜单,不允许删除"); |             return R.fail("存在子菜单,不允许删除"); | ||||||
|         } |         } | ||||||
|   | |||||||
| @@ -3,15 +3,12 @@ package com.ruoyi.web.controller.system; | |||||||
| import cn.dev33.satoken.annotation.SaCheckPermission; | import cn.dev33.satoken.annotation.SaCheckPermission; | ||||||
| import com.ruoyi.common.annotation.Log; | import com.ruoyi.common.annotation.Log; | ||||||
| import com.ruoyi.common.core.controller.BaseController; | import com.ruoyi.common.core.controller.BaseController; | ||||||
| import com.ruoyi.common.core.domain.R; |  | ||||||
| import com.ruoyi.common.core.domain.PageQuery; | import com.ruoyi.common.core.domain.PageQuery; | ||||||
|  | import com.ruoyi.common.core.domain.R; | ||||||
| import com.ruoyi.common.core.page.TableDataInfo; | import com.ruoyi.common.core.page.TableDataInfo; | ||||||
| import com.ruoyi.common.enums.BusinessType; | import com.ruoyi.common.enums.BusinessType; | ||||||
| import com.ruoyi.system.domain.SysNotice; | import com.ruoyi.system.domain.SysNotice; | ||||||
| import com.ruoyi.system.service.ISysNoticeService; | import com.ruoyi.system.service.ISysNoticeService; | ||||||
| import io.swagger.annotations.Api; |  | ||||||
| import io.swagger.annotations.ApiOperation; |  | ||||||
| import io.swagger.annotations.ApiParam; |  | ||||||
| import lombok.RequiredArgsConstructor; | import lombok.RequiredArgsConstructor; | ||||||
| import org.springframework.validation.annotation.Validated; | import org.springframework.validation.annotation.Validated; | ||||||
| import org.springframework.web.bind.annotation.*; | import org.springframework.web.bind.annotation.*; | ||||||
| @@ -22,7 +19,6 @@ import org.springframework.web.bind.annotation.*; | |||||||
|  * @author Lion Li |  * @author Lion Li | ||||||
|  */ |  */ | ||||||
| @Validated | @Validated | ||||||
| @Api(value = "公告信息控制器", tags = {"公告信息管理"}) |  | ||||||
| @RequiredArgsConstructor | @RequiredArgsConstructor | ||||||
| @RestController | @RestController | ||||||
| @RequestMapping("/system/notice") | @RequestMapping("/system/notice") | ||||||
| @@ -33,7 +29,6 @@ public class SysNoticeController extends BaseController { | |||||||
|     /** |     /** | ||||||
|      * 获取通知公告列表 |      * 获取通知公告列表 | ||||||
|      */ |      */ | ||||||
|     @ApiOperation("获取通知公告列表") |  | ||||||
|     @SaCheckPermission("system:notice:list") |     @SaCheckPermission("system:notice:list") | ||||||
|     @GetMapping("/list") |     @GetMapping("/list") | ||||||
|     public TableDataInfo<SysNotice> list(SysNotice notice, PageQuery pageQuery) { |     public TableDataInfo<SysNotice> list(SysNotice notice, PageQuery pageQuery) { | ||||||
| @@ -42,18 +37,18 @@ public class SysNoticeController extends BaseController { | |||||||
|  |  | ||||||
|     /** |     /** | ||||||
|      * 根据通知公告编号获取详细信息 |      * 根据通知公告编号获取详细信息 | ||||||
|  |      * | ||||||
|  |      * @param noticeId 公告ID | ||||||
|      */ |      */ | ||||||
|     @ApiOperation("根据通知公告编号获取详细信息") |  | ||||||
|     @SaCheckPermission("system:notice:query") |     @SaCheckPermission("system:notice:query") | ||||||
|     @GetMapping(value = "/{noticeId}") |     @GetMapping(value = "/{noticeId}") | ||||||
|     public R<SysNotice> getInfo(@ApiParam("公告ID") @PathVariable Long noticeId) { |     public R<SysNotice> getInfo(@PathVariable Long noticeId) { | ||||||
|         return R.ok(noticeService.selectNoticeById(noticeId)); |         return R.ok(noticeService.selectNoticeById(noticeId)); | ||||||
|     } |     } | ||||||
|  |  | ||||||
|     /** |     /** | ||||||
|      * 新增通知公告 |      * 新增通知公告 | ||||||
|      */ |      */ | ||||||
|     @ApiOperation("新增通知公告") |  | ||||||
|     @SaCheckPermission("system:notice:add") |     @SaCheckPermission("system:notice:add") | ||||||
|     @Log(title = "通知公告", businessType = BusinessType.INSERT) |     @Log(title = "通知公告", businessType = BusinessType.INSERT) | ||||||
|     @PostMapping |     @PostMapping | ||||||
| @@ -64,7 +59,6 @@ public class SysNoticeController extends BaseController { | |||||||
|     /** |     /** | ||||||
|      * 修改通知公告 |      * 修改通知公告 | ||||||
|      */ |      */ | ||||||
|     @ApiOperation("修改通知公告") |  | ||||||
|     @SaCheckPermission("system:notice:edit") |     @SaCheckPermission("system:notice:edit") | ||||||
|     @Log(title = "通知公告", businessType = BusinessType.UPDATE) |     @Log(title = "通知公告", businessType = BusinessType.UPDATE) | ||||||
|     @PutMapping |     @PutMapping | ||||||
| @@ -74,12 +68,13 @@ public class SysNoticeController extends BaseController { | |||||||
|  |  | ||||||
|     /** |     /** | ||||||
|      * 删除通知公告 |      * 删除通知公告 | ||||||
|  |      * | ||||||
|  |      * @param noticeIds 公告ID串 | ||||||
|      */ |      */ | ||||||
|     @ApiOperation("删除通知公告") |  | ||||||
|     @SaCheckPermission("system:notice:remove") |     @SaCheckPermission("system:notice:remove") | ||||||
|     @Log(title = "通知公告", businessType = BusinessType.DELETE) |     @Log(title = "通知公告", businessType = BusinessType.DELETE) | ||||||
|     @DeleteMapping("/{noticeIds}") |     @DeleteMapping("/{noticeIds}") | ||||||
|     public R<Void> remove(@ApiParam("公告ID串") @PathVariable Long[] noticeIds) { |     public R<Void> remove(@PathVariable Long[] noticeIds) { | ||||||
|         return toAjax(noticeService.deleteNoticeByIds(noticeIds)); |         return toAjax(noticeService.deleteNoticeByIds(noticeIds)); | ||||||
|     } |     } | ||||||
| } | } | ||||||
|   | |||||||
| @@ -4,8 +4,8 @@ import cn.dev33.satoken.annotation.SaCheckPermission; | |||||||
| import com.ruoyi.common.annotation.Log; | import com.ruoyi.common.annotation.Log; | ||||||
| import com.ruoyi.common.annotation.RepeatSubmit; | import com.ruoyi.common.annotation.RepeatSubmit; | ||||||
| import com.ruoyi.common.core.controller.BaseController; | import com.ruoyi.common.core.controller.BaseController; | ||||||
| import com.ruoyi.common.core.domain.R; |  | ||||||
| import com.ruoyi.common.core.domain.PageQuery; | import com.ruoyi.common.core.domain.PageQuery; | ||||||
|  | import com.ruoyi.common.core.domain.R; | ||||||
| import com.ruoyi.common.core.page.TableDataInfo; | import com.ruoyi.common.core.page.TableDataInfo; | ||||||
| import com.ruoyi.common.core.validate.AddGroup; | import com.ruoyi.common.core.validate.AddGroup; | ||||||
| import com.ruoyi.common.core.validate.EditGroup; | import com.ruoyi.common.core.validate.EditGroup; | ||||||
| @@ -14,9 +14,6 @@ import com.ruoyi.common.enums.BusinessType; | |||||||
| import com.ruoyi.system.domain.bo.SysOssConfigBo; | import com.ruoyi.system.domain.bo.SysOssConfigBo; | ||||||
| import com.ruoyi.system.domain.vo.SysOssConfigVo; | import com.ruoyi.system.domain.vo.SysOssConfigVo; | ||||||
| import com.ruoyi.system.service.ISysOssConfigService; | import com.ruoyi.system.service.ISysOssConfigService; | ||||||
| import io.swagger.annotations.Api; |  | ||||||
| import io.swagger.annotations.ApiOperation; |  | ||||||
| import io.swagger.annotations.ApiParam; |  | ||||||
| import lombok.RequiredArgsConstructor; | import lombok.RequiredArgsConstructor; | ||||||
| import org.springframework.validation.annotation.Validated; | import org.springframework.validation.annotation.Validated; | ||||||
| import org.springframework.web.bind.annotation.*; | import org.springframework.web.bind.annotation.*; | ||||||
| @@ -26,14 +23,13 @@ import javax.validation.constraints.NotNull; | |||||||
| import java.util.Arrays; | import java.util.Arrays; | ||||||
|  |  | ||||||
| /** | /** | ||||||
|  * 对象存储配置Controller |  * 对象存储配置 | ||||||
|  * |  * | ||||||
|  * @author Lion Li |  * @author Lion Li | ||||||
|  * @author 孤舟烟雨 |  * @author 孤舟烟雨 | ||||||
|  * @date 2021-08-13 |  * @date 2021-08-13 | ||||||
|  */ |  */ | ||||||
| @Validated | @Validated | ||||||
| @Api(value = "对象存储配置控制器", tags = {"对象存储配置管理"}) |  | ||||||
| @RequiredArgsConstructor | @RequiredArgsConstructor | ||||||
| @RestController | @RestController | ||||||
| @RequestMapping("/system/oss/config") | @RequestMapping("/system/oss/config") | ||||||
| @@ -44,7 +40,6 @@ public class SysOssConfigController extends BaseController { | |||||||
|     /** |     /** | ||||||
|      * 查询对象存储配置列表 |      * 查询对象存储配置列表 | ||||||
|      */ |      */ | ||||||
|     @ApiOperation("查询对象存储配置列表") |  | ||||||
|     @SaCheckPermission("system:oss:list") |     @SaCheckPermission("system:oss:list") | ||||||
|     @GetMapping("/list") |     @GetMapping("/list") | ||||||
|     public TableDataInfo<SysOssConfigVo> list(@Validated(QueryGroup.class) SysOssConfigBo bo, PageQuery pageQuery) { |     public TableDataInfo<SysOssConfigVo> list(@Validated(QueryGroup.class) SysOssConfigBo bo, PageQuery pageQuery) { | ||||||
| @@ -53,20 +48,19 @@ public class SysOssConfigController extends BaseController { | |||||||
|  |  | ||||||
|     /** |     /** | ||||||
|      * 获取对象存储配置详细信息 |      * 获取对象存储配置详细信息 | ||||||
|  |      * | ||||||
|  |      * @param ossConfigId OSS配置ID | ||||||
|      */ |      */ | ||||||
|     @ApiOperation("获取对象存储配置详细信息") |  | ||||||
|     @SaCheckPermission("system:oss:query") |     @SaCheckPermission("system:oss:query") | ||||||
|     @GetMapping("/{ossConfigId}") |     @GetMapping("/{ossConfigId}") | ||||||
|     public R<SysOssConfigVo> getInfo(@ApiParam("OSS配置ID") |     public R<SysOssConfigVo> getInfo(@NotNull(message = "主键不能为空") | ||||||
|                                               @NotNull(message = "主键不能为空") |                                      @PathVariable Long ossConfigId) { | ||||||
|                                               @PathVariable("ossConfigId") Long ossConfigId) { |  | ||||||
|         return R.ok(iSysOssConfigService.queryById(ossConfigId)); |         return R.ok(iSysOssConfigService.queryById(ossConfigId)); | ||||||
|     } |     } | ||||||
|  |  | ||||||
|     /** |     /** | ||||||
|      * 新增对象存储配置 |      * 新增对象存储配置 | ||||||
|      */ |      */ | ||||||
|     @ApiOperation("新增对象存储配置") |  | ||||||
|     @SaCheckPermission("system:oss:add") |     @SaCheckPermission("system:oss:add") | ||||||
|     @Log(title = "对象存储配置", businessType = BusinessType.INSERT) |     @Log(title = "对象存储配置", businessType = BusinessType.INSERT) | ||||||
|     @RepeatSubmit() |     @RepeatSubmit() | ||||||
| @@ -78,7 +72,6 @@ public class SysOssConfigController extends BaseController { | |||||||
|     /** |     /** | ||||||
|      * 修改对象存储配置 |      * 修改对象存储配置 | ||||||
|      */ |      */ | ||||||
|     @ApiOperation("修改对象存储配置") |  | ||||||
|     @SaCheckPermission("system:oss:edit") |     @SaCheckPermission("system:oss:edit") | ||||||
|     @Log(title = "对象存储配置", businessType = BusinessType.UPDATE) |     @Log(title = "对象存储配置", businessType = BusinessType.UPDATE) | ||||||
|     @RepeatSubmit() |     @RepeatSubmit() | ||||||
| @@ -89,13 +82,13 @@ public class SysOssConfigController extends BaseController { | |||||||
|  |  | ||||||
|     /** |     /** | ||||||
|      * 删除对象存储配置 |      * 删除对象存储配置 | ||||||
|  |      * | ||||||
|  |      * @param ossConfigIds OSS配置ID串 | ||||||
|      */ |      */ | ||||||
|     @ApiOperation("删除对象存储配置") |  | ||||||
|     @SaCheckPermission("system:oss:remove") |     @SaCheckPermission("system:oss:remove") | ||||||
|     @Log(title = "对象存储配置", businessType = BusinessType.DELETE) |     @Log(title = "对象存储配置", businessType = BusinessType.DELETE) | ||||||
|     @DeleteMapping("/{ossConfigIds}") |     @DeleteMapping("/{ossConfigIds}") | ||||||
|     public R<Void> remove(@ApiParam("OSS配置ID串") |     public R<Void> remove(@NotEmpty(message = "主键不能为空") | ||||||
|                                    @NotEmpty(message = "主键不能为空") |  | ||||||
|                           @PathVariable Long[] ossConfigIds) { |                           @PathVariable Long[] ossConfigIds) { | ||||||
|         return toAjax(iSysOssConfigService.deleteWithValidByIds(Arrays.asList(ossConfigIds), true) ? 1 : 0); |         return toAjax(iSysOssConfigService.deleteWithValidByIds(Arrays.asList(ossConfigIds), true) ? 1 : 0); | ||||||
|     } |     } | ||||||
| @@ -103,7 +96,6 @@ public class SysOssConfigController extends BaseController { | |||||||
|     /** |     /** | ||||||
|      * 状态修改 |      * 状态修改 | ||||||
|      */ |      */ | ||||||
|     @ApiOperation("状态修改") |  | ||||||
|     @SaCheckPermission("system:oss:edit") |     @SaCheckPermission("system:oss:edit") | ||||||
|     @Log(title = "对象存储状态修改", businessType = BusinessType.UPDATE) |     @Log(title = "对象存储状态修改", businessType = BusinessType.UPDATE) | ||||||
|     @PutMapping("/changeStatus") |     @PutMapping("/changeStatus") | ||||||
|   | |||||||
| @@ -19,7 +19,6 @@ import com.ruoyi.system.domain.SysOss; | |||||||
| import com.ruoyi.system.domain.bo.SysOssBo; | import com.ruoyi.system.domain.bo.SysOssBo; | ||||||
| import com.ruoyi.system.domain.vo.SysOssVo; | import com.ruoyi.system.domain.vo.SysOssVo; | ||||||
| import com.ruoyi.system.service.ISysOssService; | import com.ruoyi.system.service.ISysOssService; | ||||||
| import io.swagger.annotations.*; |  | ||||||
| import lombok.RequiredArgsConstructor; | import lombok.RequiredArgsConstructor; | ||||||
| import org.springframework.http.MediaType; | import org.springframework.http.MediaType; | ||||||
| import org.springframework.validation.annotation.Validated; | import org.springframework.validation.annotation.Validated; | ||||||
| @@ -28,7 +27,6 @@ import org.springframework.web.multipart.MultipartFile; | |||||||
|  |  | ||||||
| import javax.servlet.http.HttpServletResponse; | import javax.servlet.http.HttpServletResponse; | ||||||
| import javax.validation.constraints.NotEmpty; | import javax.validation.constraints.NotEmpty; | ||||||
| import java.io.File; |  | ||||||
| import java.io.IOException; | import java.io.IOException; | ||||||
| import java.util.Arrays; | import java.util.Arrays; | ||||||
| import java.util.HashMap; | import java.util.HashMap; | ||||||
| @@ -41,7 +39,6 @@ import java.util.Map; | |||||||
|  * @author Lion Li |  * @author Lion Li | ||||||
|  */ |  */ | ||||||
| @Validated | @Validated | ||||||
| @Api(value = "对象存储控制器", tags = {"对象存储管理"}) |  | ||||||
| @RequiredArgsConstructor | @RequiredArgsConstructor | ||||||
| @RestController | @RestController | ||||||
| @RequestMapping("/system/oss") | @RequestMapping("/system/oss") | ||||||
| @@ -52,7 +49,6 @@ public class SysOssController extends BaseController { | |||||||
|     /** |     /** | ||||||
|      * 查询OSS对象存储列表 |      * 查询OSS对象存储列表 | ||||||
|      */ |      */ | ||||||
|     @ApiOperation("查询OSS对象存储列表") |  | ||||||
|     @SaCheckPermission("system:oss:list") |     @SaCheckPermission("system:oss:list") | ||||||
|     @GetMapping("/list") |     @GetMapping("/list") | ||||||
|     public TableDataInfo<SysOssVo> list(@Validated(QueryGroup.class) SysOssBo bo, PageQuery pageQuery) { |     public TableDataInfo<SysOssVo> list(@Validated(QueryGroup.class) SysOssBo bo, PageQuery pageQuery) { | ||||||
| @@ -61,12 +57,12 @@ public class SysOssController extends BaseController { | |||||||
|  |  | ||||||
|     /** |     /** | ||||||
|      * 查询OSS对象基于id串 |      * 查询OSS对象基于id串 | ||||||
|  |      * | ||||||
|  |      * @param ossIds OSS对象ID串 | ||||||
|      */ |      */ | ||||||
|     @ApiOperation("查询OSS对象基于ID") |  | ||||||
|     @SaCheckPermission("system:oss:list") |     @SaCheckPermission("system:oss:list") | ||||||
|     @GetMapping("/listByIds/{ossIds}") |     @GetMapping("/listByIds/{ossIds}") | ||||||
|     public R<List<SysOssVo>> listByIds(@ApiParam("OSS对象ID串") |     public R<List<SysOssVo>> listByIds(@NotEmpty(message = "主键不能为空") | ||||||
|                                      @NotEmpty(message = "主键不能为空") |  | ||||||
|                                        @PathVariable Long[] ossIds) { |                                        @PathVariable Long[] ossIds) { | ||||||
|         List<SysOssVo> list = iSysOssService.listByIds(Arrays.asList(ossIds)); |         List<SysOssVo> list = iSysOssService.listByIds(Arrays.asList(ossIds)); | ||||||
|         return R.ok(list); |         return R.ok(list); | ||||||
| @@ -74,14 +70,12 @@ public class SysOssController extends BaseController { | |||||||
|  |  | ||||||
|     /** |     /** | ||||||
|      * 上传OSS对象存储 |      * 上传OSS对象存储 | ||||||
|  |      * | ||||||
|  |      * @param file 文件 | ||||||
|      */ |      */ | ||||||
|     @ApiOperation("上传OSS对象存储") |  | ||||||
|     @ApiImplicitParams({ |  | ||||||
|         @ApiImplicitParam(name = "file", value = "文件", paramType = "query", dataTypeClass = File.class, required = true) |  | ||||||
|     }) |  | ||||||
|     @SaCheckPermission("system:oss:upload") |     @SaCheckPermission("system:oss:upload") | ||||||
|     @Log(title = "OSS对象存储", businessType = BusinessType.INSERT) |     @Log(title = "OSS对象存储", businessType = BusinessType.INSERT) | ||||||
|     @PostMapping("/upload") |     @PostMapping(value = "/upload", consumes = MediaType.MULTIPART_FORM_DATA_VALUE) | ||||||
|     public R<Map<String, String>> upload(@RequestPart("file") MultipartFile file) { |     public R<Map<String, String>> upload(@RequestPart("file") MultipartFile file) { | ||||||
|         if (ObjectUtil.isNull(file)) { |         if (ObjectUtil.isNull(file)) { | ||||||
|             throw new ServiceException("上传文件不能为空"); |             throw new ServiceException("上传文件不能为空"); | ||||||
| @@ -94,11 +88,15 @@ public class SysOssController extends BaseController { | |||||||
|         return R.ok(map); |         return R.ok(map); | ||||||
|     } |     } | ||||||
|  |  | ||||||
|     @ApiOperation("下载OSS对象存储") |     /** | ||||||
|  |      * 下载OSS对象 | ||||||
|  |      * | ||||||
|  |      * @param ossId OSS对象ID | ||||||
|  |      */ | ||||||
|     @SaCheckPermission("system:oss:download") |     @SaCheckPermission("system:oss:download") | ||||||
|     @GetMapping("/download/{ossId}") |     @GetMapping("/download/{ossId}") | ||||||
|     public void download(@ApiParam("OSS对象ID") @PathVariable Long ossId, HttpServletResponse response) throws IOException { |     public void download(@PathVariable Long ossId, HttpServletResponse response) throws IOException { | ||||||
|         SysOss sysOss = iSysOssService.getById(ossId); |         SysOssVo sysOss = iSysOssService.getById(ossId); | ||||||
|         if (ObjectUtil.isNull(sysOss)) { |         if (ObjectUtil.isNull(sysOss)) { | ||||||
|             throw new ServiceException("文件数据不存在!"); |             throw new ServiceException("文件数据不存在!"); | ||||||
|         } |         } | ||||||
| @@ -120,13 +118,13 @@ public class SysOssController extends BaseController { | |||||||
|  |  | ||||||
|     /** |     /** | ||||||
|      * 删除OSS对象存储 |      * 删除OSS对象存储 | ||||||
|  |      * | ||||||
|  |      * @param ossIds OSS对象ID串 | ||||||
|      */ |      */ | ||||||
|     @ApiOperation("删除OSS对象存储") |  | ||||||
|     @SaCheckPermission("system:oss:remove") |     @SaCheckPermission("system:oss:remove") | ||||||
|     @Log(title = "OSS对象存储", businessType = BusinessType.DELETE) |     @Log(title = "OSS对象存储", businessType = BusinessType.DELETE) | ||||||
|     @DeleteMapping("/{ossIds}") |     @DeleteMapping("/{ossIds}") | ||||||
|     public R<Void> remove(@ApiParam("OSS对象ID串") |     public R<Void> remove(@NotEmpty(message = "主键不能为空") | ||||||
|                                    @NotEmpty(message = "主键不能为空") |  | ||||||
|                           @PathVariable Long[] ossIds) { |                           @PathVariable Long[] ossIds) { | ||||||
|         return toAjax(iSysOssService.deleteWithValidByIds(Arrays.asList(ossIds), true) ? 1 : 0); |         return toAjax(iSysOssService.deleteWithValidByIds(Arrays.asList(ossIds), true) ? 1 : 0); | ||||||
|     } |     } | ||||||
|   | |||||||
| @@ -4,16 +4,13 @@ import cn.dev33.satoken.annotation.SaCheckPermission; | |||||||
| import com.ruoyi.common.annotation.Log; | import com.ruoyi.common.annotation.Log; | ||||||
| import com.ruoyi.common.constant.UserConstants; | import com.ruoyi.common.constant.UserConstants; | ||||||
| import com.ruoyi.common.core.controller.BaseController; | import com.ruoyi.common.core.controller.BaseController; | ||||||
| import com.ruoyi.common.core.domain.R; |  | ||||||
| import com.ruoyi.common.core.domain.PageQuery; | import com.ruoyi.common.core.domain.PageQuery; | ||||||
|  | import com.ruoyi.common.core.domain.R; | ||||||
| import com.ruoyi.common.core.page.TableDataInfo; | import com.ruoyi.common.core.page.TableDataInfo; | ||||||
| import com.ruoyi.common.enums.BusinessType; | import com.ruoyi.common.enums.BusinessType; | ||||||
| import com.ruoyi.common.utils.poi.ExcelUtil; | import com.ruoyi.common.utils.poi.ExcelUtil; | ||||||
| import com.ruoyi.system.domain.SysPost; | import com.ruoyi.system.domain.SysPost; | ||||||
| import com.ruoyi.system.service.ISysPostService; | import com.ruoyi.system.service.ISysPostService; | ||||||
| import io.swagger.annotations.Api; |  | ||||||
| import io.swagger.annotations.ApiOperation; |  | ||||||
| import io.swagger.annotations.ApiParam; |  | ||||||
| import lombok.RequiredArgsConstructor; | import lombok.RequiredArgsConstructor; | ||||||
| import org.springframework.validation.annotation.Validated; | import org.springframework.validation.annotation.Validated; | ||||||
| import org.springframework.web.bind.annotation.*; | import org.springframework.web.bind.annotation.*; | ||||||
| @@ -27,7 +24,6 @@ import java.util.List; | |||||||
|  * @author Lion Li |  * @author Lion Li | ||||||
|  */ |  */ | ||||||
| @Validated | @Validated | ||||||
| @Api(value = "岗位信息控制器", tags = {"岗位信息管理"}) |  | ||||||
| @RequiredArgsConstructor | @RequiredArgsConstructor | ||||||
| @RestController | @RestController | ||||||
| @RequestMapping("/system/post") | @RequestMapping("/system/post") | ||||||
| @@ -38,14 +34,15 @@ public class SysPostController extends BaseController { | |||||||
|     /** |     /** | ||||||
|      * 获取岗位列表 |      * 获取岗位列表 | ||||||
|      */ |      */ | ||||||
|     @ApiOperation("获取岗位列表") |  | ||||||
|     @SaCheckPermission("system:post:list") |     @SaCheckPermission("system:post:list") | ||||||
|     @GetMapping("/list") |     @GetMapping("/list") | ||||||
|     public TableDataInfo<SysPost> list(SysPost post, PageQuery pageQuery) { |     public TableDataInfo<SysPost> list(SysPost post, PageQuery pageQuery) { | ||||||
|         return postService.selectPagePostList(post, pageQuery); |         return postService.selectPagePostList(post, pageQuery); | ||||||
|     } |     } | ||||||
|  |  | ||||||
|     @ApiOperation("导出岗位列表") |     /** | ||||||
|  |      * 导出岗位列表 | ||||||
|  |      */ | ||||||
|     @Log(title = "岗位管理", businessType = BusinessType.EXPORT) |     @Log(title = "岗位管理", businessType = BusinessType.EXPORT) | ||||||
|     @SaCheckPermission("system:post:export") |     @SaCheckPermission("system:post:export") | ||||||
|     @PostMapping("/export") |     @PostMapping("/export") | ||||||
| @@ -56,18 +53,18 @@ public class SysPostController extends BaseController { | |||||||
|  |  | ||||||
|     /** |     /** | ||||||
|      * 根据岗位编号获取详细信息 |      * 根据岗位编号获取详细信息 | ||||||
|  |      * | ||||||
|  |      * @param postId 岗位ID | ||||||
|      */ |      */ | ||||||
|     @ApiOperation("根据岗位编号获取详细信息") |  | ||||||
|     @SaCheckPermission("system:post:query") |     @SaCheckPermission("system:post:query") | ||||||
|     @GetMapping(value = "/{postId}") |     @GetMapping(value = "/{postId}") | ||||||
|     public R<SysPost> getInfo(@ApiParam("岗位ID") @PathVariable Long postId) { |     public R<SysPost> getInfo(@PathVariable Long postId) { | ||||||
|         return R.ok(postService.selectPostById(postId)); |         return R.ok(postService.selectPostById(postId)); | ||||||
|     } |     } | ||||||
|  |  | ||||||
|     /** |     /** | ||||||
|      * 新增岗位 |      * 新增岗位 | ||||||
|      */ |      */ | ||||||
|     @ApiOperation("新增岗位") |  | ||||||
|     @SaCheckPermission("system:post:add") |     @SaCheckPermission("system:post:add") | ||||||
|     @Log(title = "岗位管理", businessType = BusinessType.INSERT) |     @Log(title = "岗位管理", businessType = BusinessType.INSERT) | ||||||
|     @PostMapping |     @PostMapping | ||||||
| @@ -83,7 +80,6 @@ public class SysPostController extends BaseController { | |||||||
|     /** |     /** | ||||||
|      * 修改岗位 |      * 修改岗位 | ||||||
|      */ |      */ | ||||||
|     @ApiOperation("修改岗位") |  | ||||||
|     @SaCheckPermission("system:post:edit") |     @SaCheckPermission("system:post:edit") | ||||||
|     @Log(title = "岗位管理", businessType = BusinessType.UPDATE) |     @Log(title = "岗位管理", businessType = BusinessType.UPDATE) | ||||||
|     @PutMapping |     @PutMapping | ||||||
| @@ -98,19 +94,19 @@ public class SysPostController extends BaseController { | |||||||
|  |  | ||||||
|     /** |     /** | ||||||
|      * 删除岗位 |      * 删除岗位 | ||||||
|  |      * | ||||||
|  |      * @param postIds 岗位ID串 | ||||||
|      */ |      */ | ||||||
|     @ApiOperation("删除岗位") |  | ||||||
|     @SaCheckPermission("system:post:remove") |     @SaCheckPermission("system:post:remove") | ||||||
|     @Log(title = "岗位管理", businessType = BusinessType.DELETE) |     @Log(title = "岗位管理", businessType = BusinessType.DELETE) | ||||||
|     @DeleteMapping("/{postIds}") |     @DeleteMapping("/{postIds}") | ||||||
|     public R<Void> remove(@ApiParam("岗位ID串") @PathVariable Long[] postIds) { |     public R<Void> remove(@PathVariable Long[] postIds) { | ||||||
|         return toAjax(postService.deletePostByIds(postIds)); |         return toAjax(postService.deletePostByIds(postIds)); | ||||||
|     } |     } | ||||||
|  |  | ||||||
|     /** |     /** | ||||||
|      * 获取岗位选择框列表 |      * 获取岗位选择框列表 | ||||||
|      */ |      */ | ||||||
|     @ApiOperation("获取岗位选择框列表") |  | ||||||
|     @GetMapping("/optionselect") |     @GetMapping("/optionselect") | ||||||
|     public R<List<SysPost>> optionselect() { |     public R<List<SysPost>> optionselect() { | ||||||
|         List<SysPost> posts = postService.selectPostAll(); |         List<SysPost> posts = postService.selectPostAll(); | ||||||
|   | |||||||
| @@ -14,16 +14,12 @@ import com.ruoyi.common.utils.file.MimeTypeUtils; | |||||||
| import com.ruoyi.system.domain.SysOss; | import com.ruoyi.system.domain.SysOss; | ||||||
| import com.ruoyi.system.service.ISysOssService; | import com.ruoyi.system.service.ISysOssService; | ||||||
| import com.ruoyi.system.service.ISysUserService; | import com.ruoyi.system.service.ISysUserService; | ||||||
| import io.swagger.annotations.Api; |  | ||||||
| import io.swagger.annotations.ApiImplicitParam; |  | ||||||
| import io.swagger.annotations.ApiImplicitParams; |  | ||||||
| import io.swagger.annotations.ApiOperation; |  | ||||||
| import lombok.RequiredArgsConstructor; | import lombok.RequiredArgsConstructor; | ||||||
|  | import org.springframework.http.MediaType; | ||||||
| import org.springframework.validation.annotation.Validated; | import org.springframework.validation.annotation.Validated; | ||||||
| import org.springframework.web.bind.annotation.*; | import org.springframework.web.bind.annotation.*; | ||||||
| import org.springframework.web.multipart.MultipartFile; | import org.springframework.web.multipart.MultipartFile; | ||||||
|  |  | ||||||
| import java.io.File; |  | ||||||
| import java.util.Arrays; | import java.util.Arrays; | ||||||
| import java.util.HashMap; | import java.util.HashMap; | ||||||
| import java.util.Map; | import java.util.Map; | ||||||
| @@ -34,7 +30,6 @@ import java.util.Map; | |||||||
|  * @author Lion Li |  * @author Lion Li | ||||||
|  */ |  */ | ||||||
| @Validated | @Validated | ||||||
| @Api(value = "个人信息控制器", tags = {"个人信息管理"}) |  | ||||||
| @RequiredArgsConstructor | @RequiredArgsConstructor | ||||||
| @RestController | @RestController | ||||||
| @RequestMapping("/system/user/profile") | @RequestMapping("/system/user/profile") | ||||||
| @@ -46,7 +41,6 @@ public class SysProfileController extends BaseController { | |||||||
|     /** |     /** | ||||||
|      * 个人信息 |      * 个人信息 | ||||||
|      */ |      */ | ||||||
|     @ApiOperation("个人信息") |  | ||||||
|     @GetMapping |     @GetMapping | ||||||
|     public R<Map<String, Object>> profile() { |     public R<Map<String, Object>> profile() { | ||||||
|         SysUser user = userService.selectUserById(getUserId()); |         SysUser user = userService.selectUserById(getUserId()); | ||||||
| @@ -60,7 +54,6 @@ public class SysProfileController extends BaseController { | |||||||
|     /** |     /** | ||||||
|      * 修改用户 |      * 修改用户 | ||||||
|      */ |      */ | ||||||
|     @ApiOperation("修改用户") |  | ||||||
|     @Log(title = "个人信息", businessType = BusinessType.UPDATE) |     @Log(title = "个人信息", businessType = BusinessType.UPDATE) | ||||||
|     @PutMapping |     @PutMapping | ||||||
|     public R<Void> updateProfile(@RequestBody SysUser user) { |     public R<Void> updateProfile(@RequestBody SysUser user) { | ||||||
| @@ -83,12 +76,10 @@ public class SysProfileController extends BaseController { | |||||||
|  |  | ||||||
|     /** |     /** | ||||||
|      * 重置密码 |      * 重置密码 | ||||||
|  |      * | ||||||
|  |      * @param newPassword 旧密码 | ||||||
|  |      * @param oldPassword 新密码 | ||||||
|      */ |      */ | ||||||
|     @ApiOperation("重置密码") |  | ||||||
|     @ApiImplicitParams({ |  | ||||||
|         @ApiImplicitParam(name = "oldPassword", value = "旧密码", paramType = "query", dataTypeClass = String.class), |  | ||||||
|         @ApiImplicitParam(name = "newPassword", value = "新密码", paramType = "query", dataTypeClass = String.class) |  | ||||||
|     }) |  | ||||||
|     @Log(title = "个人信息", businessType = BusinessType.UPDATE) |     @Log(title = "个人信息", businessType = BusinessType.UPDATE) | ||||||
|     @PutMapping("/updatePwd") |     @PutMapping("/updatePwd") | ||||||
|     public R<Void> updatePwd(String oldPassword, String newPassword) { |     public R<Void> updatePwd(String oldPassword, String newPassword) { | ||||||
| @@ -110,21 +101,19 @@ public class SysProfileController extends BaseController { | |||||||
|  |  | ||||||
|     /** |     /** | ||||||
|      * 头像上传 |      * 头像上传 | ||||||
|  |      * | ||||||
|  |      * @param avatarfile 用户头像 | ||||||
|      */ |      */ | ||||||
|     @ApiOperation("头像上传") |  | ||||||
|     @ApiImplicitParams({ |  | ||||||
|         @ApiImplicitParam(name = "avatarfile", value = "用户头像", paramType = "query", dataTypeClass = File.class, required = true) |  | ||||||
|     }) |  | ||||||
|     @Log(title = "用户头像", businessType = BusinessType.UPDATE) |     @Log(title = "用户头像", businessType = BusinessType.UPDATE) | ||||||
|     @PostMapping("/avatar") |     @PostMapping(value = "/avatar", consumes = MediaType.MULTIPART_FORM_DATA_VALUE) | ||||||
|     public R<Map<String, Object>> avatar(@RequestPart("avatarfile") MultipartFile file) { |     public R<Map<String, Object>> avatar(@RequestPart("avatarfile") MultipartFile avatarfile) { | ||||||
|         Map<String, Object> ajax = new HashMap<>(); |         Map<String, Object> ajax = new HashMap<>(); | ||||||
|         if (!file.isEmpty()) { |         if (!avatarfile.isEmpty()) { | ||||||
|             String extension = FileUtil.extName(file.getOriginalFilename()); |             String extension = FileUtil.extName(avatarfile.getOriginalFilename()); | ||||||
|             if (!StringUtils.equalsAnyIgnoreCase(extension, MimeTypeUtils.IMAGE_EXTENSION)) { |             if (!StringUtils.equalsAnyIgnoreCase(extension, MimeTypeUtils.IMAGE_EXTENSION)) { | ||||||
|                 return R.fail("文件格式不正确,请上传" + Arrays.toString(MimeTypeUtils.IMAGE_EXTENSION) + "格式"); |                 return R.fail("文件格式不正确,请上传" + Arrays.toString(MimeTypeUtils.IMAGE_EXTENSION) + "格式"); | ||||||
|             } |             } | ||||||
|             SysOss oss = iSysOssService.upload(file); |             SysOss oss = iSysOssService.upload(avatarfile); | ||||||
|             String avatar = oss.getUrl(); |             String avatar = oss.getUrl(); | ||||||
|             if (userService.updateUserAvatar(getUsername(), avatar)) { |             if (userService.updateUserAvatar(getUsername(), avatar)) { | ||||||
|                 ajax.put("imgUrl", avatar); |                 ajax.put("imgUrl", avatar); | ||||||
|   | |||||||
| @@ -6,8 +6,6 @@ import com.ruoyi.common.core.domain.R; | |||||||
| import com.ruoyi.common.core.domain.model.RegisterBody; | import com.ruoyi.common.core.domain.model.RegisterBody; | ||||||
| import com.ruoyi.system.service.ISysConfigService; | import com.ruoyi.system.service.ISysConfigService; | ||||||
| import com.ruoyi.system.service.SysRegisterService; | import com.ruoyi.system.service.SysRegisterService; | ||||||
| import io.swagger.annotations.Api; |  | ||||||
| import io.swagger.annotations.ApiOperation; |  | ||||||
| import lombok.RequiredArgsConstructor; | import lombok.RequiredArgsConstructor; | ||||||
| import org.springframework.validation.annotation.Validated; | import org.springframework.validation.annotation.Validated; | ||||||
| import org.springframework.web.bind.annotation.PostMapping; | import org.springframework.web.bind.annotation.PostMapping; | ||||||
| @@ -20,7 +18,6 @@ import org.springframework.web.bind.annotation.RestController; | |||||||
|  * @author Lion Li |  * @author Lion Li | ||||||
|  */ |  */ | ||||||
| @Validated | @Validated | ||||||
| @Api(value = "注册验证控制器", tags = {"注册验证管理"}) |  | ||||||
| @RequiredArgsConstructor | @RequiredArgsConstructor | ||||||
| @RestController | @RestController | ||||||
| public class SysRegisterController extends BaseController { | public class SysRegisterController extends BaseController { | ||||||
| @@ -28,8 +25,10 @@ public class SysRegisterController extends BaseController { | |||||||
|     private final SysRegisterService registerService; |     private final SysRegisterService registerService; | ||||||
|     private final ISysConfigService configService; |     private final ISysConfigService configService; | ||||||
|  |  | ||||||
|  |     /** | ||||||
|  |      * 用户注册 | ||||||
|  |      */ | ||||||
|     @Anonymous |     @Anonymous | ||||||
|     @ApiOperation("用户注册") |  | ||||||
|     @PostMapping("/register") |     @PostMapping("/register") | ||||||
|     public R<Void> register(@Validated @RequestBody RegisterBody user) { |     public R<Void> register(@Validated @RequestBody RegisterBody user) { | ||||||
|         if (!("true".equals(configService.selectConfigByKey("sys.account.registerUser")))) { |         if (!("true".equals(configService.selectConfigByKey("sys.account.registerUser")))) { | ||||||
|   | |||||||
| @@ -5,8 +5,8 @@ import cn.hutool.core.util.ObjectUtil; | |||||||
| import com.ruoyi.common.annotation.Log; | import com.ruoyi.common.annotation.Log; | ||||||
| import com.ruoyi.common.constant.UserConstants; | import com.ruoyi.common.constant.UserConstants; | ||||||
| import com.ruoyi.common.core.controller.BaseController; | import com.ruoyi.common.core.controller.BaseController; | ||||||
| import com.ruoyi.common.core.domain.R; |  | ||||||
| import com.ruoyi.common.core.domain.PageQuery; | import com.ruoyi.common.core.domain.PageQuery; | ||||||
|  | import com.ruoyi.common.core.domain.R; | ||||||
| import com.ruoyi.common.core.domain.entity.SysRole; | import com.ruoyi.common.core.domain.entity.SysRole; | ||||||
| import com.ruoyi.common.core.domain.entity.SysUser; | import com.ruoyi.common.core.domain.entity.SysUser; | ||||||
| import com.ruoyi.common.core.domain.model.LoginUser; | import com.ruoyi.common.core.domain.model.LoginUser; | ||||||
| @@ -18,7 +18,6 @@ import com.ruoyi.system.domain.SysUserRole; | |||||||
| import com.ruoyi.system.service.ISysRoleService; | import com.ruoyi.system.service.ISysRoleService; | ||||||
| import com.ruoyi.system.service.ISysUserService; | import com.ruoyi.system.service.ISysUserService; | ||||||
| import com.ruoyi.system.service.SysPermissionService; | import com.ruoyi.system.service.SysPermissionService; | ||||||
| import io.swagger.annotations.*; |  | ||||||
| import lombok.RequiredArgsConstructor; | import lombok.RequiredArgsConstructor; | ||||||
| import org.springframework.validation.annotation.Validated; | import org.springframework.validation.annotation.Validated; | ||||||
| import org.springframework.web.bind.annotation.*; | import org.springframework.web.bind.annotation.*; | ||||||
| @@ -32,7 +31,6 @@ import java.util.List; | |||||||
|  * @author Lion Li |  * @author Lion Li | ||||||
|  */ |  */ | ||||||
| @Validated | @Validated | ||||||
| @Api(value = "角色信息控制器", tags = {"角色信息管理"}) |  | ||||||
| @RequiredArgsConstructor | @RequiredArgsConstructor | ||||||
| @RestController | @RestController | ||||||
| @RequestMapping("/system/role") | @RequestMapping("/system/role") | ||||||
| @@ -42,14 +40,18 @@ public class SysRoleController extends BaseController { | |||||||
|     private final ISysUserService userService; |     private final ISysUserService userService; | ||||||
|     private final SysPermissionService permissionService; |     private final SysPermissionService permissionService; | ||||||
|  |  | ||||||
|     @ApiOperation("查询角色信息列表") |     /** | ||||||
|  |      * 获取角色信息列表 | ||||||
|  |      */ | ||||||
|     @SaCheckPermission("system:role:list") |     @SaCheckPermission("system:role:list") | ||||||
|     @GetMapping("/list") |     @GetMapping("/list") | ||||||
|     public TableDataInfo<SysRole> list(SysRole role, PageQuery pageQuery) { |     public TableDataInfo<SysRole> list(SysRole role, PageQuery pageQuery) { | ||||||
|         return roleService.selectPageRoleList(role, pageQuery); |         return roleService.selectPageRoleList(role, pageQuery); | ||||||
|     } |     } | ||||||
|  |  | ||||||
|     @ApiOperation("导出角色信息列表") |     /** | ||||||
|  |      * 导出角色信息列表 | ||||||
|  |      */ | ||||||
|     @Log(title = "角色管理", businessType = BusinessType.EXPORT) |     @Log(title = "角色管理", businessType = BusinessType.EXPORT) | ||||||
|     @SaCheckPermission("system:role:export") |     @SaCheckPermission("system:role:export") | ||||||
|     @PostMapping("/export") |     @PostMapping("/export") | ||||||
| @@ -60,11 +62,12 @@ public class SysRoleController extends BaseController { | |||||||
|  |  | ||||||
|     /** |     /** | ||||||
|      * 根据角色编号获取详细信息 |      * 根据角色编号获取详细信息 | ||||||
|  |      * | ||||||
|  |      * @param roleId 角色ID | ||||||
|      */ |      */ | ||||||
|     @ApiOperation("根据角色编号获取详细信息") |  | ||||||
|     @SaCheckPermission("system:role:query") |     @SaCheckPermission("system:role:query") | ||||||
|     @GetMapping(value = "/{roleId}") |     @GetMapping(value = "/{roleId}") | ||||||
|     public R<SysRole> getInfo(@ApiParam("角色ID") @PathVariable Long roleId) { |     public R<SysRole> getInfo(@PathVariable Long roleId) { | ||||||
|         roleService.checkRoleDataScope(roleId); |         roleService.checkRoleDataScope(roleId); | ||||||
|         return R.ok(roleService.selectRoleById(roleId)); |         return R.ok(roleService.selectRoleById(roleId)); | ||||||
|     } |     } | ||||||
| @@ -72,7 +75,6 @@ public class SysRoleController extends BaseController { | |||||||
|     /** |     /** | ||||||
|      * 新增角色 |      * 新增角色 | ||||||
|      */ |      */ | ||||||
|     @ApiOperation("新增角色") |  | ||||||
|     @SaCheckPermission("system:role:add") |     @SaCheckPermission("system:role:add") | ||||||
|     @Log(title = "角色管理", businessType = BusinessType.INSERT) |     @Log(title = "角色管理", businessType = BusinessType.INSERT) | ||||||
|     @PostMapping |     @PostMapping | ||||||
| @@ -89,7 +91,6 @@ public class SysRoleController extends BaseController { | |||||||
|     /** |     /** | ||||||
|      * 修改保存角色 |      * 修改保存角色 | ||||||
|      */ |      */ | ||||||
|     @ApiOperation("修改保存角色") |  | ||||||
|     @SaCheckPermission("system:role:edit") |     @SaCheckPermission("system:role:edit") | ||||||
|     @Log(title = "角色管理", businessType = BusinessType.UPDATE) |     @Log(title = "角色管理", businessType = BusinessType.UPDATE) | ||||||
|     @PutMapping |     @PutMapping | ||||||
| @@ -118,7 +119,6 @@ public class SysRoleController extends BaseController { | |||||||
|     /** |     /** | ||||||
|      * 修改保存数据权限 |      * 修改保存数据权限 | ||||||
|      */ |      */ | ||||||
|     @ApiOperation("修改保存数据权限") |  | ||||||
|     @SaCheckPermission("system:role:edit") |     @SaCheckPermission("system:role:edit") | ||||||
|     @Log(title = "角色管理", businessType = BusinessType.UPDATE) |     @Log(title = "角色管理", businessType = BusinessType.UPDATE) | ||||||
|     @PutMapping("/dataScope") |     @PutMapping("/dataScope") | ||||||
| @@ -131,7 +131,6 @@ public class SysRoleController extends BaseController { | |||||||
|     /** |     /** | ||||||
|      * 状态修改 |      * 状态修改 | ||||||
|      */ |      */ | ||||||
|     @ApiOperation("状态修改") |  | ||||||
|     @SaCheckPermission("system:role:edit") |     @SaCheckPermission("system:role:edit") | ||||||
|     @Log(title = "角色管理", businessType = BusinessType.UPDATE) |     @Log(title = "角色管理", businessType = BusinessType.UPDATE) | ||||||
|     @PutMapping("/changeStatus") |     @PutMapping("/changeStatus") | ||||||
| @@ -143,19 +142,19 @@ public class SysRoleController extends BaseController { | |||||||
|  |  | ||||||
|     /** |     /** | ||||||
|      * 删除角色 |      * 删除角色 | ||||||
|  |      * | ||||||
|  |      * @param roleIds 角色ID串 | ||||||
|      */ |      */ | ||||||
|     @ApiOperation("删除角色") |  | ||||||
|     @SaCheckPermission("system:role:remove") |     @SaCheckPermission("system:role:remove") | ||||||
|     @Log(title = "角色管理", businessType = BusinessType.DELETE) |     @Log(title = "角色管理", businessType = BusinessType.DELETE) | ||||||
|     @DeleteMapping("/{roleIds}") |     @DeleteMapping("/{roleIds}") | ||||||
|     public R<Void> remove(@ApiParam("角色ID串") @PathVariable Long[] roleIds) { |     public R<Void> remove(@PathVariable Long[] roleIds) { | ||||||
|         return toAjax(roleService.deleteRoleByIds(roleIds)); |         return toAjax(roleService.deleteRoleByIds(roleIds)); | ||||||
|     } |     } | ||||||
|  |  | ||||||
|     /** |     /** | ||||||
|      * 获取角色选择框列表 |      * 获取角色选择框列表 | ||||||
|      */ |      */ | ||||||
|     @ApiOperation("获取角色选择框列表") |  | ||||||
|     @SaCheckPermission("system:role:query") |     @SaCheckPermission("system:role:query") | ||||||
|     @GetMapping("/optionselect") |     @GetMapping("/optionselect") | ||||||
|     public R<List<SysRole>> optionselect() { |     public R<List<SysRole>> optionselect() { | ||||||
| @@ -165,7 +164,6 @@ public class SysRoleController extends BaseController { | |||||||
|     /** |     /** | ||||||
|      * 查询已分配用户角色列表 |      * 查询已分配用户角色列表 | ||||||
|      */ |      */ | ||||||
|     @ApiOperation("查询已分配用户角色列表") |  | ||||||
|     @SaCheckPermission("system:role:list") |     @SaCheckPermission("system:role:list") | ||||||
|     @GetMapping("/authUser/allocatedList") |     @GetMapping("/authUser/allocatedList") | ||||||
|     public TableDataInfo<SysUser> allocatedList(SysUser user, PageQuery pageQuery) { |     public TableDataInfo<SysUser> allocatedList(SysUser user, PageQuery pageQuery) { | ||||||
| @@ -175,7 +173,6 @@ public class SysRoleController extends BaseController { | |||||||
|     /** |     /** | ||||||
|      * 查询未分配用户角色列表 |      * 查询未分配用户角色列表 | ||||||
|      */ |      */ | ||||||
|     @ApiOperation("查询未分配用户角色列表") |  | ||||||
|     @SaCheckPermission("system:role:list") |     @SaCheckPermission("system:role:list") | ||||||
|     @GetMapping("/authUser/unallocatedList") |     @GetMapping("/authUser/unallocatedList") | ||||||
|     public TableDataInfo<SysUser> unallocatedList(SysUser user, PageQuery pageQuery) { |     public TableDataInfo<SysUser> unallocatedList(SysUser user, PageQuery pageQuery) { | ||||||
| @@ -185,7 +182,6 @@ public class SysRoleController extends BaseController { | |||||||
|     /** |     /** | ||||||
|      * 取消授权用户 |      * 取消授权用户 | ||||||
|      */ |      */ | ||||||
|     @ApiOperation("取消授权用户") |  | ||||||
|     @SaCheckPermission("system:role:edit") |     @SaCheckPermission("system:role:edit") | ||||||
|     @Log(title = "角色管理", businessType = BusinessType.GRANT) |     @Log(title = "角色管理", businessType = BusinessType.GRANT) | ||||||
|     @PutMapping("/authUser/cancel") |     @PutMapping("/authUser/cancel") | ||||||
| @@ -195,12 +191,10 @@ public class SysRoleController extends BaseController { | |||||||
|  |  | ||||||
|     /** |     /** | ||||||
|      * 批量取消授权用户 |      * 批量取消授权用户 | ||||||
|  |      * | ||||||
|  |      * @param roleId  角色ID | ||||||
|  |      * @param userIds 用户ID串 | ||||||
|      */ |      */ | ||||||
|     @ApiOperation("批量取消授权用户") |  | ||||||
|     @ApiImplicitParams({ |  | ||||||
|         @ApiImplicitParam(name = "roleId", value = "角色ID", paramType = "query", dataTypeClass = String.class), |  | ||||||
|         @ApiImplicitParam(name = "userIds", value = "用户ID串", paramType = "query", dataTypeClass = String.class) |  | ||||||
|     }) |  | ||||||
|     @SaCheckPermission("system:role:edit") |     @SaCheckPermission("system:role:edit") | ||||||
|     @Log(title = "角色管理", businessType = BusinessType.GRANT) |     @Log(title = "角色管理", businessType = BusinessType.GRANT) | ||||||
|     @PutMapping("/authUser/cancelAll") |     @PutMapping("/authUser/cancelAll") | ||||||
| @@ -210,12 +204,10 @@ public class SysRoleController extends BaseController { | |||||||
|  |  | ||||||
|     /** |     /** | ||||||
|      * 批量选择用户授权 |      * 批量选择用户授权 | ||||||
|  |      * | ||||||
|  |      * @param roleId  角色ID | ||||||
|  |      * @param userIds 用户ID串 | ||||||
|      */ |      */ | ||||||
|     @ApiOperation("批量选择用户授权") |  | ||||||
|     @ApiImplicitParams({ |  | ||||||
|         @ApiImplicitParam(name = "roleId", value = "角色ID", paramType = "query", dataTypeClass = String.class), |  | ||||||
|         @ApiImplicitParam(name = "userIds", value = "用户ID串", paramType = "query", dataTypeClass = String.class) |  | ||||||
|     }) |  | ||||||
|     @SaCheckPermission("system:role:edit") |     @SaCheckPermission("system:role:edit") | ||||||
|     @Log(title = "角色管理", businessType = BusinessType.GRANT) |     @Log(title = "角色管理", businessType = BusinessType.GRANT) | ||||||
|     @PutMapping("/authUser/selectAll") |     @PutMapping("/authUser/selectAll") | ||||||
|   | |||||||
| @@ -17,6 +17,7 @@ import com.ruoyi.common.core.page.TableDataInfo; | |||||||
| import com.ruoyi.common.enums.BusinessType; | import com.ruoyi.common.enums.BusinessType; | ||||||
| import com.ruoyi.common.excel.ExcelResult; | import com.ruoyi.common.excel.ExcelResult; | ||||||
| import com.ruoyi.common.helper.LoginHelper; | import com.ruoyi.common.helper.LoginHelper; | ||||||
|  | import com.ruoyi.common.utils.StreamUtils; | ||||||
| import com.ruoyi.common.utils.StringUtils; | import com.ruoyi.common.utils.StringUtils; | ||||||
| import com.ruoyi.common.utils.poi.ExcelUtil; | import com.ruoyi.common.utils.poi.ExcelUtil; | ||||||
| import com.ruoyi.system.domain.vo.SysUserExportVo; | import com.ruoyi.system.domain.vo.SysUserExportVo; | ||||||
| @@ -25,8 +26,8 @@ import com.ruoyi.system.listener.SysUserImportListener; | |||||||
| import com.ruoyi.system.service.ISysPostService; | import com.ruoyi.system.service.ISysPostService; | ||||||
| import com.ruoyi.system.service.ISysRoleService; | import com.ruoyi.system.service.ISysRoleService; | ||||||
| import com.ruoyi.system.service.ISysUserService; | import com.ruoyi.system.service.ISysUserService; | ||||||
| import io.swagger.annotations.*; |  | ||||||
| import lombok.RequiredArgsConstructor; | import lombok.RequiredArgsConstructor; | ||||||
|  | import org.springframework.http.MediaType; | ||||||
| import org.springframework.validation.annotation.Validated; | import org.springframework.validation.annotation.Validated; | ||||||
| import org.springframework.web.bind.annotation.*; | import org.springframework.web.bind.annotation.*; | ||||||
| import org.springframework.web.multipart.MultipartFile; | import org.springframework.web.multipart.MultipartFile; | ||||||
| @@ -36,7 +37,6 @@ import java.util.ArrayList; | |||||||
| import java.util.HashMap; | import java.util.HashMap; | ||||||
| import java.util.List; | import java.util.List; | ||||||
| import java.util.Map; | import java.util.Map; | ||||||
| import java.util.stream.Collectors; |  | ||||||
|  |  | ||||||
| /** | /** | ||||||
|  * 用户信息 |  * 用户信息 | ||||||
| @@ -44,7 +44,6 @@ import java.util.stream.Collectors; | |||||||
|  * @author Lion Li |  * @author Lion Li | ||||||
|  */ |  */ | ||||||
| @Validated | @Validated | ||||||
| @Api(value = "用户信息控制器", tags = {"用户信息管理"}) |  | ||||||
| @RequiredArgsConstructor | @RequiredArgsConstructor | ||||||
| @RestController | @RestController | ||||||
| @RequestMapping("/system/user") | @RequestMapping("/system/user") | ||||||
| @@ -57,14 +56,15 @@ public class SysUserController extends BaseController { | |||||||
|     /** |     /** | ||||||
|      * 获取用户列表 |      * 获取用户列表 | ||||||
|      */ |      */ | ||||||
|     @ApiOperation("获取用户列表") |  | ||||||
|     @SaCheckPermission("system:user:list") |     @SaCheckPermission("system:user:list") | ||||||
|     @GetMapping("/list") |     @GetMapping("/list") | ||||||
|     public TableDataInfo<SysUser> list(SysUser user, PageQuery pageQuery) { |     public TableDataInfo<SysUser> list(SysUser user, PageQuery pageQuery) { | ||||||
|         return userService.selectPageUserList(user, pageQuery); |         return userService.selectPageUserList(user, pageQuery); | ||||||
|     } |     } | ||||||
|  |  | ||||||
|     @ApiOperation("导出用户列表") |     /** | ||||||
|  |      * 导出用户列表 | ||||||
|  |      */ | ||||||
|     @Log(title = "用户管理", businessType = BusinessType.EXPORT) |     @Log(title = "用户管理", businessType = BusinessType.EXPORT) | ||||||
|     @SaCheckPermission("system:user:export") |     @SaCheckPermission("system:user:export") | ||||||
|     @PostMapping("/export") |     @PostMapping("/export") | ||||||
| @@ -82,19 +82,23 @@ public class SysUserController extends BaseController { | |||||||
|         ExcelUtil.exportExcel(listVo, "用户数据", SysUserExportVo.class, response); |         ExcelUtil.exportExcel(listVo, "用户数据", SysUserExportVo.class, response); | ||||||
|     } |     } | ||||||
|  |  | ||||||
|     @ApiOperation("导入用户列表") |     /** | ||||||
|     @ApiImplicitParams({ |      * 导入数据 | ||||||
|         @ApiImplicitParam(name = "file", value = "导入文件", dataType = "java.io.File", required = true), |      * | ||||||
|     }) |      * @param file          导入文件 | ||||||
|  |      * @param updateSupport 是否更新已存在数据 | ||||||
|  |      */ | ||||||
|     @Log(title = "用户管理", businessType = BusinessType.IMPORT) |     @Log(title = "用户管理", businessType = BusinessType.IMPORT) | ||||||
|     @SaCheckPermission("system:user:import") |     @SaCheckPermission("system:user:import") | ||||||
|     @PostMapping("/importData") |     @PostMapping(value = "/importData", consumes = MediaType.MULTIPART_FORM_DATA_VALUE) | ||||||
|     public R<Void> importData(@RequestPart("file") MultipartFile file, boolean updateSupport) throws Exception { |     public R<Void> importData(@RequestPart("file") MultipartFile file, boolean updateSupport) throws Exception { | ||||||
|         ExcelResult<SysUserImportVo> result = ExcelUtil.importExcel(file.getInputStream(), SysUserImportVo.class, new SysUserImportListener(updateSupport)); |         ExcelResult<SysUserImportVo> result = ExcelUtil.importExcel(file.getInputStream(), SysUserImportVo.class, new SysUserImportListener(updateSupport)); | ||||||
|         return R.ok(result.getAnalysis()); |         return R.ok(result.getAnalysis()); | ||||||
|     } |     } | ||||||
|  |  | ||||||
|     @ApiOperation("下载导入模板") |     /** | ||||||
|  |      * 获取导入模板 | ||||||
|  |      */ | ||||||
|     @PostMapping("/importTemplate") |     @PostMapping("/importTemplate") | ||||||
|     public void importTemplate(HttpServletResponse response) { |     public void importTemplate(HttpServletResponse response) { | ||||||
|         ExcelUtil.exportExcel(new ArrayList<>(), "用户数据", SysUserImportVo.class, response); |         ExcelUtil.exportExcel(new ArrayList<>(), "用户数据", SysUserImportVo.class, response); | ||||||
| @@ -102,21 +106,22 @@ public class SysUserController extends BaseController { | |||||||
|  |  | ||||||
|     /** |     /** | ||||||
|      * 根据用户编号获取详细信息 |      * 根据用户编号获取详细信息 | ||||||
|  |      * | ||||||
|  |      * @param userId 用户ID | ||||||
|      */ |      */ | ||||||
|     @ApiOperation("根据用户编号获取详细信息") |  | ||||||
|     @SaCheckPermission("system:user:query") |     @SaCheckPermission("system:user:query") | ||||||
|     @GetMapping(value = {"/", "/{userId}"}) |     @GetMapping(value = {"/", "/{userId}"}) | ||||||
|     public R<Map<String, Object>> getInfo(@ApiParam("用户ID") @PathVariable(value = "userId", required = false) Long userId) { |     public R<Map<String, Object>> getInfo(@PathVariable(value = "userId", required = false) Long userId) { | ||||||
|         userService.checkUserDataScope(userId); |         userService.checkUserDataScope(userId); | ||||||
|         Map<String, Object> ajax = new HashMap<>(); |         Map<String, Object> ajax = new HashMap<>(); | ||||||
|         List<SysRole> roles = roleService.selectRoleAll(); |         List<SysRole> roles = roleService.selectRoleAll(); | ||||||
|         ajax.put("roles", LoginHelper.isAdmin(userId) ? roles : roles.stream().filter(r -> !r.isAdmin()).collect(Collectors.toList())); |         ajax.put("roles", LoginHelper.isAdmin(userId) ? roles : StreamUtils.filter(roles, r -> !r.isAdmin())); | ||||||
|         ajax.put("posts", postService.selectPostAll()); |         ajax.put("posts", postService.selectPostAll()); | ||||||
|         if (ObjectUtil.isNotNull(userId)) { |         if (ObjectUtil.isNotNull(userId)) { | ||||||
|             SysUser sysUser = userService.selectUserById(userId); |             SysUser sysUser = userService.selectUserById(userId); | ||||||
|             ajax.put("user", sysUser); |             ajax.put("user", sysUser); | ||||||
|             ajax.put("postIds", postService.selectPostListByUserId(userId)); |             ajax.put("postIds", postService.selectPostListByUserId(userId)); | ||||||
|             ajax.put("roleIds", sysUser.getRoles().stream().map(SysRole::getRoleId).collect(Collectors.toList())); |             ajax.put("roleIds", StreamUtils.toList(sysUser.getRoles(), SysRole::getRoleId)); | ||||||
|         } |         } | ||||||
|         return R.ok(ajax); |         return R.ok(ajax); | ||||||
|     } |     } | ||||||
| @@ -124,7 +129,6 @@ public class SysUserController extends BaseController { | |||||||
|     /** |     /** | ||||||
|      * 新增用户 |      * 新增用户 | ||||||
|      */ |      */ | ||||||
|     @ApiOperation("新增用户") |  | ||||||
|     @SaCheckPermission("system:user:add") |     @SaCheckPermission("system:user:add") | ||||||
|     @Log(title = "用户管理", businessType = BusinessType.INSERT) |     @Log(title = "用户管理", businessType = BusinessType.INSERT) | ||||||
|     @PostMapping |     @PostMapping | ||||||
| @@ -145,7 +149,6 @@ public class SysUserController extends BaseController { | |||||||
|     /** |     /** | ||||||
|      * 修改用户 |      * 修改用户 | ||||||
|      */ |      */ | ||||||
|     @ApiOperation("修改用户") |  | ||||||
|     @SaCheckPermission("system:user:edit") |     @SaCheckPermission("system:user:edit") | ||||||
|     @Log(title = "用户管理", businessType = BusinessType.UPDATE) |     @Log(title = "用户管理", businessType = BusinessType.UPDATE) | ||||||
|     @PutMapping |     @PutMapping | ||||||
| @@ -164,12 +167,13 @@ public class SysUserController extends BaseController { | |||||||
|  |  | ||||||
|     /** |     /** | ||||||
|      * 删除用户 |      * 删除用户 | ||||||
|  |      * | ||||||
|  |      * @param userIds 角色ID串 | ||||||
|      */ |      */ | ||||||
|     @ApiOperation("删除用户") |  | ||||||
|     @SaCheckPermission("system:user:remove") |     @SaCheckPermission("system:user:remove") | ||||||
|     @Log(title = "用户管理", businessType = BusinessType.DELETE) |     @Log(title = "用户管理", businessType = BusinessType.DELETE) | ||||||
|     @DeleteMapping("/{userIds}") |     @DeleteMapping("/{userIds}") | ||||||
|     public R<Void> remove(@ApiParam("角色ID串") @PathVariable Long[] userIds) { |     public R<Void> remove(@PathVariable Long[] userIds) { | ||||||
|         if (ArrayUtil.contains(userIds, getUserId())) { |         if (ArrayUtil.contains(userIds, getUserId())) { | ||||||
|             return R.fail("当前用户不能删除"); |             return R.fail("当前用户不能删除"); | ||||||
|         } |         } | ||||||
| @@ -179,7 +183,6 @@ public class SysUserController extends BaseController { | |||||||
|     /** |     /** | ||||||
|      * 重置密码 |      * 重置密码 | ||||||
|      */ |      */ | ||||||
|     @ApiOperation("重置密码") |  | ||||||
|     @SaCheckPermission("system:user:resetPwd") |     @SaCheckPermission("system:user:resetPwd") | ||||||
|     @Log(title = "用户管理", businessType = BusinessType.UPDATE) |     @Log(title = "用户管理", businessType = BusinessType.UPDATE) | ||||||
|     @PutMapping("/resetPwd") |     @PutMapping("/resetPwd") | ||||||
| @@ -193,7 +196,6 @@ public class SysUserController extends BaseController { | |||||||
|     /** |     /** | ||||||
|      * 状态修改 |      * 状态修改 | ||||||
|      */ |      */ | ||||||
|     @ApiOperation("状态修改") |  | ||||||
|     @SaCheckPermission("system:user:edit") |     @SaCheckPermission("system:user:edit") | ||||||
|     @Log(title = "用户管理", businessType = BusinessType.UPDATE) |     @Log(title = "用户管理", businessType = BusinessType.UPDATE) | ||||||
|     @PutMapping("/changeStatus") |     @PutMapping("/changeStatus") | ||||||
| @@ -205,27 +207,26 @@ public class SysUserController extends BaseController { | |||||||
|  |  | ||||||
|     /** |     /** | ||||||
|      * 根据用户编号获取授权角色 |      * 根据用户编号获取授权角色 | ||||||
|  |      * | ||||||
|  |      * @param userId 用户ID | ||||||
|      */ |      */ | ||||||
|     @ApiOperation("根据用户编号获取授权角色") |  | ||||||
|     @SaCheckPermission("system:user:query") |     @SaCheckPermission("system:user:query") | ||||||
|     @GetMapping("/authRole/{userId}") |     @GetMapping("/authRole/{userId}") | ||||||
|     public R<Map<String, Object>> authRole(@ApiParam("用户ID") @PathVariable("userId") Long userId) { |     public R<Map<String, Object>> authRole(@PathVariable Long userId) { | ||||||
|         SysUser user = userService.selectUserById(userId); |         SysUser user = userService.selectUserById(userId); | ||||||
|         List<SysRole> roles = roleService.selectRolesByUserId(userId); |         List<SysRole> roles = roleService.selectRolesByUserId(userId); | ||||||
|         Map<String, Object> ajax = new HashMap<>(); |         Map<String, Object> ajax = new HashMap<>(); | ||||||
|         ajax.put("user", user); |         ajax.put("user", user); | ||||||
|         ajax.put("roles", LoginHelper.isAdmin(userId) ? roles : roles.stream().filter(r -> !r.isAdmin()).collect(Collectors.toList())); |         ajax.put("roles", LoginHelper.isAdmin(userId) ? roles : StreamUtils.filter(roles, r -> !r.isAdmin())); | ||||||
|         return R.ok(ajax); |         return R.ok(ajax); | ||||||
|     } |     } | ||||||
|  |  | ||||||
|     /** |     /** | ||||||
|      * 用户授权角色 |      * 用户授权角色 | ||||||
|  |      * | ||||||
|  |      * @param userId  用户Id | ||||||
|  |      * @param roleIds 角色ID串 | ||||||
|      */ |      */ | ||||||
|     @ApiOperation("用户授权角色") |  | ||||||
|     @ApiImplicitParams({ |  | ||||||
|         @ApiImplicitParam(name = "userId", value = "用户Id", paramType = "query", dataTypeClass = String.class), |  | ||||||
|         @ApiImplicitParam(name = "roleIds", value = "角色ID串", paramType = "query", dataTypeClass = String.class) |  | ||||||
|     }) |  | ||||||
|     @SaCheckPermission("system:user:edit") |     @SaCheckPermission("system:user:edit") | ||||||
|     @Log(title = "用户管理", businessType = BusinessType.GRANT) |     @Log(title = "用户管理", businessType = BusinessType.GRANT) | ||||||
|     @PutMapping("/authRole") |     @PutMapping("/authRole") | ||||||
|   | |||||||
| @@ -138,6 +138,8 @@ spring: | |||||||
|     ssl: false |     ssl: false | ||||||
|  |  | ||||||
| redisson: | redisson: | ||||||
|  |   # redis key前缀 | ||||||
|  |   keyPrefix: | ||||||
|   # 线程池数量 |   # 线程池数量 | ||||||
|   threads: 4 |   threads: 4 | ||||||
|   # Netty线程池数量 |   # Netty线程池数量 | ||||||
|   | |||||||
| @@ -5,7 +5,7 @@ spring.servlet.multipart.location: /ruoyi/server/temp | |||||||
| spring.boot.admin.client: | spring.boot.admin.client: | ||||||
|   # 增加客户端开关 |   # 增加客户端开关 | ||||||
|   enabled: true |   enabled: true | ||||||
|   url: http://172.30.0.90:9090/admin |   url: http://localhost:9090/admin | ||||||
|   instance: |   instance: | ||||||
|     service-host-type: IP |     service-host-type: IP | ||||||
|   username: ruoyi |   username: ruoyi | ||||||
| @@ -16,7 +16,7 @@ xxl.job: | |||||||
|   # 执行器开关 |   # 执行器开关 | ||||||
|   enabled: true |   enabled: true | ||||||
|   # 调度中心地址:如调度中心集群部署存在多个地址则用逗号分隔。 |   # 调度中心地址:如调度中心集群部署存在多个地址则用逗号分隔。 | ||||||
|   admin-addresses: http://172.30.0.92:9100/xxl-job-admin |   admin-addresses: http://localhost:9100/xxl-job-admin | ||||||
|   # 执行器通讯TOKEN:非空时启用 |   # 执行器通讯TOKEN:非空时启用 | ||||||
|   access-token: xxl-job |   access-token: xxl-job | ||||||
|   executor: |   executor: | ||||||
| @@ -51,7 +51,7 @@ spring: | |||||||
|           driverClassName: com.mysql.cj.jdbc.Driver |           driverClassName: com.mysql.cj.jdbc.Driver | ||||||
|           # jdbc 所有参数配置参考 https://lionli.blog.csdn.net/article/details/122018562 |           # jdbc 所有参数配置参考 https://lionli.blog.csdn.net/article/details/122018562 | ||||||
|           # rewriteBatchedStatements=true 批处理优化 大幅提升批量插入更新删除性能(对数据库有性能损耗 使用批量操作应考虑性能问题) |           # rewriteBatchedStatements=true 批处理优化 大幅提升批量插入更新删除性能(对数据库有性能损耗 使用批量操作应考虑性能问题) | ||||||
|           url: jdbc:mysql://172.30.0.36:3306/ry-vue?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=true&serverTimezone=GMT%2B8&autoReconnect=true&rewriteBatchedStatements=true |           url: jdbc:mysql://localhost:3306/ry-vue?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=true&serverTimezone=GMT%2B8&autoReconnect=true&rewriteBatchedStatements=true | ||||||
|           username: root |           username: root | ||||||
|           password: root |           password: root | ||||||
|         # 从库数据源 |         # 从库数据源 | ||||||
| @@ -63,19 +63,19 @@ spring: | |||||||
|           password: |           password: | ||||||
| #        oracle: | #        oracle: | ||||||
| #          driverClassName: oracle.jdbc.OracleDriver | #          driverClassName: oracle.jdbc.OracleDriver | ||||||
| #          url: jdbc:oracle:thin:@//172.30.0.36:1521/XE | #          url: jdbc:oracle:thin:@//localhost:1521/XE | ||||||
| #          username: ROOT | #          username: ROOT | ||||||
| #          password: root | #          password: root | ||||||
| #          druid: | #          druid: | ||||||
| #            validationQuery: SELECT 1 FROM DUAL | #            validationQuery: SELECT 1 FROM DUAL | ||||||
| #        postgres: | #        postgres: | ||||||
| #          driverClassName: org.postgresql.Driver | #          driverClassName: org.postgresql.Driver | ||||||
| #          url: jdbc:postgresql://172.30.0.36:5432/postgres?useUnicode=true&characterEncoding=utf8&useSSL=true&autoReconnect=true&reWriteBatchedInserts=true | #          url: jdbc:postgresql://localhost:5432/postgres?useUnicode=true&characterEncoding=utf8&useSSL=true&autoReconnect=true&reWriteBatchedInserts=true | ||||||
| #          username: root | #          username: root | ||||||
| #          password: root | #          password: root | ||||||
| #        sqlserver: | #        sqlserver: | ||||||
| #          driverClassName: com.microsoft.sqlserver.jdbc.SQLServerDriver | #          driverClassName: com.microsoft.sqlserver.jdbc.SQLServerDriver | ||||||
| #          url: jdbc:sqlserver://172.30.0.36:1433;DatabaseName=tempdb;SelectMethod=cursor;rewriteBatchedStatements=true | #          url: jdbc:sqlserver://localhost:1433;DatabaseName=tempdb;SelectMethod=cursor;rewriteBatchedStatements=true | ||||||
| #          username: SA | #          username: SA | ||||||
| #          password: root | #          password: root | ||||||
|       druid: |       druid: | ||||||
| @@ -128,7 +128,7 @@ spring.datasource.druid: | |||||||
| spring: | spring: | ||||||
|   redis: |   redis: | ||||||
|     # 地址 |     # 地址 | ||||||
|     host: 172.30.0.48 |     host: localhost | ||||||
|     # 端口,默认为6379 |     # 端口,默认为6379 | ||||||
|     port: 6379 |     port: 6379 | ||||||
|     # 数据库索引 |     # 数据库索引 | ||||||
| @@ -141,6 +141,8 @@ spring: | |||||||
|     ssl: false |     ssl: false | ||||||
|  |  | ||||||
| redisson: | redisson: | ||||||
|  |   # redis key前缀 | ||||||
|  |   keyPrefix: | ||||||
|   # 线程池数量 |   # 线程池数量 | ||||||
|   threads: 16 |   threads: 16 | ||||||
|   # Netty线程池数量 |   # Netty线程池数量 | ||||||
|   | |||||||
| @@ -53,6 +53,14 @@ logging: | |||||||
|     org.springframework: warn |     org.springframework: warn | ||||||
|   config: classpath:logback.xml |   config: classpath:logback.xml | ||||||
|  |  | ||||||
|  | # 用户配置 | ||||||
|  | user: | ||||||
|  |   password: | ||||||
|  |     # 密码最大错误次数 | ||||||
|  |     maxRetryCount: 5 | ||||||
|  |     # 密码锁定时间(默认10分钟) | ||||||
|  |     lockTime: 10 | ||||||
|  |  | ||||||
| # Spring配置 | # Spring配置 | ||||||
| spring: | spring: | ||||||
|   application: |   application: | ||||||
| @@ -75,10 +83,6 @@ spring: | |||||||
|     restart: |     restart: | ||||||
|       # 热部署开关 |       # 热部署开关 | ||||||
|       enabled: true |       enabled: true | ||||||
|   mvc: |  | ||||||
|     pathmatch: |  | ||||||
|       # 适配 boot 2.6 路由与 springfox 兼容 |  | ||||||
|       matching-strategy: ANT_PATH_MATCHER |  | ||||||
|   jackson: |   jackson: | ||||||
|     # 日期格式化 |     # 日期格式化 | ||||||
|     date-format: yyyy-MM-dd HH:mm:ss |     date-format: yyyy-MM-dd HH:mm:ss | ||||||
| @@ -125,10 +129,8 @@ security: | |||||||
|     - /**/*.js |     - /**/*.js | ||||||
|     # swagger 文档配置 |     # swagger 文档配置 | ||||||
|     - /favicon.ico |     - /favicon.ico | ||||||
|     - /doc.html |  | ||||||
|     - /swagger-resources/** |  | ||||||
|     - /webjars/** |  | ||||||
|     - /*/api-docs |     - /*/api-docs | ||||||
|  |     - /*/api-docs/** | ||||||
|     # druid 监控配置 |     # druid 监控配置 | ||||||
|     - /druid/** |     - /druid/** | ||||||
|     # actuator 监控配置 |     # actuator 监控配置 | ||||||
| @@ -183,8 +185,7 @@ mybatis-plus: | |||||||
| swagger: | swagger: | ||||||
|   # 是否开启swagger |   # 是否开启swagger | ||||||
|   enabled: true |   enabled: true | ||||||
|   # 请求前缀 |   info: | ||||||
|   pathMapping: /dev-api |  | ||||||
|     # 标题 |     # 标题 | ||||||
|     title: '标题:${ruoyi.name}后台管理系统_接口文档' |     title: '标题:${ruoyi.name}后台管理系统_接口文档' | ||||||
|     # 描述 |     # 描述 | ||||||
| @@ -196,33 +197,23 @@ swagger: | |||||||
|       name: Lion Li |       name: Lion Li | ||||||
|       email: crazylionli@163.com |       email: crazylionli@163.com | ||||||
|       url: https://gitee.com/JavaLionLi/RuoYi-Vue-Plus |       url: https://gitee.com/JavaLionLi/RuoYi-Vue-Plus | ||||||
|   groups: |   components: | ||||||
|     - name: 1.演示案例 |     # 鉴权方式配置 | ||||||
|       basePackage: com.ruoyi.demo |     security-schemes: | ||||||
|     - name: 2.系统模块 |       apiKey: | ||||||
|       basePackage: com.ruoyi.web |         type: APIKEY | ||||||
|     - name: 3.代码生成模块 |         in: HEADER | ||||||
|       basePackage: com.ruoyi.generator |         name: ${sa-token.token-name} | ||||||
|  |  | ||||||
| knife4j: | springdoc: | ||||||
|   # 是否开启Knife4j增强模式 |   #这里定义了两个分组,可定义多个,也可以不定义 | ||||||
|   enable: true |   group-configs: | ||||||
|   # 是否开启生产环境保护策略 |     - group: 1.演示模块 | ||||||
|   production: @knife4j.production@ |       packages-to-scan: com.ruoyi.demo | ||||||
|   basic: |     - group: 2.系统模块 | ||||||
|     enable: true |       packages-to-scan: com.ruoyi.web | ||||||
|     username: ruoyi |     - group: 3.代码生成模块 | ||||||
|     password: 123456 |       packages-to-scan: com.ruoyi.generator | ||||||
|   # 前端Ui的个性化配置属性 |  | ||||||
|   setting: |  | ||||||
|     # 默认语言 |  | ||||||
|     language: zh-CN |  | ||||||
|     # 是否显示Footer |  | ||||||
|     enableFooter: false |  | ||||||
|     # 是否开启动态参数调试功能 |  | ||||||
|     enableDynamicParameter: true |  | ||||||
|     # 是否在每个Debug调试栏后显示刷新变量按钮 |  | ||||||
|     enableReloadCacheParameter: true |  | ||||||
|  |  | ||||||
| # 防止XSS攻击 | # 防止XSS攻击 | ||||||
| xss: | xss: | ||||||
| @@ -242,21 +233,6 @@ thread-pool: | |||||||
|   # 线程池维护线程所允许的空闲时间 |   # 线程池维护线程所允许的空闲时间 | ||||||
|   keepAliveSeconds: 300 |   keepAliveSeconds: 300 | ||||||
|  |  | ||||||
| --- # redisson 缓存配置 |  | ||||||
| redisson: |  | ||||||
|   cacheGroup: |  | ||||||
|     # 用例: @Cacheable(cacheNames="groupId", key="#XXX") 方可使用缓存组配置 |  | ||||||
|     - groupId: redissonCacheMap |  | ||||||
|       # 组过期时间(脚本监控) |  | ||||||
|       ttl: 60000 |  | ||||||
|       # 组最大空闲时间(脚本监控) |  | ||||||
|       maxIdleTime: 60000 |  | ||||||
|       # 组最大长度 |  | ||||||
|       maxSize: 0 |  | ||||||
|     - groupId: testCache |  | ||||||
|       ttl: 1000 |  | ||||||
|       maxIdleTime: 500 |  | ||||||
|  |  | ||||||
| --- # 分布式锁 lock4j 全局配置 | --- # 分布式锁 lock4j 全局配置 | ||||||
| lock4j: | lock4j: | ||||||
|   # 获取分布式锁超时时间,默认为 3000 毫秒 |   # 获取分布式锁超时时间,默认为 3000 毫秒 | ||||||
| @@ -269,9 +245,9 @@ management: | |||||||
|   endpoints: |   endpoints: | ||||||
|     web: |     web: | ||||||
|       exposure: |       exposure: | ||||||
|         # 需要开放的端点。默认值只打开 health 和 info 两个端点。通过设置 * ,可以开放所有端点。 |         include: '*' | ||||||
|         # 生产环境不建议放开所有 根据项目需求放开即可 |  | ||||||
|         include: @endpoints.include@ |  | ||||||
|   endpoint: |   endpoint: | ||||||
|  |     health: | ||||||
|  |       show-details: ALWAYS | ||||||
|     logfile: |     logfile: | ||||||
|       external-file: ./logs/sys-console.log |       external-file: ./logs/sys-console.log | ||||||
|   | |||||||
| @@ -1,45 +1,45 @@ | |||||||
| #错误消息 | #\u9519\u8BEF\u6D88\u606F | ||||||
| not.null=* 必须填写 | not.null=* \u5FC5\u987B\u586B\u5199 | ||||||
| user.jcaptcha.error=验证码错误 | user.jcaptcha.error=\u9A8C\u8BC1\u7801\u9519\u8BEF | ||||||
| user.jcaptcha.expire=验证码已失效 | user.jcaptcha.expire=\u9A8C\u8BC1\u7801\u5DF2\u5931\u6548 | ||||||
| user.not.exists=对不起, 您的账号:{0} 不存在. | user.not.exists=\u5BF9\u4E0D\u8D77, \u60A8\u7684\u8D26\u53F7\uFF1A{0} \u4E0D\u5B58\u5728. | ||||||
| user.password.not.match=用户不存在/密码错误 | user.password.not.match=\u7528\u6237\u4E0D\u5B58\u5728/\u5BC6\u7801\u9519\u8BEF | ||||||
| user.password.retry.limit.count=密码输入错误{0}次 | user.password.retry.limit.count=\u5BC6\u7801\u8F93\u5165\u9519\u8BEF{0}\u6B21 | ||||||
| user.password.retry.limit.exceed=密码错误次数过多,帐户锁定{0}分钟 | user.password.retry.limit.exceed=\u5BC6\u7801\u8F93\u5165\u9519\u8BEF{0}\u6B21\uFF0C\u5E10\u6237\u9501\u5B9A{1}\u5206\u949F | ||||||
| user.password.delete=对不起,您的账号:{0} 已被删除 | user.password.delete=\u5BF9\u4E0D\u8D77\uFF0C\u60A8\u7684\u8D26\u53F7\uFF1A{0} \u5DF2\u88AB\u5220\u9664 | ||||||
| user.blocked=对不起,您的账号:{0} 已禁用,请联系管理员 | user.blocked=\u5BF9\u4E0D\u8D77\uFF0C\u60A8\u7684\u8D26\u53F7\uFF1A{0} \u5DF2\u7981\u7528\uFF0C\u8BF7\u8054\u7CFB\u7BA1\u7406\u5458 | ||||||
| role.blocked=角色已封禁,请联系管理员 | role.blocked=\u89D2\u8272\u5DF2\u5C01\u7981\uFF0C\u8BF7\u8054\u7CFB\u7BA1\u7406\u5458 | ||||||
| user.logout.success=退出成功 | user.logout.success=\u9000\u51FA\u6210\u529F | ||||||
| length.not.valid=长度必须在{min}到{max}个字符之间 | length.not.valid=\u957F\u5EA6\u5FC5\u987B\u5728{min}\u5230{max}\u4E2A\u5B57\u7B26\u4E4B\u95F4 | ||||||
| user.username.not.blank=用户名不能为空 | user.username.not.blank=\u7528\u6237\u540D\u4E0D\u80FD\u4E3A\u7A7A | ||||||
| user.username.not.valid=* 2到20个汉字、字母、数字或下划线组成,且必须以非数字开头 | user.username.not.valid=* 2\u523020\u4E2A\u6C49\u5B57\u3001\u5B57\u6BCD\u3001\u6570\u5B57\u6216\u4E0B\u5212\u7EBF\u7EC4\u6210\uFF0C\u4E14\u5FC5\u987B\u4EE5\u975E\u6570\u5B57\u5F00\u5934 | ||||||
| user.username.length.valid=账户长度必须在{min}到{max}个字符之间 | user.username.length.valid=\u8D26\u6237\u957F\u5EA6\u5FC5\u987B\u5728{min}\u5230{max}\u4E2A\u5B57\u7B26\u4E4B\u95F4 | ||||||
| user.password.not.blank=用户密码不能为空 | user.password.not.blank=\u7528\u6237\u5BC6\u7801\u4E0D\u80FD\u4E3A\u7A7A | ||||||
| user.password.length.valid=用户密码长度必须在{min}到{max}个字符之间 | user.password.length.valid=\u7528\u6237\u5BC6\u7801\u957F\u5EA6\u5FC5\u987B\u5728{min}\u5230{max}\u4E2A\u5B57\u7B26\u4E4B\u95F4 | ||||||
| user.password.not.valid=* 5-50个字符 | user.password.not.valid=* 5-50\u4E2A\u5B57\u7B26 | ||||||
| user.email.not.valid=邮箱格式错误 | user.email.not.valid=\u90AE\u7BB1\u683C\u5F0F\u9519\u8BEF | ||||||
| user.phonenumber.not.blank=用户手机号不能为空 | user.phonenumber.not.blank=\u7528\u6237\u624B\u673A\u53F7\u4E0D\u80FD\u4E3A\u7A7A | ||||||
| user.mobile.phone.number.not.valid=手机号格式错误 | user.mobile.phone.number.not.valid=\u624B\u673A\u53F7\u683C\u5F0F\u9519\u8BEF | ||||||
| user.login.success=登录成功 | user.login.success=\u767B\u5F55\u6210\u529F | ||||||
| user.register.success=注册成功 | user.register.success=\u6CE8\u518C\u6210\u529F | ||||||
| user.register.save.error=保存用户 {0} 失败,注册账号已存在 | user.register.save.error=\u4FDD\u5B58\u7528\u6237 {0} \u5931\u8D25\uFF0C\u6CE8\u518C\u8D26\u53F7\u5DF2\u5B58\u5728 | ||||||
| user.register.error=注册失败,请联系系统管理人员 | user.register.error=\u6CE8\u518C\u5931\u8D25\uFF0C\u8BF7\u8054\u7CFB\u7CFB\u7EDF\u7BA1\u7406\u4EBA\u5458 | ||||||
| user.notfound=请重新登录 | user.notfound=\u8BF7\u91CD\u65B0\u767B\u5F55 | ||||||
| user.forcelogout=管理员强制退出,请重新登录 | user.forcelogout=\u7BA1\u7406\u5458\u5F3A\u5236\u9000\u51FA\uFF0C\u8BF7\u91CD\u65B0\u767B\u5F55 | ||||||
| user.unknown.error=未知错误,请重新登录 | user.unknown.error=\u672A\u77E5\u9519\u8BEF\uFF0C\u8BF7\u91CD\u65B0\u767B\u5F55 | ||||||
| ##文件上传消息 | ##\u6587\u4EF6\u4E0A\u4F20\u6D88\u606F | ||||||
| upload.exceed.maxSize=上传的文件大小超出限制的文件大小!<br/>允许的文件最大大小是:{0}MB! | upload.exceed.maxSize=\u4E0A\u4F20\u7684\u6587\u4EF6\u5927\u5C0F\u8D85\u51FA\u9650\u5236\u7684\u6587\u4EF6\u5927\u5C0F\uFF01<br/>\u5141\u8BB8\u7684\u6587\u4EF6\u6700\u5927\u5927\u5C0F\u662F\uFF1A{0}MB\uFF01 | ||||||
| upload.filename.exceed.length=上传的文件名最长{0}个字符 | upload.filename.exceed.length=\u4E0A\u4F20\u7684\u6587\u4EF6\u540D\u6700\u957F{0}\u4E2A\u5B57\u7B26 | ||||||
| ##权限 | ##\u6743\u9650 | ||||||
| no.permission=您没有数据的权限,请联系管理员添加权限 [{0}] | no.permission=\u60A8\u6CA1\u6709\u6570\u636E\u7684\u6743\u9650\uFF0C\u8BF7\u8054\u7CFB\u7BA1\u7406\u5458\u6DFB\u52A0\u6743\u9650 [{0}] | ||||||
| no.create.permission=您没有创建数据的权限,请联系管理员添加权限 [{0}] | no.create.permission=\u60A8\u6CA1\u6709\u521B\u5EFA\u6570\u636E\u7684\u6743\u9650\uFF0C\u8BF7\u8054\u7CFB\u7BA1\u7406\u5458\u6DFB\u52A0\u6743\u9650 [{0}] | ||||||
| no.update.permission=您没有修改数据的权限,请联系管理员添加权限 [{0}] | no.update.permission=\u60A8\u6CA1\u6709\u4FEE\u6539\u6570\u636E\u7684\u6743\u9650\uFF0C\u8BF7\u8054\u7CFB\u7BA1\u7406\u5458\u6DFB\u52A0\u6743\u9650 [{0}] | ||||||
| no.delete.permission=您没有删除数据的权限,请联系管理员添加权限 [{0}] | no.delete.permission=\u60A8\u6CA1\u6709\u5220\u9664\u6570\u636E\u7684\u6743\u9650\uFF0C\u8BF7\u8054\u7CFB\u7BA1\u7406\u5458\u6DFB\u52A0\u6743\u9650 [{0}] | ||||||
| no.export.permission=您没有导出数据的权限,请联系管理员添加权限 [{0}] | no.export.permission=\u60A8\u6CA1\u6709\u5BFC\u51FA\u6570\u636E\u7684\u6743\u9650\uFF0C\u8BF7\u8054\u7CFB\u7BA1\u7406\u5458\u6DFB\u52A0\u6743\u9650 [{0}] | ||||||
| no.view.permission=您没有查看数据的权限,请联系管理员添加权限 [{0}] | no.view.permission=\u60A8\u6CA1\u6709\u67E5\u770B\u6570\u636E\u7684\u6743\u9650\uFF0C\u8BF7\u8054\u7CFB\u7BA1\u7406\u5458\u6DFB\u52A0\u6743\u9650 [{0}] | ||||||
| repeat.submit.message=不允许重复提交,请稍候再试 | repeat.submit.message=\u4E0D\u5141\u8BB8\u91CD\u590D\u63D0\u4EA4\uFF0C\u8BF7\u7A0D\u5019\u518D\u8BD5 | ||||||
| rate.limiter.message=访问过于频繁,请稍候再试 | rate.limiter.message=\u8BBF\u95EE\u8FC7\u4E8E\u9891\u7E41\uFF0C\u8BF7\u7A0D\u5019\u518D\u8BD5 | ||||||
| sms.code.not.blank=短信验证码不能为空 | sms.code.not.blank=\u77ED\u4FE1\u9A8C\u8BC1\u7801\u4E0D\u80FD\u4E3A\u7A7A | ||||||
| sms.code.retry.limit.count=短信验证码输入错误{0}次 | sms.code.retry.limit.count=\u77ED\u4FE1\u9A8C\u8BC1\u7801\u8F93\u5165\u9519\u8BEF{0}\u6B21 | ||||||
| sms.code.retry.limit.exceed=短信验证码错误次数过多,帐户锁定{0}分钟 | sms.code.retry.limit.exceed=\u77ED\u4FE1\u9A8C\u8BC1\u7801\u8F93\u5165\u9519\u8BEF{0}\u6B21\uFF0C\u5E10\u6237\u9501\u5B9A{0}\u5206\u949F | ||||||
| xcx.code.not.blank=小程序code不能为空 | xcx.code.not.blank=\u5C0F\u7A0B\u5E8Fcode\u4E0D\u80FD\u4E3A\u7A7A | ||||||
|   | |||||||
| @@ -1,14 +1,14 @@ | |||||||
| #错误消息 | #\u9519\u8BEF\u6D88\u606F | ||||||
| not.null=* Required fill in | not.null=* Required fill in | ||||||
| user.jcaptcha.error=Captcha error | user.jcaptcha.error=Captcha error | ||||||
| user.jcaptcha.expire=Captcha invalid | user.jcaptcha.expire=Captcha invalid | ||||||
| user.not.exists=Sorry, your account: {0} does not exist | user.not.exists=Sorry, your account: {0} does not exist | ||||||
| user.password.not.match=User does not exist/Password error | user.password.not.match=User does not exist/Password error | ||||||
| user.password.retry.limit.count=Password input error {0} times | user.password.retry.limit.count=Password input error {0} times | ||||||
| user.password.retry.limit.exceed=Too many password errors, account locked for {0} minutes | user.password.retry.limit.exceed=Password input error {0} times, account locked for {1} minutes | ||||||
| user.password.delete=Sorry, your account:{0} has been deleted | user.password.delete=Sorry, your account\uFF1A{0} has been deleted | ||||||
| user.blocked=Sorry, your account: {0} has been disabled. Please contact the administrator | user.blocked=Sorry, your account: {0} has been disabled. Please contact the administrator | ||||||
| role.blocked=Role disabled,please contact administrators | role.blocked=Role disabled\uFF0Cplease contact administrators | ||||||
| user.logout.success=Exit successful | user.logout.success=Exit successful | ||||||
| length.not.valid=The length must be between {min} and {max} characters | length.not.valid=The length must be between {min} and {max} characters | ||||||
| user.username.not.blank=Username cannot be blank | user.username.not.blank=Username cannot be blank | ||||||
| @@ -25,21 +25,21 @@ user.register.success=Register successful | |||||||
| user.register.save.error=Failed to save user {0}, The registered account already exists | user.register.save.error=Failed to save user {0}, The registered account already exists | ||||||
| user.register.error=Register failed, please contact system administrator | user.register.error=Register failed, please contact system administrator | ||||||
| user.notfound=Please login again | user.notfound=Please login again | ||||||
| user.forcelogout=The administrator is forced to exit,please login again | user.forcelogout=The administrator is forced to exit\uFF0Cplease login again | ||||||
| user.unknown.error=Unknown error, please login again | user.unknown.error=Unknown error, please login again | ||||||
| ##文件上传消息 | ##\u6587\u4EF6\u4E0A\u4F20\u6D88\u606F | ||||||
| upload.exceed.maxSize=The uploaded file size exceeds the limit file size!<br/>the maximum allowed file size is:{0}MB! | upload.exceed.maxSize=The uploaded file size exceeds the limit file size\uFF01<br/>the maximum allowed file size is\uFF1A{0}MB\uFF01 | ||||||
| upload.filename.exceed.length=The maximum length of uploaded file name is {0} characters | upload.filename.exceed.length=The maximum length of uploaded file name is {0} characters | ||||||
| ##权限 | ##\u6743\u9650 | ||||||
| no.permission=You do not have permission to the data,please contact your administrator to add permissions [{0}] | no.permission=You do not have permission to the data\uFF0Cplease contact your administrator to add permissions [{0}] | ||||||
| no.create.permission=You do not have permission to create data,please contact your administrator to add permissions [{0}] | no.create.permission=You do not have permission to create data\uFF0Cplease contact your administrator to add permissions [{0}] | ||||||
| no.update.permission=You do not have permission to modify data,please contact your administrator to add permissions [{0}] | no.update.permission=You do not have permission to modify data\uFF0Cplease contact your administrator to add permissions [{0}] | ||||||
| no.delete.permission=You do not have permission to delete data,please contact your administrator to add permissions [{0}] | no.delete.permission=You do not have permission to delete data\uFF0Cplease contact your administrator to add permissions [{0}] | ||||||
| no.export.permission=You do not have permission to export data,please contact your administrator to add permissions [{0}] | no.export.permission=You do not have permission to export data\uFF0Cplease contact your administrator to add permissions [{0}] | ||||||
| no.view.permission=You do not have permission to view data,please contact your administrator to add permissions [{0}] | no.view.permission=You do not have permission to view data\uFF0Cplease contact your administrator to add permissions [{0}] | ||||||
| repeat.submit.message=Repeat submit is not allowed, please try again later | repeat.submit.message=Repeat submit is not allowed, please try again later | ||||||
| rate.limiter.message=Visit too frequently, please try again later | rate.limiter.message=Visit too frequently, please try again later | ||||||
| sms.code.not.blank=Sms code cannot be blank | sms.code.not.blank=Sms code cannot be blank | ||||||
| sms.code.retry.limit.count=Sms code input error {0} times | sms.code.retry.limit.count=Sms code input error {0} times | ||||||
| sms.code.retry.limit.exceed=Too many sms code errors, account locked for {0} minutes | sms.code.retry.limit.exceed=Sms code input error {0} times, account locked for {0} minutes | ||||||
| xcx.code.not.blank=Mini program code cannot be blank | xcx.code.not.blank=Mini program code cannot be blank | ||||||
|   | |||||||
| @@ -1,45 +1,45 @@ | |||||||
| #错误消息 | #\u9519\u8BEF\u6D88\u606F | ||||||
| not.null=* 必须填写 | not.null=* \u5FC5\u987B\u586B\u5199 | ||||||
| user.jcaptcha.error=验证码错误 | user.jcaptcha.error=\u9A8C\u8BC1\u7801\u9519\u8BEF | ||||||
| user.jcaptcha.expire=验证码已失效 | user.jcaptcha.expire=\u9A8C\u8BC1\u7801\u5DF2\u5931\u6548 | ||||||
| user.not.exists=对不起, 您的账号:{0} 不存在. | user.not.exists=\u5BF9\u4E0D\u8D77, \u60A8\u7684\u8D26\u53F7\uFF1A{0} \u4E0D\u5B58\u5728. | ||||||
| user.password.not.match=用户不存在/密码错误 | user.password.not.match=\u7528\u6237\u4E0D\u5B58\u5728/\u5BC6\u7801\u9519\u8BEF | ||||||
| user.password.retry.limit.count=密码输入错误{0}次 | user.password.retry.limit.count=\u5BC6\u7801\u8F93\u5165\u9519\u8BEF{0}\u6B21 | ||||||
| user.password.retry.limit.exceed=密码错误次数过多,帐户锁定{0}分钟 | user.password.retry.limit.exceed=\u5BC6\u7801\u8F93\u5165\u9519\u8BEF{0}\u6B21\uFF0C\u5E10\u6237\u9501\u5B9A{1}\u5206\u949F | ||||||
| user.password.delete=对不起,您的账号:{0} 已被删除 | user.password.delete=\u5BF9\u4E0D\u8D77\uFF0C\u60A8\u7684\u8D26\u53F7\uFF1A{0} \u5DF2\u88AB\u5220\u9664 | ||||||
| user.blocked=对不起,您的账号:{0} 已禁用,请联系管理员 | user.blocked=\u5BF9\u4E0D\u8D77\uFF0C\u60A8\u7684\u8D26\u53F7\uFF1A{0} \u5DF2\u7981\u7528\uFF0C\u8BF7\u8054\u7CFB\u7BA1\u7406\u5458 | ||||||
| role.blocked=角色已封禁,请联系管理员 | role.blocked=\u89D2\u8272\u5DF2\u5C01\u7981\uFF0C\u8BF7\u8054\u7CFB\u7BA1\u7406\u5458 | ||||||
| user.logout.success=退出成功 | user.logout.success=\u9000\u51FA\u6210\u529F | ||||||
| length.not.valid=长度必须在{min}到{max}个字符之间 | length.not.valid=\u957F\u5EA6\u5FC5\u987B\u5728{min}\u5230{max}\u4E2A\u5B57\u7B26\u4E4B\u95F4 | ||||||
| user.username.not.blank=用户名不能为空 | user.username.not.blank=\u7528\u6237\u540D\u4E0D\u80FD\u4E3A\u7A7A | ||||||
| user.username.not.valid=* 2到20个汉字、字母、数字或下划线组成,且必须以非数字开头 | user.username.not.valid=* 2\u523020\u4E2A\u6C49\u5B57\u3001\u5B57\u6BCD\u3001\u6570\u5B57\u6216\u4E0B\u5212\u7EBF\u7EC4\u6210\uFF0C\u4E14\u5FC5\u987B\u4EE5\u975E\u6570\u5B57\u5F00\u5934 | ||||||
| user.username.length.valid=账户长度必须在{min}到{max}个字符之间 | user.username.length.valid=\u8D26\u6237\u957F\u5EA6\u5FC5\u987B\u5728{min}\u5230{max}\u4E2A\u5B57\u7B26\u4E4B\u95F4 | ||||||
| user.password.not.blank=用户密码不能为空 | user.password.not.blank=\u7528\u6237\u5BC6\u7801\u4E0D\u80FD\u4E3A\u7A7A | ||||||
| user.password.length.valid=用户密码长度必须在{min}到{max}个字符之间 | user.password.length.valid=\u7528\u6237\u5BC6\u7801\u957F\u5EA6\u5FC5\u987B\u5728{min}\u5230{max}\u4E2A\u5B57\u7B26\u4E4B\u95F4 | ||||||
| user.password.not.valid=* 5-50个字符 | user.password.not.valid=* 5-50\u4E2A\u5B57\u7B26 | ||||||
| user.email.not.valid=邮箱格式错误 | user.email.not.valid=\u90AE\u7BB1\u683C\u5F0F\u9519\u8BEF | ||||||
| user.phonenumber.not.blank=用户手机号不能为空 | user.phonenumber.not.blank=\u7528\u6237\u624B\u673A\u53F7\u4E0D\u80FD\u4E3A\u7A7A | ||||||
| user.mobile.phone.number.not.valid=手机号格式错误 | user.mobile.phone.number.not.valid=\u624B\u673A\u53F7\u683C\u5F0F\u9519\u8BEF | ||||||
| user.login.success=登录成功 | user.login.success=\u767B\u5F55\u6210\u529F | ||||||
| user.register.success=注册成功 | user.register.success=\u6CE8\u518C\u6210\u529F | ||||||
| user.register.save.error=保存用户 {0} 失败,注册账号已存在 | user.register.save.error=\u4FDD\u5B58\u7528\u6237 {0} \u5931\u8D25\uFF0C\u6CE8\u518C\u8D26\u53F7\u5DF2\u5B58\u5728 | ||||||
| user.register.error=注册失败,请联系系统管理人员 | user.register.error=\u6CE8\u518C\u5931\u8D25\uFF0C\u8BF7\u8054\u7CFB\u7CFB\u7EDF\u7BA1\u7406\u4EBA\u5458 | ||||||
| user.notfound=请重新登录 | user.notfound=\u8BF7\u91CD\u65B0\u767B\u5F55 | ||||||
| user.forcelogout=管理员强制退出,请重新登录 | user.forcelogout=\u7BA1\u7406\u5458\u5F3A\u5236\u9000\u51FA\uFF0C\u8BF7\u91CD\u65B0\u767B\u5F55 | ||||||
| user.unknown.error=未知错误,请重新登录 | user.unknown.error=\u672A\u77E5\u9519\u8BEF\uFF0C\u8BF7\u91CD\u65B0\u767B\u5F55 | ||||||
| ##文件上传消息 | ##\u6587\u4EF6\u4E0A\u4F20\u6D88\u606F | ||||||
| upload.exceed.maxSize=上传的文件大小超出限制的文件大小!<br/>允许的文件最大大小是:{0}MB! | upload.exceed.maxSize=\u4E0A\u4F20\u7684\u6587\u4EF6\u5927\u5C0F\u8D85\u51FA\u9650\u5236\u7684\u6587\u4EF6\u5927\u5C0F\uFF01<br/>\u5141\u8BB8\u7684\u6587\u4EF6\u6700\u5927\u5927\u5C0F\u662F\uFF1A{0}MB\uFF01 | ||||||
| upload.filename.exceed.length=上传的文件名最长{0}个字符 | upload.filename.exceed.length=\u4E0A\u4F20\u7684\u6587\u4EF6\u540D\u6700\u957F{0}\u4E2A\u5B57\u7B26 | ||||||
| ##权限 | ##\u6743\u9650 | ||||||
| no.permission=您没有数据的权限,请联系管理员添加权限 [{0}] | no.permission=\u60A8\u6CA1\u6709\u6570\u636E\u7684\u6743\u9650\uFF0C\u8BF7\u8054\u7CFB\u7BA1\u7406\u5458\u6DFB\u52A0\u6743\u9650 [{0}] | ||||||
| no.create.permission=您没有创建数据的权限,请联系管理员添加权限 [{0}] | no.create.permission=\u60A8\u6CA1\u6709\u521B\u5EFA\u6570\u636E\u7684\u6743\u9650\uFF0C\u8BF7\u8054\u7CFB\u7BA1\u7406\u5458\u6DFB\u52A0\u6743\u9650 [{0}] | ||||||
| no.update.permission=您没有修改数据的权限,请联系管理员添加权限 [{0}] | no.update.permission=\u60A8\u6CA1\u6709\u4FEE\u6539\u6570\u636E\u7684\u6743\u9650\uFF0C\u8BF7\u8054\u7CFB\u7BA1\u7406\u5458\u6DFB\u52A0\u6743\u9650 [{0}] | ||||||
| no.delete.permission=您没有删除数据的权限,请联系管理员添加权限 [{0}] | no.delete.permission=\u60A8\u6CA1\u6709\u5220\u9664\u6570\u636E\u7684\u6743\u9650\uFF0C\u8BF7\u8054\u7CFB\u7BA1\u7406\u5458\u6DFB\u52A0\u6743\u9650 [{0}] | ||||||
| no.export.permission=您没有导出数据的权限,请联系管理员添加权限 [{0}] | no.export.permission=\u60A8\u6CA1\u6709\u5BFC\u51FA\u6570\u636E\u7684\u6743\u9650\uFF0C\u8BF7\u8054\u7CFB\u7BA1\u7406\u5458\u6DFB\u52A0\u6743\u9650 [{0}] | ||||||
| no.view.permission=您没有查看数据的权限,请联系管理员添加权限 [{0}] | no.view.permission=\u60A8\u6CA1\u6709\u67E5\u770B\u6570\u636E\u7684\u6743\u9650\uFF0C\u8BF7\u8054\u7CFB\u7BA1\u7406\u5458\u6DFB\u52A0\u6743\u9650 [{0}] | ||||||
| repeat.submit.message=不允许重复提交,请稍候再试 | repeat.submit.message=\u4E0D\u5141\u8BB8\u91CD\u590D\u63D0\u4EA4\uFF0C\u8BF7\u7A0D\u5019\u518D\u8BD5 | ||||||
| rate.limiter.message=访问过于频繁,请稍候再试 | rate.limiter.message=\u8BBF\u95EE\u8FC7\u4E8E\u9891\u7E41\uFF0C\u8BF7\u7A0D\u5019\u518D\u8BD5 | ||||||
| sms.code.not.blank=短信验证码不能为空 | sms.code.not.blank=\u77ED\u4FE1\u9A8C\u8BC1\u7801\u4E0D\u80FD\u4E3A\u7A7A | ||||||
| sms.code.retry.limit.count=短信验证码输入错误{0}次 | sms.code.retry.limit.count=\u77ED\u4FE1\u9A8C\u8BC1\u7801\u8F93\u5165\u9519\u8BEF{0}\u6B21 | ||||||
| sms.code.retry.limit.exceed=短信验证码错误次数过多,帐户锁定{0}分钟 | sms.code.retry.limit.exceed=\u77ED\u4FE1\u9A8C\u8BC1\u7801\u8F93\u5165\u9519\u8BEF{0}\u6B21\uFF0C\u5E10\u6237\u9501\u5B9A{0}\u5206\u949F | ||||||
| xcx.code.not.blank=小程序code不能为空 | xcx.code.not.blank=\u5C0F\u7A0B\u5E8Fcode\u4E0D\u80FD\u4E3A\u7A7A | ||||||
|   | |||||||
| @@ -5,7 +5,7 @@ | |||||||
|     <parent> |     <parent> | ||||||
|         <artifactId>ruoyi-vue-plus</artifactId> |         <artifactId>ruoyi-vue-plus</artifactId> | ||||||
|         <groupId>com.ruoyi</groupId> |         <groupId>com.ruoyi</groupId> | ||||||
|         <version>4.2.0</version> |         <version>4.3.0-beta2</version> | ||||||
|     </parent> |     </parent> | ||||||
|     <modelVersion>4.0.0</modelVersion> |     <modelVersion>4.0.0</modelVersion> | ||||||
|  |  | ||||||
| @@ -126,13 +126,13 @@ | |||||||
|         </dependency> |         </dependency> | ||||||
|  |  | ||||||
|         <dependency> |         <dependency> | ||||||
|             <groupId>com.github.xiaoymin</groupId> |             <groupId>org.springdoc</groupId> | ||||||
|             <artifactId>knife4j-spring-boot-starter</artifactId> |             <artifactId>springdoc-openapi-webmvc-core</artifactId> | ||||||
|         </dependency> |         </dependency> | ||||||
|  |  | ||||||
|         <dependency> |         <dependency> | ||||||
|             <groupId>io.swagger</groupId> |             <groupId>org.springdoc</groupId> | ||||||
|             <artifactId>swagger-annotations</artifactId> |             <artifactId>springdoc-openapi-javadoc</artifactId> | ||||||
|         </dependency> |         </dependency> | ||||||
|  |  | ||||||
|         <!--  自动生成YML配置关联JSON文件  --> |         <!--  自动生成YML配置关联JSON文件  --> | ||||||
|   | |||||||
| @@ -5,6 +5,8 @@ import java.lang.annotation.*; | |||||||
| /** | /** | ||||||
|  * 数据权限 |  * 数据权限 | ||||||
|  * |  * | ||||||
|  |  * 一个注解只能对应一个模板 | ||||||
|  |  * | ||||||
|  * @author Lion Li |  * @author Lion Li | ||||||
|  * @version 3.5.0 |  * @version 3.5.0 | ||||||
|  */ |  */ | ||||||
| @@ -16,11 +18,11 @@ public @interface DataColumn { | |||||||
|     /** |     /** | ||||||
|      * 占位符关键字 |      * 占位符关键字 | ||||||
|      */ |      */ | ||||||
|     String key() default "deptName"; |     String[] key() default "deptName"; | ||||||
|  |  | ||||||
|     /** |     /** | ||||||
|      * 占位符替换值 |      * 占位符替换值 | ||||||
|      */ |      */ | ||||||
|     String value() default "dept_id"; |     String[] value() default "dept_id"; | ||||||
|  |  | ||||||
| } | } | ||||||
|   | |||||||
| @@ -1,6 +1,6 @@ | |||||||
| package com.ruoyi.common.annotation; | package com.ruoyi.common.annotation; | ||||||
|  |  | ||||||
| import com.ruoyi.common.constant.Constants; | import com.ruoyi.common.constant.CacheConstants; | ||||||
| import com.ruoyi.common.enums.LimitType; | import com.ruoyi.common.enums.LimitType; | ||||||
|  |  | ||||||
| import java.lang.annotation.*; | import java.lang.annotation.*; | ||||||
| @@ -17,7 +17,7 @@ public @interface RateLimiter { | |||||||
|     /** |     /** | ||||||
|      * 限流key |      * 限流key | ||||||
|      */ |      */ | ||||||
|     String key() default Constants.RATE_LIMIT_KEY; |     String key() default CacheConstants.RATE_LIMIT_KEY; | ||||||
|  |  | ||||||
|     /** |     /** | ||||||
|      * 限流时间,单位秒 |      * 限流时间,单位秒 | ||||||
|   | |||||||
| @@ -0,0 +1,49 @@ | |||||||
|  | package com.ruoyi.common.constant; | ||||||
|  |  | ||||||
|  | /** | ||||||
|  |  * 缓存的key 常量 | ||||||
|  |  * | ||||||
|  |  * @author ruoyi | ||||||
|  |  */ | ||||||
|  | public interface CacheConstants { | ||||||
|  |  | ||||||
|  |     /** | ||||||
|  |      * 登录用户 redis key | ||||||
|  |      */ | ||||||
|  |     String LOGIN_TOKEN_KEY = "Authorization:login:token:"; | ||||||
|  |  | ||||||
|  |     /** | ||||||
|  |      * 在线用户 redis key | ||||||
|  |      */ | ||||||
|  |     String ONLINE_TOKEN_KEY = "online_tokens:"; | ||||||
|  |  | ||||||
|  |     /** | ||||||
|  |      * 验证码 redis key | ||||||
|  |      */ | ||||||
|  |     String CAPTCHA_CODE_KEY = "captcha_codes:"; | ||||||
|  |  | ||||||
|  |     /** | ||||||
|  |      * 参数管理 cache key | ||||||
|  |      */ | ||||||
|  |     String SYS_CONFIG_KEY = "sys_config:"; | ||||||
|  |  | ||||||
|  |     /** | ||||||
|  |      * 字典管理 cache key | ||||||
|  |      */ | ||||||
|  |     String SYS_DICT_KEY = "sys_dict:"; | ||||||
|  |  | ||||||
|  |     /** | ||||||
|  |      * 防重提交 redis key | ||||||
|  |      */ | ||||||
|  |     String REPEAT_SUBMIT_KEY = "repeat_submit:"; | ||||||
|  |  | ||||||
|  |     /** | ||||||
|  |      * 限流 redis key | ||||||
|  |      */ | ||||||
|  |     String RATE_LIMIT_KEY = "rate_limit:"; | ||||||
|  |  | ||||||
|  |     /** | ||||||
|  |      * 登录账户密码错误次数 redis key | ||||||
|  |      */ | ||||||
|  |     String PWD_ERR_CNT_KEY = "pwd_err_cnt:"; | ||||||
|  | } | ||||||
| @@ -0,0 +1,48 @@ | |||||||
|  | package com.ruoyi.common.constant; | ||||||
|  |  | ||||||
|  | /** | ||||||
|  |  * 缓存组名称常量 | ||||||
|  |  * <p> | ||||||
|  |  * key 格式为 cacheNames#ttl#maxIdleTime#maxSize | ||||||
|  |  * <p> | ||||||
|  |  * ttl 过期时间 如果设置为0则不过期 默认为0 | ||||||
|  |  * maxIdleTime 最大空闲时间 根据LRU算法清理空闲数据 如果设置为0则不检测 默认为0 | ||||||
|  |  * maxSize 组最大长度 根据LRU算法清理溢出数据 如果设置为0则无限长 默认为0 | ||||||
|  |  * <p> | ||||||
|  |  * 例子: test#60s、test#0#60s、test#0#1m#1000、test#1h#0#500 | ||||||
|  |  * | ||||||
|  |  * @author Lion Li | ||||||
|  |  */ | ||||||
|  | public interface CacheNames { | ||||||
|  |  | ||||||
|  |     /** | ||||||
|  |      * 演示案例 | ||||||
|  |      */ | ||||||
|  |     String DEMO_CACHE = "demo:cache#60s#10m#20"; | ||||||
|  |  | ||||||
|  |     /** | ||||||
|  |      * 系统配置 | ||||||
|  |      */ | ||||||
|  |     String SYS_CONFIG = "sys_config"; | ||||||
|  |  | ||||||
|  |     /** | ||||||
|  |      * 数据字典 | ||||||
|  |      */ | ||||||
|  |     String SYS_DICT = "sys_dict"; | ||||||
|  |  | ||||||
|  |     /** | ||||||
|  |      * OSS内容 | ||||||
|  |      */ | ||||||
|  |     String SYS_OSS = "sys_oss#30d"; | ||||||
|  |  | ||||||
|  |     /** | ||||||
|  |      * OSS配置 | ||||||
|  |      */ | ||||||
|  |     String SYS_OSS_CONFIG = "sys_oss_config"; | ||||||
|  |  | ||||||
|  |     /** | ||||||
|  |      * 在线用户 | ||||||
|  |      */ | ||||||
|  |     String ONLINE_TOKEN = "online_tokens"; | ||||||
|  |  | ||||||
|  | } | ||||||
| @@ -57,70 +57,15 @@ public interface Constants { | |||||||
|      */ |      */ | ||||||
|     String LOGIN_FAIL = "Error"; |     String LOGIN_FAIL = "Error"; | ||||||
|  |  | ||||||
|     /** |  | ||||||
|      * 验证码 redis key |  | ||||||
|      */ |  | ||||||
|     String CAPTCHA_CODE_KEY = "captcha_codes:"; |  | ||||||
|  |  | ||||||
|     /** |  | ||||||
|      * 登录用户 redis key |  | ||||||
|      */ |  | ||||||
|     String LOGIN_TOKEN_KEY = "Authorization:login:token:"; |  | ||||||
|  |  | ||||||
|     /** |  | ||||||
|      * 在线用户 redis key |  | ||||||
|      */ |  | ||||||
|     String ONLINE_TOKEN_KEY = "online_tokens:"; |  | ||||||
|  |  | ||||||
|     /** |  | ||||||
|      * 防重提交 redis key |  | ||||||
|      */ |  | ||||||
|     String REPEAT_SUBMIT_KEY = "repeat_submit:"; |  | ||||||
|  |  | ||||||
|     /** |  | ||||||
|      * 限流 redis key |  | ||||||
|      */ |  | ||||||
|     String RATE_LIMIT_KEY = "rate_limit:"; |  | ||||||
|  |  | ||||||
|     /** |     /** | ||||||
|      * 验证码有效期(分钟) |      * 验证码有效期(分钟) | ||||||
|      */ |      */ | ||||||
|     Integer CAPTCHA_EXPIRATION = 2; |     Integer CAPTCHA_EXPIRATION = 2; | ||||||
|  |  | ||||||
|     /** |  | ||||||
|      * 登陆错误 redis key |  | ||||||
|      */ |  | ||||||
|     String LOGIN_ERROR = "login_error:"; |  | ||||||
|  |  | ||||||
|     /** |  | ||||||
|      * 登录错误次数 |  | ||||||
|      */ |  | ||||||
|     Integer LOGIN_ERROR_NUMBER = 5; |  | ||||||
|  |  | ||||||
|     /** |  | ||||||
|      * 登录错误限制时间(分钟) |  | ||||||
|      */ |  | ||||||
|     Integer LOGIN_ERROR_LIMIT_TIME = 10; |  | ||||||
|  |  | ||||||
|     /** |     /** | ||||||
|      * 令牌 |      * 令牌 | ||||||
|      */ |      */ | ||||||
|     String TOKEN = "token"; |     String TOKEN = "token"; | ||||||
|  |  | ||||||
|     /** |  | ||||||
|      * 令牌前缀 |  | ||||||
|      */ |  | ||||||
|     String LOGIN_USER_KEY = "login_user_key"; |  | ||||||
|  |  | ||||||
|     /** |  | ||||||
|      * 参数管理 cache key |  | ||||||
|      */ |  | ||||||
|     String SYS_CONFIG_KEY = "sys_config:"; |  | ||||||
|  |  | ||||||
|     /** |  | ||||||
|      * 字典管理 cache key |  | ||||||
|      */ |  | ||||||
|     String SYS_DICT_KEY = "sys_dict:"; |  | ||||||
|  |  | ||||||
| } | } | ||||||
|  |  | ||||||
|   | |||||||
| @@ -2,7 +2,6 @@ package com.ruoyi.common.core.domain; | |||||||
|  |  | ||||||
| import com.baomidou.mybatisplus.annotation.FieldFill; | import com.baomidou.mybatisplus.annotation.FieldFill; | ||||||
| import com.baomidou.mybatisplus.annotation.TableField; | import com.baomidou.mybatisplus.annotation.TableField; | ||||||
| import io.swagger.annotations.ApiModelProperty; |  | ||||||
| import lombok.Data; | import lombok.Data; | ||||||
|  |  | ||||||
| import java.io.Serializable; | import java.io.Serializable; | ||||||
| @@ -24,42 +23,36 @@ public class BaseEntity implements Serializable { | |||||||
|     /** |     /** | ||||||
|      * 搜索值 |      * 搜索值 | ||||||
|      */ |      */ | ||||||
|     @ApiModelProperty(value = "搜索值") |  | ||||||
|     @TableField(exist = false) |     @TableField(exist = false) | ||||||
|     private String searchValue; |     private String searchValue; | ||||||
|  |  | ||||||
|     /** |     /** | ||||||
|      * 创建者 |      * 创建者 | ||||||
|      */ |      */ | ||||||
|     @ApiModelProperty(value = "创建者") |  | ||||||
|     @TableField(fill = FieldFill.INSERT) |     @TableField(fill = FieldFill.INSERT) | ||||||
|     private String createBy; |     private String createBy; | ||||||
|  |  | ||||||
|     /** |     /** | ||||||
|      * 创建时间 |      * 创建时间 | ||||||
|      */ |      */ | ||||||
|     @ApiModelProperty(value = "创建时间") |  | ||||||
|     @TableField(fill = FieldFill.INSERT) |     @TableField(fill = FieldFill.INSERT) | ||||||
|     private Date createTime; |     private Date createTime; | ||||||
|  |  | ||||||
|     /** |     /** | ||||||
|      * 更新者 |      * 更新者 | ||||||
|      */ |      */ | ||||||
|     @ApiModelProperty(value = "更新者") |  | ||||||
|     @TableField(fill = FieldFill.INSERT_UPDATE) |     @TableField(fill = FieldFill.INSERT_UPDATE) | ||||||
|     private String updateBy; |     private String updateBy; | ||||||
|  |  | ||||||
|     /** |     /** | ||||||
|      * 更新时间 |      * 更新时间 | ||||||
|      */ |      */ | ||||||
|     @ApiModelProperty(value = "更新时间") |  | ||||||
|     @TableField(fill = FieldFill.INSERT_UPDATE) |     @TableField(fill = FieldFill.INSERT_UPDATE) | ||||||
|     private Date updateTime; |     private Date updateTime; | ||||||
|  |  | ||||||
|     /** |     /** | ||||||
|      * 请求参数 |      * 请求参数 | ||||||
|      */ |      */ | ||||||
|     @ApiModelProperty(value = "请求参数") |  | ||||||
|     @TableField(exist = false) |     @TableField(exist = false) | ||||||
|     private Map<String, Object> params = new HashMap<>(); |     private Map<String, Object> params = new HashMap<>(); | ||||||
|  |  | ||||||
|   | |||||||
| @@ -5,7 +5,6 @@ import com.baomidou.mybatisplus.core.metadata.OrderItem; | |||||||
| import com.baomidou.mybatisplus.extension.plugins.pagination.Page; | import com.baomidou.mybatisplus.extension.plugins.pagination.Page; | ||||||
| import com.ruoyi.common.utils.StringUtils; | import com.ruoyi.common.utils.StringUtils; | ||||||
| import com.ruoyi.common.utils.sql.SqlUtil; | import com.ruoyi.common.utils.sql.SqlUtil; | ||||||
| import io.swagger.annotations.ApiModelProperty; |  | ||||||
| import lombok.Data; | import lombok.Data; | ||||||
|  |  | ||||||
| import java.io.Serializable; | import java.io.Serializable; | ||||||
| @@ -24,25 +23,21 @@ public class PageQuery implements Serializable { | |||||||
|     /** |     /** | ||||||
|      * 分页大小 |      * 分页大小 | ||||||
|      */ |      */ | ||||||
|     @ApiModelProperty("分页大小") |  | ||||||
|     private Integer pageSize; |     private Integer pageSize; | ||||||
|  |  | ||||||
|     /** |     /** | ||||||
|      * 当前页数 |      * 当前页数 | ||||||
|      */ |      */ | ||||||
|     @ApiModelProperty("当前页数") |  | ||||||
|     private Integer pageNum; |     private Integer pageNum; | ||||||
|  |  | ||||||
|     /** |     /** | ||||||
|      * 排序列 |      * 排序列 | ||||||
|      */ |      */ | ||||||
|     @ApiModelProperty("排序列") |  | ||||||
|     private String orderByColumn; |     private String orderByColumn; | ||||||
|  |  | ||||||
|     /** |     /** | ||||||
|      * 排序的方向desc或者asc |      * 排序的方向desc或者asc | ||||||
|      */ |      */ | ||||||
|     @ApiModelProperty(value = "排序的方向", example = "asc,desc") |  | ||||||
|     private String isAsc; |     private String isAsc; | ||||||
|  |  | ||||||
|     /** |     /** | ||||||
|   | |||||||
| @@ -1,7 +1,5 @@ | |||||||
| package com.ruoyi.common.core.domain; | package com.ruoyi.common.core.domain; | ||||||
|  |  | ||||||
| import io.swagger.annotations.ApiModel; |  | ||||||
| import io.swagger.annotations.ApiModelProperty; |  | ||||||
| import lombok.Data; | import lombok.Data; | ||||||
| import lombok.NoArgsConstructor; | import lombok.NoArgsConstructor; | ||||||
|  |  | ||||||
| @@ -14,7 +12,6 @@ import java.io.Serializable; | |||||||
|  */ |  */ | ||||||
| @Data | @Data | ||||||
| @NoArgsConstructor | @NoArgsConstructor | ||||||
| @ApiModel("请求响应对象") |  | ||||||
| public class R<T> implements Serializable { | public class R<T> implements Serializable { | ||||||
|     private static final long serialVersionUID = 1L; |     private static final long serialVersionUID = 1L; | ||||||
|  |  | ||||||
| @@ -28,13 +25,10 @@ public class R<T> implements Serializable { | |||||||
|      */ |      */ | ||||||
|     public static final int FAIL = 500; |     public static final int FAIL = 500; | ||||||
|  |  | ||||||
|     @ApiModelProperty("消息状态码") |  | ||||||
|     private int code; |     private int code; | ||||||
|  |  | ||||||
|     @ApiModelProperty("消息内容") |  | ||||||
|     private String msg; |     private String msg; | ||||||
|  |  | ||||||
|     @ApiModelProperty("数据对象") |  | ||||||
|     private T data; |     private T data; | ||||||
|  |  | ||||||
|     public static <T> R<T> ok() { |     public static <T> R<T> ok() { | ||||||
|   | |||||||
| @@ -1,7 +1,6 @@ | |||||||
| package com.ruoyi.common.core.domain; | package com.ruoyi.common.core.domain; | ||||||
|  |  | ||||||
| import com.baomidou.mybatisplus.annotation.TableField; | import com.baomidou.mybatisplus.annotation.TableField; | ||||||
| import io.swagger.annotations.ApiModelProperty; |  | ||||||
| import lombok.Data; | import lombok.Data; | ||||||
| import lombok.EqualsAndHashCode; | import lombok.EqualsAndHashCode; | ||||||
|  |  | ||||||
| @@ -24,20 +23,17 @@ public class TreeEntity<T> extends BaseEntity { | |||||||
|      * 父菜单名称 |      * 父菜单名称 | ||||||
|      */ |      */ | ||||||
|     @TableField(exist = false) |     @TableField(exist = false) | ||||||
|     @ApiModelProperty(value = "父菜单名称") |  | ||||||
|     private String parentName; |     private String parentName; | ||||||
|  |  | ||||||
|     /** |     /** | ||||||
|      * 父菜单ID |      * 父菜单ID | ||||||
|      */ |      */ | ||||||
|     @ApiModelProperty(value = "父菜单ID") |  | ||||||
|     private Long parentId; |     private Long parentId; | ||||||
|  |  | ||||||
|     /** |     /** | ||||||
|      * 子部门 |      * 子部门 | ||||||
|      */ |      */ | ||||||
|     @TableField(exist = false) |     @TableField(exist = false) | ||||||
|     @ApiModelProperty(value = "子部门") |  | ||||||
|     private List<T> children = new ArrayList<>(); |     private List<T> children = new ArrayList<>(); | ||||||
|  |  | ||||||
| } | } | ||||||
|   | |||||||
| @@ -4,8 +4,6 @@ import com.baomidou.mybatisplus.annotation.TableId; | |||||||
| import com.baomidou.mybatisplus.annotation.TableLogic; | import com.baomidou.mybatisplus.annotation.TableLogic; | ||||||
| import com.baomidou.mybatisplus.annotation.TableName; | import com.baomidou.mybatisplus.annotation.TableName; | ||||||
| import com.ruoyi.common.core.domain.TreeEntity; | import com.ruoyi.common.core.domain.TreeEntity; | ||||||
| import io.swagger.annotations.ApiModel; |  | ||||||
| import io.swagger.annotations.ApiModelProperty; |  | ||||||
| import lombok.Data; | import lombok.Data; | ||||||
| import lombok.EqualsAndHashCode; | import lombok.EqualsAndHashCode; | ||||||
|  |  | ||||||
| @@ -23,21 +21,18 @@ import javax.validation.constraints.Size; | |||||||
| @Data | @Data | ||||||
| @EqualsAndHashCode(callSuper = true) | @EqualsAndHashCode(callSuper = true) | ||||||
| @TableName("sys_dept") | @TableName("sys_dept") | ||||||
| @ApiModel("部门业务对象") |  | ||||||
| public class SysDept extends TreeEntity<SysDept> { | public class SysDept extends TreeEntity<SysDept> { | ||||||
|     private static final long serialVersionUID = 1L; |     private static final long serialVersionUID = 1L; | ||||||
|  |  | ||||||
|     /** |     /** | ||||||
|      * 部门ID |      * 部门ID | ||||||
|      */ |      */ | ||||||
|     @ApiModelProperty(value = "部门id") |  | ||||||
|     @TableId(value = "dept_id") |     @TableId(value = "dept_id") | ||||||
|     private Long deptId; |     private Long deptId; | ||||||
|  |  | ||||||
|     /** |     /** | ||||||
|      * 部门名称 |      * 部门名称 | ||||||
|      */ |      */ | ||||||
|     @ApiModelProperty(value = "部门名称") |  | ||||||
|     @NotBlank(message = "部门名称不能为空") |     @NotBlank(message = "部门名称不能为空") | ||||||
|     @Size(min = 0, max = 30, message = "部门名称长度不能超过30个字符") |     @Size(min = 0, max = 30, message = "部门名称长度不能超过30个字符") | ||||||
|     private String deptName; |     private String deptName; | ||||||
| @@ -45,27 +40,23 @@ public class SysDept extends TreeEntity<SysDept> { | |||||||
|     /** |     /** | ||||||
|      * 显示顺序 |      * 显示顺序 | ||||||
|      */ |      */ | ||||||
|     @ApiModelProperty(value = "显示顺序") |  | ||||||
|     @NotNull(message = "显示顺序不能为空") |     @NotNull(message = "显示顺序不能为空") | ||||||
|     private Integer orderNum; |     private Integer orderNum; | ||||||
|  |  | ||||||
|     /** |     /** | ||||||
|      * 负责人 |      * 负责人 | ||||||
|      */ |      */ | ||||||
|     @ApiModelProperty(value = "负责人") |  | ||||||
|     private String leader; |     private String leader; | ||||||
|  |  | ||||||
|     /** |     /** | ||||||
|      * 联系电话 |      * 联系电话 | ||||||
|      */ |      */ | ||||||
|     @ApiModelProperty(value = "联系电话") |  | ||||||
|     @Size(min = 0, max = 11, message = "联系电话长度不能超过11个字符") |     @Size(min = 0, max = 11, message = "联系电话长度不能超过11个字符") | ||||||
|     private String phone; |     private String phone; | ||||||
|  |  | ||||||
|     /** |     /** | ||||||
|      * 邮箱 |      * 邮箱 | ||||||
|      */ |      */ | ||||||
|     @ApiModelProperty(value = "邮箱") |  | ||||||
|     @Email(message = "邮箱格式不正确") |     @Email(message = "邮箱格式不正确") | ||||||
|     @Size(min = 0, max = 50, message = "邮箱长度不能超过50个字符") |     @Size(min = 0, max = 50, message = "邮箱长度不能超过50个字符") | ||||||
|     private String email; |     private String email; | ||||||
| @@ -73,20 +64,17 @@ public class SysDept extends TreeEntity<SysDept> { | |||||||
|     /** |     /** | ||||||
|      * 部门状态:0正常,1停用 |      * 部门状态:0正常,1停用 | ||||||
|      */ |      */ | ||||||
|     @ApiModelProperty(value = "部门状态:0正常,1停用") |  | ||||||
|     private String status; |     private String status; | ||||||
|  |  | ||||||
|     /** |     /** | ||||||
|      * 删除标志(0代表存在 2代表删除) |      * 删除标志(0代表存在 2代表删除) | ||||||
|      */ |      */ | ||||||
|     @ApiModelProperty(value = "删除标志(0代表存在 2代表删除)") |  | ||||||
|     @TableLogic |     @TableLogic | ||||||
|     private String delFlag; |     private String delFlag; | ||||||
|  |  | ||||||
|     /** |     /** | ||||||
|      * 祖级列表 |      * 祖级列表 | ||||||
|      */ |      */ | ||||||
|     @ApiModelProperty(value = "祖级列表") |  | ||||||
|     private String ancestors; |     private String ancestors; | ||||||
|  |  | ||||||
| } | } | ||||||
|   | |||||||
| @@ -8,8 +8,6 @@ import com.ruoyi.common.annotation.ExcelDictFormat; | |||||||
| import com.ruoyi.common.constant.UserConstants; | import com.ruoyi.common.constant.UserConstants; | ||||||
| import com.ruoyi.common.convert.ExcelDictConvert; | import com.ruoyi.common.convert.ExcelDictConvert; | ||||||
| import com.ruoyi.common.core.domain.BaseEntity; | import com.ruoyi.common.core.domain.BaseEntity; | ||||||
| import io.swagger.annotations.ApiModel; |  | ||||||
| import io.swagger.annotations.ApiModelProperty; |  | ||||||
| import lombok.Data; | import lombok.Data; | ||||||
| import lombok.EqualsAndHashCode; | import lombok.EqualsAndHashCode; | ||||||
|  |  | ||||||
| @@ -26,13 +24,11 @@ import javax.validation.constraints.Size; | |||||||
| @EqualsAndHashCode(callSuper = true) | @EqualsAndHashCode(callSuper = true) | ||||||
| @TableName("sys_dict_data") | @TableName("sys_dict_data") | ||||||
| @ExcelIgnoreUnannotated | @ExcelIgnoreUnannotated | ||||||
| @ApiModel("字典数据业务对象") |  | ||||||
| public class SysDictData extends BaseEntity { | public class SysDictData extends BaseEntity { | ||||||
|  |  | ||||||
|     /** |     /** | ||||||
|      * 字典编码 |      * 字典编码 | ||||||
|      */ |      */ | ||||||
|     @ApiModelProperty(value = "字典编码") |  | ||||||
|     @ExcelProperty(value = "字典编码") |     @ExcelProperty(value = "字典编码") | ||||||
|     @TableId(value = "dict_code") |     @TableId(value = "dict_code") | ||||||
|     private Long dictCode; |     private Long dictCode; | ||||||
| @@ -40,14 +36,12 @@ public class SysDictData extends BaseEntity { | |||||||
|     /** |     /** | ||||||
|      * 字典排序 |      * 字典排序 | ||||||
|      */ |      */ | ||||||
|     @ApiModelProperty(value = "字典排序") |  | ||||||
|     @ExcelProperty(value = "字典排序") |     @ExcelProperty(value = "字典排序") | ||||||
|     private Integer dictSort; |     private Integer dictSort; | ||||||
|  |  | ||||||
|     /** |     /** | ||||||
|      * 字典标签 |      * 字典标签 | ||||||
|      */ |      */ | ||||||
|     @ApiModelProperty(value = "字典标签") |  | ||||||
|     @ExcelProperty(value = "字典标签") |     @ExcelProperty(value = "字典标签") | ||||||
|     @NotBlank(message = "字典标签不能为空") |     @NotBlank(message = "字典标签不能为空") | ||||||
|     @Size(min = 0, max = 100, message = "字典标签长度不能超过100个字符") |     @Size(min = 0, max = 100, message = "字典标签长度不能超过100个字符") | ||||||
| @@ -56,7 +50,6 @@ public class SysDictData extends BaseEntity { | |||||||
|     /** |     /** | ||||||
|      * 字典键值 |      * 字典键值 | ||||||
|      */ |      */ | ||||||
|     @ApiModelProperty(value = "字典键值") |  | ||||||
|     @ExcelProperty(value = "字典键值") |     @ExcelProperty(value = "字典键值") | ||||||
|     @NotBlank(message = "字典键值不能为空") |     @NotBlank(message = "字典键值不能为空") | ||||||
|     @Size(min = 0, max = 100, message = "字典键值长度不能超过100个字符") |     @Size(min = 0, max = 100, message = "字典键值长度不能超过100个字符") | ||||||
| @@ -65,7 +58,6 @@ public class SysDictData extends BaseEntity { | |||||||
|     /** |     /** | ||||||
|      * 字典类型 |      * 字典类型 | ||||||
|      */ |      */ | ||||||
|     @ApiModelProperty(value = "字典类型") |  | ||||||
|     @ExcelProperty(value = "字典类型") |     @ExcelProperty(value = "字典类型") | ||||||
|     @NotBlank(message = "字典类型不能为空") |     @NotBlank(message = "字典类型不能为空") | ||||||
|     @Size(min = 0, max = 100, message = "字典类型长度不能超过100个字符") |     @Size(min = 0, max = 100, message = "字典类型长度不能超过100个字符") | ||||||
| @@ -74,20 +66,17 @@ public class SysDictData extends BaseEntity { | |||||||
|     /** |     /** | ||||||
|      * 样式属性(其他样式扩展) |      * 样式属性(其他样式扩展) | ||||||
|      */ |      */ | ||||||
|     @ApiModelProperty(value = "样式属性(其他样式扩展)") |  | ||||||
|     @Size(min = 0, max = 100, message = "样式属性长度不能超过100个字符") |     @Size(min = 0, max = 100, message = "样式属性长度不能超过100个字符") | ||||||
|     private String cssClass; |     private String cssClass; | ||||||
|  |  | ||||||
|     /** |     /** | ||||||
|      * 表格字典样式 |      * 表格字典样式 | ||||||
|      */ |      */ | ||||||
|     @ApiModelProperty(value = "表格字典样式") |  | ||||||
|     private String listClass; |     private String listClass; | ||||||
|  |  | ||||||
|     /** |     /** | ||||||
|      * 是否默认(Y是 N否) |      * 是否默认(Y是 N否) | ||||||
|      */ |      */ | ||||||
|     @ApiModelProperty(value = "是否默认(Y是 N否)") |  | ||||||
|     @ExcelProperty(value = "是否默认", converter = ExcelDictConvert.class) |     @ExcelProperty(value = "是否默认", converter = ExcelDictConvert.class) | ||||||
|     @ExcelDictFormat(dictType = "sys_yes_no") |     @ExcelDictFormat(dictType = "sys_yes_no") | ||||||
|     private String isDefault; |     private String isDefault; | ||||||
| @@ -95,7 +84,6 @@ public class SysDictData extends BaseEntity { | |||||||
|     /** |     /** | ||||||
|      * 状态(0正常 1停用) |      * 状态(0正常 1停用) | ||||||
|      */ |      */ | ||||||
|     @ApiModelProperty(value = "状态(0正常 1停用)") |  | ||||||
|     @ExcelProperty(value = "状态", converter = ExcelDictConvert.class) |     @ExcelProperty(value = "状态", converter = ExcelDictConvert.class) | ||||||
|     @ExcelDictFormat(dictType = "sys_normal_disable") |     @ExcelDictFormat(dictType = "sys_normal_disable") | ||||||
|     private String status; |     private String status; | ||||||
| @@ -103,7 +91,6 @@ public class SysDictData extends BaseEntity { | |||||||
|     /** |     /** | ||||||
|      * 备注 |      * 备注 | ||||||
|      */ |      */ | ||||||
|     @ApiModelProperty(value = "备注") |  | ||||||
|     private String remark; |     private String remark; | ||||||
|  |  | ||||||
|     public boolean getDefault() { |     public boolean getDefault() { | ||||||
|   | |||||||
| @@ -7,11 +7,8 @@ import com.baomidou.mybatisplus.annotation.TableName; | |||||||
| import com.ruoyi.common.annotation.ExcelDictFormat; | import com.ruoyi.common.annotation.ExcelDictFormat; | ||||||
| import com.ruoyi.common.convert.ExcelDictConvert; | import com.ruoyi.common.convert.ExcelDictConvert; | ||||||
| import com.ruoyi.common.core.domain.BaseEntity; | import com.ruoyi.common.core.domain.BaseEntity; | ||||||
| import io.swagger.annotations.ApiModel; |  | ||||||
| import io.swagger.annotations.ApiModelProperty; |  | ||||||
| import lombok.Data; | import lombok.Data; | ||||||
| import lombok.EqualsAndHashCode; | import lombok.EqualsAndHashCode; | ||||||
| import lombok.experimental.Accessors; |  | ||||||
|  |  | ||||||
| import javax.validation.constraints.NotBlank; | import javax.validation.constraints.NotBlank; | ||||||
| import javax.validation.constraints.Pattern; | import javax.validation.constraints.Pattern; | ||||||
| @@ -27,13 +24,11 @@ import javax.validation.constraints.Size; | |||||||
| @EqualsAndHashCode(callSuper = true) | @EqualsAndHashCode(callSuper = true) | ||||||
| @TableName("sys_dict_type") | @TableName("sys_dict_type") | ||||||
| @ExcelIgnoreUnannotated | @ExcelIgnoreUnannotated | ||||||
| @ApiModel("字典类型业务对象") |  | ||||||
| public class SysDictType extends BaseEntity { | public class SysDictType extends BaseEntity { | ||||||
|  |  | ||||||
|     /** |     /** | ||||||
|      * 字典主键 |      * 字典主键 | ||||||
|      */ |      */ | ||||||
|     @ApiModelProperty(value = "字典主键") |  | ||||||
|     @ExcelProperty(value = "字典主键") |     @ExcelProperty(value = "字典主键") | ||||||
|     @TableId(value = "dict_id") |     @TableId(value = "dict_id") | ||||||
|     private Long dictId; |     private Long dictId; | ||||||
| @@ -41,7 +36,6 @@ public class SysDictType extends BaseEntity { | |||||||
|     /** |     /** | ||||||
|      * 字典名称 |      * 字典名称 | ||||||
|      */ |      */ | ||||||
|     @ApiModelProperty(value = "字典名称") |  | ||||||
|     @ExcelProperty(value = "字典名称") |     @ExcelProperty(value = "字典名称") | ||||||
|     @NotBlank(message = "字典名称不能为空") |     @NotBlank(message = "字典名称不能为空") | ||||||
|     @Size(min = 0, max = 100, message = "字典类型名称长度不能超过100个字符") |     @Size(min = 0, max = 100, message = "字典类型名称长度不能超过100个字符") | ||||||
| @@ -50,7 +44,6 @@ public class SysDictType extends BaseEntity { | |||||||
|     /** |     /** | ||||||
|      * 字典类型 |      * 字典类型 | ||||||
|      */ |      */ | ||||||
|     @ApiModelProperty(value = "字典类型") |  | ||||||
|     @ExcelProperty(value = "字典类型") |     @ExcelProperty(value = "字典类型") | ||||||
|     @NotBlank(message = "字典类型不能为空") |     @NotBlank(message = "字典类型不能为空") | ||||||
|     @Size(min = 0, max = 100, message = "字典类型类型长度不能超过100个字符") |     @Size(min = 0, max = 100, message = "字典类型类型长度不能超过100个字符") | ||||||
| @@ -60,7 +53,6 @@ public class SysDictType extends BaseEntity { | |||||||
|     /** |     /** | ||||||
|      * 状态(0正常 1停用) |      * 状态(0正常 1停用) | ||||||
|      */ |      */ | ||||||
|     @ApiModelProperty(value = "状态(0正常 1停用)") |  | ||||||
|     @ExcelProperty(value = "状态", converter = ExcelDictConvert.class) |     @ExcelProperty(value = "状态", converter = ExcelDictConvert.class) | ||||||
|     @ExcelDictFormat(dictType = "sys_normal_disable") |     @ExcelDictFormat(dictType = "sys_normal_disable") | ||||||
|     private String status; |     private String status; | ||||||
| @@ -68,7 +60,6 @@ public class SysDictType extends BaseEntity { | |||||||
|     /** |     /** | ||||||
|      * 备注 |      * 备注 | ||||||
|      */ |      */ | ||||||
|     @ApiModelProperty(value = "备注") |  | ||||||
|     private String remark; |     private String remark; | ||||||
|  |  | ||||||
| } | } | ||||||
|   | |||||||
| @@ -4,8 +4,6 @@ import com.baomidou.mybatisplus.annotation.TableId; | |||||||
| import com.baomidou.mybatisplus.annotation.TableName; | import com.baomidou.mybatisplus.annotation.TableName; | ||||||
| import com.fasterxml.jackson.annotation.JsonInclude; | import com.fasterxml.jackson.annotation.JsonInclude; | ||||||
| import com.ruoyi.common.core.domain.TreeEntity; | import com.ruoyi.common.core.domain.TreeEntity; | ||||||
| import io.swagger.annotations.ApiModel; |  | ||||||
| import io.swagger.annotations.ApiModelProperty; |  | ||||||
| import lombok.Data; | import lombok.Data; | ||||||
| import lombok.EqualsAndHashCode; | import lombok.EqualsAndHashCode; | ||||||
|  |  | ||||||
| @@ -22,20 +20,17 @@ import javax.validation.constraints.Size; | |||||||
| @Data | @Data | ||||||
| @EqualsAndHashCode(callSuper = true) | @EqualsAndHashCode(callSuper = true) | ||||||
| @TableName("sys_menu") | @TableName("sys_menu") | ||||||
| @ApiModel("菜单权限业务对象") |  | ||||||
| public class SysMenu extends TreeEntity<SysMenu> { | public class SysMenu extends TreeEntity<SysMenu> { | ||||||
|  |  | ||||||
|     /** |     /** | ||||||
|      * 菜单ID |      * 菜单ID | ||||||
|      */ |      */ | ||||||
|     @ApiModelProperty(value = "菜单ID") |  | ||||||
|     @TableId(value = "menu_id") |     @TableId(value = "menu_id") | ||||||
|     private Long menuId; |     private Long menuId; | ||||||
|  |  | ||||||
|     /** |     /** | ||||||
|      * 菜单名称 |      * 菜单名称 | ||||||
|      */ |      */ | ||||||
|     @ApiModelProperty(value = "菜单名称") |  | ||||||
|     @NotBlank(message = "菜单名称不能为空") |     @NotBlank(message = "菜单名称不能为空") | ||||||
|     @Size(min = 0, max = 50, message = "菜单名称长度不能超过50个字符") |     @Size(min = 0, max = 50, message = "菜单名称长度不能超过50个字符") | ||||||
|     private String menuName; |     private String menuName; | ||||||
| @@ -43,65 +38,55 @@ public class SysMenu extends TreeEntity<SysMenu> { | |||||||
|     /** |     /** | ||||||
|      * 显示顺序 |      * 显示顺序 | ||||||
|      */ |      */ | ||||||
|     @ApiModelProperty(value = "显示顺序") |  | ||||||
|     @NotNull(message = "显示顺序不能为空") |     @NotNull(message = "显示顺序不能为空") | ||||||
|     private Integer orderNum; |     private Integer orderNum; | ||||||
|  |  | ||||||
|     /** |     /** | ||||||
|      * 路由地址 |      * 路由地址 | ||||||
|      */ |      */ | ||||||
|     @ApiModelProperty(value = "路由地址") |  | ||||||
|     @Size(min = 0, max = 200, message = "路由地址不能超过200个字符") |     @Size(min = 0, max = 200, message = "路由地址不能超过200个字符") | ||||||
|     private String path; |     private String path; | ||||||
|  |  | ||||||
|     /** |     /** | ||||||
|      * 组件路径 |      * 组件路径 | ||||||
|      */ |      */ | ||||||
|     @ApiModelProperty(value = "组件路径") |  | ||||||
|     @Size(min = 0, max = 200, message = "组件路径不能超过255个字符") |     @Size(min = 0, max = 200, message = "组件路径不能超过255个字符") | ||||||
|     private String component; |     private String component; | ||||||
|  |  | ||||||
|     /** |     /** | ||||||
|      * 路由参数 |      * 路由参数 | ||||||
|      */ |      */ | ||||||
|     @ApiModelProperty(value = "路由参数") |  | ||||||
|     private String queryParam; |     private String queryParam; | ||||||
|  |  | ||||||
|     /** |     /** | ||||||
|      * 是否为外链(0是 1否) |      * 是否为外链(0是 1否) | ||||||
|      */ |      */ | ||||||
|     @ApiModelProperty(value = "是否为外链(0是 1否)") |  | ||||||
|     private String isFrame; |     private String isFrame; | ||||||
|  |  | ||||||
|     /** |     /** | ||||||
|      * 是否缓存(0缓存 1不缓存) |      * 是否缓存(0缓存 1不缓存) | ||||||
|      */ |      */ | ||||||
|     @ApiModelProperty(value = "是否缓存(0缓存 1不缓存)") |  | ||||||
|     private String isCache; |     private String isCache; | ||||||
|  |  | ||||||
|     /** |     /** | ||||||
|      * 类型(M目录 C菜单 F按钮) |      * 类型(M目录 C菜单 F按钮) | ||||||
|      */ |      */ | ||||||
|     @ApiModelProperty(value = "类型(M目录 C菜单 F按钮)") |  | ||||||
|     @NotBlank(message = "菜单类型不能为空") |     @NotBlank(message = "菜单类型不能为空") | ||||||
|     private String menuType; |     private String menuType; | ||||||
|  |  | ||||||
|     /** |     /** | ||||||
|      * 显示状态(0显示 1隐藏) |      * 显示状态(0显示 1隐藏) | ||||||
|      */ |      */ | ||||||
|     @ApiModelProperty(value = "显示状态(0显示 1隐藏)") |  | ||||||
|     private String visible; |     private String visible; | ||||||
|  |  | ||||||
|     /** |     /** | ||||||
|      * 菜单状态(0显示 1隐藏) |      * 菜单状态(0显示 1隐藏) | ||||||
|      */ |      */ | ||||||
|     @ApiModelProperty(value = "菜单状态(0显示 1隐藏)") |  | ||||||
|     private String status; |     private String status; | ||||||
|  |  | ||||||
|     /** |     /** | ||||||
|      * 权限字符串 |      * 权限字符串 | ||||||
|      */ |      */ | ||||||
|     @ApiModelProperty(value = "权限字符串") |  | ||||||
|     @JsonInclude(JsonInclude.Include.NON_NULL) |     @JsonInclude(JsonInclude.Include.NON_NULL) | ||||||
|     @Size(min = 0, max = 100, message = "权限标识长度不能超过100个字符") |     @Size(min = 0, max = 100, message = "权限标识长度不能超过100个字符") | ||||||
|     private String perms; |     private String perms; | ||||||
| @@ -109,13 +94,11 @@ public class SysMenu extends TreeEntity<SysMenu> { | |||||||
|     /** |     /** | ||||||
|      * 菜单图标 |      * 菜单图标 | ||||||
|      */ |      */ | ||||||
|     @ApiModelProperty(value = "菜单图标") |  | ||||||
|     private String icon; |     private String icon; | ||||||
|  |  | ||||||
|     /** |     /** | ||||||
|      * 备注 |      * 备注 | ||||||
|      */ |      */ | ||||||
|     @ApiModelProperty(value = "备注") |  | ||||||
|     private String remark; |     private String remark; | ||||||
|  |  | ||||||
| } | } | ||||||
|   | |||||||
| @@ -10,7 +10,6 @@ import com.ruoyi.common.annotation.ExcelDictFormat; | |||||||
| import com.ruoyi.common.constant.UserConstants; | import com.ruoyi.common.constant.UserConstants; | ||||||
| import com.ruoyi.common.convert.ExcelDictConvert; | import com.ruoyi.common.convert.ExcelDictConvert; | ||||||
| import com.ruoyi.common.core.domain.BaseEntity; | import com.ruoyi.common.core.domain.BaseEntity; | ||||||
| import io.swagger.annotations.ApiModelProperty; |  | ||||||
| import lombok.Data; | import lombok.Data; | ||||||
| import lombok.EqualsAndHashCode; | import lombok.EqualsAndHashCode; | ||||||
| import lombok.NoArgsConstructor; | import lombok.NoArgsConstructor; | ||||||
| @@ -35,7 +34,6 @@ public class SysRole extends BaseEntity { | |||||||
|     /** |     /** | ||||||
|      * 角色ID |      * 角色ID | ||||||
|      */ |      */ | ||||||
|     @ApiModelProperty(value = "角色ID") |  | ||||||
|     @ExcelProperty(value = "角色序号") |     @ExcelProperty(value = "角色序号") | ||||||
|     @TableId(value = "role_id") |     @TableId(value = "role_id") | ||||||
|     private Long roleId; |     private Long roleId; | ||||||
| @@ -43,7 +41,6 @@ public class SysRole extends BaseEntity { | |||||||
|     /** |     /** | ||||||
|      * 角色名称 |      * 角色名称 | ||||||
|      */ |      */ | ||||||
|     @ApiModelProperty(value = "角色名称") |  | ||||||
|     @ExcelProperty(value = "角色名称") |     @ExcelProperty(value = "角色名称") | ||||||
|     @NotBlank(message = "角色名称不能为空") |     @NotBlank(message = "角色名称不能为空") | ||||||
|     @Size(min = 0, max = 30, message = "角色名称长度不能超过30个字符") |     @Size(min = 0, max = 30, message = "角色名称长度不能超过30个字符") | ||||||
| @@ -52,7 +49,6 @@ public class SysRole extends BaseEntity { | |||||||
|     /** |     /** | ||||||
|      * 角色权限 |      * 角色权限 | ||||||
|      */ |      */ | ||||||
|     @ApiModelProperty(value = "角色权限") |  | ||||||
|     @ExcelProperty(value = "角色权限") |     @ExcelProperty(value = "角色权限") | ||||||
|     @NotBlank(message = "权限字符不能为空") |     @NotBlank(message = "权限字符不能为空") | ||||||
|     @Size(min = 0, max = 100, message = "权限字符长度不能超过100个字符") |     @Size(min = 0, max = 100, message = "权限字符长度不能超过100个字符") | ||||||
| @@ -61,7 +57,6 @@ public class SysRole extends BaseEntity { | |||||||
|     /** |     /** | ||||||
|      * 角色排序 |      * 角色排序 | ||||||
|      */ |      */ | ||||||
|     @ApiModelProperty(value = "角色排序") |  | ||||||
|     @ExcelProperty(value = "角色排序") |     @ExcelProperty(value = "角色排序") | ||||||
|     @NotNull(message = "显示顺序不能为空") |     @NotNull(message = "显示顺序不能为空") | ||||||
|     private Integer roleSort; |     private Integer roleSort; | ||||||
| @@ -69,7 +64,6 @@ public class SysRole extends BaseEntity { | |||||||
|     /** |     /** | ||||||
|      * 数据范围(1:所有数据权限;2:自定义数据权限;3:本部门数据权限;4:本部门及以下数据权限;5:仅本人数据权限) |      * 数据范围(1:所有数据权限;2:自定义数据权限;3:本部门数据权限;4:本部门及以下数据权限;5:仅本人数据权限) | ||||||
|      */ |      */ | ||||||
|     @ApiModelProperty(value = "数据范围(1:所有数据权限;2:自定义数据权限;3:本部门数据权限;4:本部门及以下数据权限;5:仅本人数据权限)") |  | ||||||
|     @ExcelProperty(value = "数据范围", converter = ExcelDictConvert.class) |     @ExcelProperty(value = "数据范围", converter = ExcelDictConvert.class) | ||||||
|     @ExcelDictFormat(readConverterExp = "1=所有数据权限,2=自定义数据权限,3=本部门数据权限,4=本部门及以下数据权限,5=仅本人数据权限") |     @ExcelDictFormat(readConverterExp = "1=所有数据权限,2=自定义数据权限,3=本部门数据权限,4=本部门及以下数据权限,5=仅本人数据权限") | ||||||
|     private String dataScope; |     private String dataScope; | ||||||
| @@ -77,19 +71,16 @@ public class SysRole extends BaseEntity { | |||||||
|     /** |     /** | ||||||
|      * 菜单树选择项是否关联显示( 0:父子不互相关联显示 1:父子互相关联显示) |      * 菜单树选择项是否关联显示( 0:父子不互相关联显示 1:父子互相关联显示) | ||||||
|      */ |      */ | ||||||
|     @ApiModelProperty(value = "菜单树选择项是否关联显示( 0:父子不互相关联显示 1:父子互相关联显示)") |  | ||||||
|     private Boolean menuCheckStrictly; |     private Boolean menuCheckStrictly; | ||||||
|  |  | ||||||
|     /** |     /** | ||||||
|      * 部门树选择项是否关联显示(0:父子不互相关联显示 1:父子互相关联显示 ) |      * 部门树选择项是否关联显示(0:父子不互相关联显示 1:父子互相关联显示 ) | ||||||
|      */ |      */ | ||||||
|     @ApiModelProperty(value = "部门树选择项是否关联显示(0:父子不互相关联显示 1:父子互相关联显示 )") |  | ||||||
|     private Boolean deptCheckStrictly; |     private Boolean deptCheckStrictly; | ||||||
|  |  | ||||||
|     /** |     /** | ||||||
|      * 角色状态(0正常 1停用) |      * 角色状态(0正常 1停用) | ||||||
|      */ |      */ | ||||||
|     @ApiModelProperty(value = "角色状态(0正常 1停用)") |  | ||||||
|     @ExcelProperty(value = "角色状态", converter = ExcelDictConvert.class) |     @ExcelProperty(value = "角色状态", converter = ExcelDictConvert.class) | ||||||
|     @ExcelDictFormat(dictType = "sys_common_status") |     @ExcelDictFormat(dictType = "sys_common_status") | ||||||
|     private String status; |     private String status; | ||||||
| @@ -97,34 +88,29 @@ public class SysRole extends BaseEntity { | |||||||
|     /** |     /** | ||||||
|      * 删除标志(0代表存在 2代表删除) |      * 删除标志(0代表存在 2代表删除) | ||||||
|      */ |      */ | ||||||
|     @ApiModelProperty(value = "删除标志(0代表存在 2代表删除)") |  | ||||||
|     @TableLogic |     @TableLogic | ||||||
|     private String delFlag; |     private String delFlag; | ||||||
|  |  | ||||||
|     /** |     /** | ||||||
|      * 备注 |      * 备注 | ||||||
|      */ |      */ | ||||||
|     @ApiModelProperty(value = "备注") |  | ||||||
|     private String remark; |     private String remark; | ||||||
|  |  | ||||||
|     /** |     /** | ||||||
|      * 用户是否存在此角色标识 默认不存在 |      * 用户是否存在此角色标识 默认不存在 | ||||||
|      */ |      */ | ||||||
|     @ApiModelProperty(value = "用户是否存在此角色标识 默认不存在") |  | ||||||
|     @TableField(exist = false) |     @TableField(exist = false) | ||||||
|     private boolean flag = false; |     private boolean flag = false; | ||||||
|  |  | ||||||
|     /** |     /** | ||||||
|      * 菜单组 |      * 菜单组 | ||||||
|      */ |      */ | ||||||
|     @ApiModelProperty(value = "菜单组") |  | ||||||
|     @TableField(exist = false) |     @TableField(exist = false) | ||||||
|     private Long[] menuIds; |     private Long[] menuIds; | ||||||
|  |  | ||||||
|     /** |     /** | ||||||
|      * 部门组(数据权限) |      * 部门组(数据权限) | ||||||
|      */ |      */ | ||||||
|     @ApiModelProperty(value = "部门组(数据权限)") |  | ||||||
|     @TableField(exist = false) |     @TableField(exist = false) | ||||||
|     private Long[] deptIds; |     private Long[] deptIds; | ||||||
|  |  | ||||||
| @@ -132,7 +118,6 @@ public class SysRole extends BaseEntity { | |||||||
|         this.roleId = roleId; |         this.roleId = roleId; | ||||||
|     } |     } | ||||||
|  |  | ||||||
|     @ApiModelProperty(value = "是否管理员") |  | ||||||
|     public boolean isAdmin() { |     public boolean isAdmin() { | ||||||
|         return UserConstants.ADMIN_ID.equals(this.roleId); |         return UserConstants.ADMIN_ID.equals(this.roleId); | ||||||
|     } |     } | ||||||
|   | |||||||
| @@ -1,15 +1,11 @@ | |||||||
| package com.ruoyi.common.core.domain.entity; | package com.ruoyi.common.core.domain.entity; | ||||||
|  |  | ||||||
| import com.baomidou.mybatisplus.annotation.*; | import com.baomidou.mybatisplus.annotation.*; | ||||||
| import com.fasterxml.jackson.annotation.JsonIgnore; |  | ||||||
| import com.fasterxml.jackson.annotation.JsonProperty; |  | ||||||
| import com.ruoyi.common.annotation.Sensitive; | import com.ruoyi.common.annotation.Sensitive; | ||||||
| import com.ruoyi.common.constant.UserConstants; | import com.ruoyi.common.constant.UserConstants; | ||||||
| import com.ruoyi.common.core.domain.BaseEntity; | import com.ruoyi.common.core.domain.BaseEntity; | ||||||
| import com.ruoyi.common.enums.SensitiveStrategy; | import com.ruoyi.common.enums.SensitiveStrategy; | ||||||
| import com.ruoyi.common.xss.Xss; | import com.ruoyi.common.xss.Xss; | ||||||
| import io.swagger.annotations.ApiModel; |  | ||||||
| import io.swagger.annotations.ApiModelProperty; |  | ||||||
| import lombok.Data; | import lombok.Data; | ||||||
| import lombok.EqualsAndHashCode; | import lombok.EqualsAndHashCode; | ||||||
| import lombok.NoArgsConstructor; | import lombok.NoArgsConstructor; | ||||||
| @@ -30,26 +26,22 @@ import java.util.List; | |||||||
| @NoArgsConstructor | @NoArgsConstructor | ||||||
| @EqualsAndHashCode(callSuper = true) | @EqualsAndHashCode(callSuper = true) | ||||||
| @TableName("sys_user") | @TableName("sys_user") | ||||||
| @ApiModel("用户信息业务对象") |  | ||||||
| public class SysUser extends BaseEntity { | public class SysUser extends BaseEntity { | ||||||
|  |  | ||||||
|     /** |     /** | ||||||
|      * 用户ID |      * 用户ID | ||||||
|      */ |      */ | ||||||
|     @ApiModelProperty(value = "用户ID") |  | ||||||
|     @TableId(value = "user_id") |     @TableId(value = "user_id") | ||||||
|     private Long userId; |     private Long userId; | ||||||
|  |  | ||||||
|     /** |     /** | ||||||
|      * 部门ID |      * 部门ID | ||||||
|      */ |      */ | ||||||
|     @ApiModelProperty(value = "部门ID") |  | ||||||
|     private Long deptId; |     private Long deptId; | ||||||
|  |  | ||||||
|     /** |     /** | ||||||
|      * 用户账号 |      * 用户账号 | ||||||
|      */ |      */ | ||||||
|     @ApiModelProperty(value = "用户账号") |  | ||||||
|     @Xss(message = "用户账号不能包含脚本字符") |     @Xss(message = "用户账号不能包含脚本字符") | ||||||
|     @NotBlank(message = "用户账号不能为空") |     @NotBlank(message = "用户账号不能为空") | ||||||
|     @Size(min = 0, max = 30, message = "用户账号长度不能超过30个字符") |     @Size(min = 0, max = 30, message = "用户账号长度不能超过30个字符") | ||||||
| @@ -58,7 +50,6 @@ public class SysUser extends BaseEntity { | |||||||
|     /** |     /** | ||||||
|      * 用户昵称 |      * 用户昵称 | ||||||
|      */ |      */ | ||||||
|     @ApiModelProperty(value = "用户昵称") |  | ||||||
|     @Xss(message = "用户昵称不能包含脚本字符") |     @Xss(message = "用户昵称不能包含脚本字符") | ||||||
|     @Size(min = 0, max = 30, message = "用户昵称长度不能超过30个字符") |     @Size(min = 0, max = 30, message = "用户昵称长度不能超过30个字符") | ||||||
|     private String nickName; |     private String nickName; | ||||||
| @@ -66,14 +57,12 @@ public class SysUser extends BaseEntity { | |||||||
|     /** |     /** | ||||||
|      * 用户类型(sys_user系统用户) |      * 用户类型(sys_user系统用户) | ||||||
|      */ |      */ | ||||||
|     @ApiModelProperty(value = "用户类型") |  | ||||||
|     private String userType; |     private String userType; | ||||||
|  |  | ||||||
|     /** |     /** | ||||||
|      * 用户邮箱 |      * 用户邮箱 | ||||||
|      */ |      */ | ||||||
|     @Sensitive(strategy = SensitiveStrategy.EMAIL) |     @Sensitive(strategy = SensitiveStrategy.EMAIL) | ||||||
|     @ApiModelProperty(value = "用户邮箱") |  | ||||||
|     @Email(message = "邮箱格式不正确") |     @Email(message = "邮箱格式不正确") | ||||||
|     @Size(min = 0, max = 50, message = "邮箱长度不能超过50个字符") |     @Size(min = 0, max = 50, message = "邮箱长度不能超过50个字符") | ||||||
|     private String email; |     private String email; | ||||||
| @@ -82,25 +71,21 @@ public class SysUser extends BaseEntity { | |||||||
|      * 手机号码 |      * 手机号码 | ||||||
|      */ |      */ | ||||||
|     @Sensitive(strategy = SensitiveStrategy.PHONE) |     @Sensitive(strategy = SensitiveStrategy.PHONE) | ||||||
|     @ApiModelProperty(value = "手机号码") |  | ||||||
|     private String phonenumber; |     private String phonenumber; | ||||||
|  |  | ||||||
|     /** |     /** | ||||||
|      * 用户性别 |      * 用户性别 | ||||||
|      */ |      */ | ||||||
|     @ApiModelProperty(value = "用户性别") |  | ||||||
|     private String sex; |     private String sex; | ||||||
|  |  | ||||||
|     /** |     /** | ||||||
|      * 用户头像 |      * 用户头像 | ||||||
|      */ |      */ | ||||||
|     @ApiModelProperty(value = "用户头像") |  | ||||||
|     private String avatar; |     private String avatar; | ||||||
|  |  | ||||||
|     /** |     /** | ||||||
|      * 密码 |      * 密码 | ||||||
|      */ |      */ | ||||||
|     @ApiModelProperty(value = "密码") |  | ||||||
|     @TableField( |     @TableField( | ||||||
|         insertStrategy = FieldStrategy.NOT_EMPTY, |         insertStrategy = FieldStrategy.NOT_EMPTY, | ||||||
|         updateStrategy = FieldStrategy.NOT_EMPTY, |         updateStrategy = FieldStrategy.NOT_EMPTY, | ||||||
| @@ -111,66 +96,56 @@ public class SysUser extends BaseEntity { | |||||||
|     /** |     /** | ||||||
|      * 帐号状态(0正常 1停用) |      * 帐号状态(0正常 1停用) | ||||||
|      */ |      */ | ||||||
|     @ApiModelProperty(value = "帐号状态(0正常 1停用)") |  | ||||||
|     private String status; |     private String status; | ||||||
|  |  | ||||||
|     /** |     /** | ||||||
|      * 删除标志(0代表存在 2代表删除) |      * 删除标志(0代表存在 2代表删除) | ||||||
|      */ |      */ | ||||||
|     @ApiModelProperty(value = "删除标志(0代表存在 2代表删除)") |  | ||||||
|     @TableLogic |     @TableLogic | ||||||
|     private String delFlag; |     private String delFlag; | ||||||
|  |  | ||||||
|     /** |     /** | ||||||
|      * 最后登录IP |      * 最后登录IP | ||||||
|      */ |      */ | ||||||
|     @ApiModelProperty(value = "最后登录IP") |  | ||||||
|     private String loginIp; |     private String loginIp; | ||||||
|  |  | ||||||
|     /** |     /** | ||||||
|      * 最后登录时间 |      * 最后登录时间 | ||||||
|      */ |      */ | ||||||
|     @ApiModelProperty(value = "最后登录时间") |  | ||||||
|     private Date loginDate; |     private Date loginDate; | ||||||
|  |  | ||||||
|     /** |     /** | ||||||
|      * 备注 |      * 备注 | ||||||
|      */ |      */ | ||||||
|     @ApiModelProperty(value = "备注") |  | ||||||
|     private String remark; |     private String remark; | ||||||
|  |  | ||||||
|     /** |     /** | ||||||
|      * 部门对象 |      * 部门对象 | ||||||
|      */ |      */ | ||||||
|     @ApiModelProperty(value = "部门对象") |  | ||||||
|     @TableField(exist = false) |     @TableField(exist = false) | ||||||
|     private SysDept dept; |     private SysDept dept; | ||||||
|  |  | ||||||
|     /** |     /** | ||||||
|      * 角色对象 |      * 角色对象 | ||||||
|      */ |      */ | ||||||
|     @ApiModelProperty(value = "角色对象") |  | ||||||
|     @TableField(exist = false) |     @TableField(exist = false) | ||||||
|     private List<SysRole> roles; |     private List<SysRole> roles; | ||||||
|  |  | ||||||
|     /** |     /** | ||||||
|      * 角色组 |      * 角色组 | ||||||
|      */ |      */ | ||||||
|     @ApiModelProperty(value = "角色组") |  | ||||||
|     @TableField(exist = false) |     @TableField(exist = false) | ||||||
|     private Long[] roleIds; |     private Long[] roleIds; | ||||||
|  |  | ||||||
|     /** |     /** | ||||||
|      * 岗位组 |      * 岗位组 | ||||||
|      */ |      */ | ||||||
|     @ApiModelProperty(value = "岗位组") |  | ||||||
|     @TableField(exist = false) |     @TableField(exist = false) | ||||||
|     private Long[] postIds; |     private Long[] postIds; | ||||||
|  |  | ||||||
|     /** |     /** | ||||||
|      * 数据权限 当前角色ID |      * 数据权限 当前角色ID | ||||||
|      */ |      */ | ||||||
|     @ApiModelProperty(value = "角色ID") |  | ||||||
|     @TableField(exist = false) |     @TableField(exist = false) | ||||||
|     private Long roleId; |     private Long roleId; | ||||||
|  |  | ||||||
| @@ -178,7 +153,6 @@ public class SysUser extends BaseEntity { | |||||||
|         this.userId = userId; |         this.userId = userId; | ||||||
|     } |     } | ||||||
|  |  | ||||||
|     @ApiModelProperty(value = "是否管理员") |  | ||||||
|     public boolean isAdmin() { |     public boolean isAdmin() { | ||||||
|         return UserConstants.ADMIN_ID.equals(this.userId); |         return UserConstants.ADMIN_ID.equals(this.userId); | ||||||
|     } |     } | ||||||
|   | |||||||
| @@ -1,8 +1,6 @@ | |||||||
| package com.ruoyi.common.core.domain.model; | package com.ruoyi.common.core.domain.model; | ||||||
|  |  | ||||||
| import com.ruoyi.common.constant.UserConstants; | import com.ruoyi.common.constant.UserConstants; | ||||||
| import io.swagger.annotations.ApiModel; |  | ||||||
| import io.swagger.annotations.ApiModelProperty; |  | ||||||
| import lombok.Data; | import lombok.Data; | ||||||
| import org.hibernate.validator.constraints.Length; | import org.hibernate.validator.constraints.Length; | ||||||
|  |  | ||||||
| @@ -15,7 +13,6 @@ import javax.validation.constraints.NotBlank; | |||||||
|  */ |  */ | ||||||
|  |  | ||||||
| @Data | @Data | ||||||
| @ApiModel("用户登录对象") |  | ||||||
| public class LoginBody { | public class LoginBody { | ||||||
|  |  | ||||||
|     /** |     /** | ||||||
| @@ -23,7 +20,6 @@ public class LoginBody { | |||||||
|      */ |      */ | ||||||
|     @NotBlank(message = "{user.username.not.blank}") |     @NotBlank(message = "{user.username.not.blank}") | ||||||
|     @Length(min = UserConstants.USERNAME_MIN_LENGTH, max = UserConstants.USERNAME_MAX_LENGTH, message = "{user.username.length.valid}") |     @Length(min = UserConstants.USERNAME_MIN_LENGTH, max = UserConstants.USERNAME_MAX_LENGTH, message = "{user.username.length.valid}") | ||||||
|     @ApiModelProperty(value = "用户名") |  | ||||||
|     private String username; |     private String username; | ||||||
|  |  | ||||||
|     /** |     /** | ||||||
| @@ -31,19 +27,16 @@ public class LoginBody { | |||||||
|      */ |      */ | ||||||
|     @NotBlank(message = "{user.password.not.blank}") |     @NotBlank(message = "{user.password.not.blank}") | ||||||
|     @Length(min = UserConstants.PASSWORD_MIN_LENGTH, max = UserConstants.PASSWORD_MAX_LENGTH, message = "{user.password.length.valid}") |     @Length(min = UserConstants.PASSWORD_MIN_LENGTH, max = UserConstants.PASSWORD_MAX_LENGTH, message = "{user.password.length.valid}") | ||||||
|     @ApiModelProperty(value = "用户密码") |  | ||||||
|     private String password; |     private String password; | ||||||
|  |  | ||||||
|     /** |     /** | ||||||
|      * 验证码 |      * 验证码 | ||||||
|      */ |      */ | ||||||
|     @ApiModelProperty(value = "验证码") |  | ||||||
|     private String code; |     private String code; | ||||||
|  |  | ||||||
|     /** |     /** | ||||||
|      * 唯一标识 |      * 唯一标识 | ||||||
|      */ |      */ | ||||||
|     @ApiModelProperty(value = "唯一标识") |  | ||||||
|     private String uuid; |     private String uuid; | ||||||
|  |  | ||||||
| } | } | ||||||
|   | |||||||
| @@ -105,6 +105,12 @@ public class LoginUser implements Serializable { | |||||||
|      * 获取登录id |      * 获取登录id | ||||||
|      */ |      */ | ||||||
|     public String getLoginId() { |     public String getLoginId() { | ||||||
|  |         if (userType == null) { | ||||||
|  |             throw new IllegalArgumentException("用户类型不能为空"); | ||||||
|  |         } | ||||||
|  |         if (userId == null) { | ||||||
|  |             throw new IllegalArgumentException("用户ID不能为空"); | ||||||
|  |         } | ||||||
|         return userType + LoginHelper.JOIN_CODE + userId; |         return userType + LoginHelper.JOIN_CODE + userId; | ||||||
|     } |     } | ||||||
|  |  | ||||||
|   | |||||||
| @@ -1,7 +1,5 @@ | |||||||
| package com.ruoyi.common.core.domain.model; | package com.ruoyi.common.core.domain.model; | ||||||
|  |  | ||||||
| import io.swagger.annotations.ApiModel; |  | ||||||
| import io.swagger.annotations.ApiModelProperty; |  | ||||||
| import lombok.Data; | import lombok.Data; | ||||||
| import lombok.EqualsAndHashCode; | import lombok.EqualsAndHashCode; | ||||||
|  |  | ||||||
| @@ -12,10 +10,8 @@ import lombok.EqualsAndHashCode; | |||||||
|  */ |  */ | ||||||
| @Data | @Data | ||||||
| @EqualsAndHashCode(callSuper = true) | @EqualsAndHashCode(callSuper = true) | ||||||
| @ApiModel("用户注册对象") |  | ||||||
| public class RegisterBody extends LoginBody { | public class RegisterBody extends LoginBody { | ||||||
|  |  | ||||||
|     @ApiModelProperty(value = "用户类型") |  | ||||||
|     private String userType; |     private String userType; | ||||||
|  |  | ||||||
| } | } | ||||||
|   | |||||||
| @@ -1,7 +1,5 @@ | |||||||
| package com.ruoyi.common.core.domain.model; | package com.ruoyi.common.core.domain.model; | ||||||
|  |  | ||||||
| import io.swagger.annotations.ApiModel; |  | ||||||
| import io.swagger.annotations.ApiModelProperty; |  | ||||||
| import lombok.Data; | import lombok.Data; | ||||||
|  |  | ||||||
| import javax.validation.constraints.NotBlank; | import javax.validation.constraints.NotBlank; | ||||||
| @@ -13,21 +11,18 @@ import javax.validation.constraints.NotBlank; | |||||||
|  */ |  */ | ||||||
|  |  | ||||||
| @Data | @Data | ||||||
| @ApiModel("短信登录对象") |  | ||||||
| public class SmsLoginBody { | public class SmsLoginBody { | ||||||
|  |  | ||||||
|     /** |     /** | ||||||
|      * 用户名 |      * 用户名 | ||||||
|      */ |      */ | ||||||
|     @NotBlank(message = "{user.phonenumber.not.blank}") |     @NotBlank(message = "{user.phonenumber.not.blank}") | ||||||
|     @ApiModelProperty(value = "用户手机号") |  | ||||||
|     private String phonenumber; |     private String phonenumber; | ||||||
|  |  | ||||||
|     /** |     /** | ||||||
|      * 用户密码 |      * 用户密码 | ||||||
|      */ |      */ | ||||||
|     @NotBlank(message = "{sms.code.not.blank}") |     @NotBlank(message = "{sms.code.not.blank}") | ||||||
|     @ApiModelProperty(value = "短信验证码") |  | ||||||
|     private String smsCode; |     private String smsCode; | ||||||
|  |  | ||||||
| } | } | ||||||
|   | |||||||
| @@ -149,7 +149,7 @@ public interface BaseMapperPlus<M, T, V> extends BaseMapper<T> { | |||||||
|         return BeanCopyUtils.copy(obj, voClass); |         return BeanCopyUtils.copy(obj, voClass); | ||||||
|     } |     } | ||||||
|  |  | ||||||
|     default List<V> selectVoById(Collection<? extends Serializable> idList) { |     default List<V> selectVoBatchIds(Collection<? extends Serializable> idList) { | ||||||
|         return selectVoBatchIds(idList, this.currentVoClass()); |         return selectVoBatchIds(idList, this.currentVoClass()); | ||||||
|     } |     } | ||||||
|  |  | ||||||
|   | |||||||
| @@ -2,11 +2,8 @@ package com.ruoyi.common.core.page; | |||||||
|  |  | ||||||
| import cn.hutool.http.HttpStatus; | import cn.hutool.http.HttpStatus; | ||||||
| import com.baomidou.mybatisplus.core.metadata.IPage; | import com.baomidou.mybatisplus.core.metadata.IPage; | ||||||
| import io.swagger.annotations.ApiModel; |  | ||||||
| import io.swagger.annotations.ApiModelProperty; |  | ||||||
| import lombok.Data; | import lombok.Data; | ||||||
| import lombok.NoArgsConstructor; | import lombok.NoArgsConstructor; | ||||||
| import lombok.experimental.Accessors; |  | ||||||
|  |  | ||||||
| import java.io.Serializable; | import java.io.Serializable; | ||||||
| import java.util.List; | import java.util.List; | ||||||
| @@ -19,32 +16,27 @@ import java.util.List; | |||||||
|  |  | ||||||
| @Data | @Data | ||||||
| @NoArgsConstructor | @NoArgsConstructor | ||||||
| @ApiModel("分页响应对象") |  | ||||||
| public class TableDataInfo<T> implements Serializable { | public class TableDataInfo<T> implements Serializable { | ||||||
|     private static final long serialVersionUID = 1L; |     private static final long serialVersionUID = 1L; | ||||||
|  |  | ||||||
|     /** |     /** | ||||||
|      * 总记录数 |      * 总记录数 | ||||||
|      */ |      */ | ||||||
|     @ApiModelProperty("总记录数") |  | ||||||
|     private long total; |     private long total; | ||||||
|  |  | ||||||
|     /** |     /** | ||||||
|      * 列表数据 |      * 列表数据 | ||||||
|      */ |      */ | ||||||
|     @ApiModelProperty("列表数据") |  | ||||||
|     private List<T> rows; |     private List<T> rows; | ||||||
|  |  | ||||||
|     /** |     /** | ||||||
|      * 消息状态码 |      * 消息状态码 | ||||||
|      */ |      */ | ||||||
|     @ApiModelProperty("消息状态码") |  | ||||||
|     private int code; |     private int code; | ||||||
|  |  | ||||||
|     /** |     /** | ||||||
|      * 消息内容 |      * 消息内容 | ||||||
|      */ |      */ | ||||||
|     @ApiModelProperty("消息内容") |  | ||||||
|     private String msg; |     private String msg; | ||||||
|  |  | ||||||
|     /** |     /** | ||||||
|   | |||||||
| @@ -6,6 +6,7 @@ import com.alibaba.excel.event.AnalysisEventListener; | |||||||
| import com.alibaba.excel.exception.ExcelAnalysisException; | import com.alibaba.excel.exception.ExcelAnalysisException; | ||||||
| import com.alibaba.excel.exception.ExcelDataConvertException; | import com.alibaba.excel.exception.ExcelDataConvertException; | ||||||
| import com.ruoyi.common.utils.JsonUtils; | import com.ruoyi.common.utils.JsonUtils; | ||||||
|  | import com.ruoyi.common.utils.StreamUtils; | ||||||
| import com.ruoyi.common.utils.ValidatorUtils; | import com.ruoyi.common.utils.ValidatorUtils; | ||||||
| import lombok.NoArgsConstructor; | import lombok.NoArgsConstructor; | ||||||
| import lombok.extern.slf4j.Slf4j; | import lombok.extern.slf4j.Slf4j; | ||||||
| @@ -14,7 +15,6 @@ import javax.validation.ConstraintViolation; | |||||||
| import javax.validation.ConstraintViolationException; | import javax.validation.ConstraintViolationException; | ||||||
| import java.util.Map; | import java.util.Map; | ||||||
| import java.util.Set; | import java.util.Set; | ||||||
| import java.util.stream.Collectors; |  | ||||||
|  |  | ||||||
| /** | /** | ||||||
|  * Excel 导入监听 |  * Excel 导入监听 | ||||||
| @@ -69,9 +69,7 @@ public class DefaultExcelListener<T> extends AnalysisEventListener<T> implements | |||||||
|         if (exception instanceof ConstraintViolationException) { |         if (exception instanceof ConstraintViolationException) { | ||||||
|             ConstraintViolationException constraintViolationException = (ConstraintViolationException) exception; |             ConstraintViolationException constraintViolationException = (ConstraintViolationException) exception; | ||||||
|             Set<ConstraintViolation<?>> constraintViolations = constraintViolationException.getConstraintViolations(); |             Set<ConstraintViolation<?>> constraintViolations = constraintViolationException.getConstraintViolations(); | ||||||
|             String constraintViolationsMsg = constraintViolations.stream() |             String constraintViolationsMsg = StreamUtils.join(constraintViolations, ConstraintViolation::getMessage, ", "); | ||||||
|                 .map(ConstraintViolation::getMessage) |  | ||||||
|                 .collect(Collectors.joining(", ")); |  | ||||||
|             errMsg = StrUtil.format("第{}行数据校验异常: {}", context.readRowHolder().getRowIndex() + 1, constraintViolationsMsg); |             errMsg = StrUtil.format("第{}行数据校验异常: {}", context.readRowHolder().getRowIndex() + 1, constraintViolationsMsg); | ||||||
|             if (log.isDebugEnabled()) { |             if (log.isDebugEnabled()) { | ||||||
|                 log.error(errMsg); |                 log.error(errMsg); | ||||||
|   | |||||||
| @@ -0,0 +1,16 @@ | |||||||
|  | package com.ruoyi.common.exception.user; | ||||||
|  |  | ||||||
|  | /** | ||||||
|  |  * 用户错误最大次数异常类 | ||||||
|  |  * | ||||||
|  |  * @author ruoyi | ||||||
|  |  */ | ||||||
|  | public class UserPasswordRetryLimitExceedException extends UserException { | ||||||
|  |  | ||||||
|  |     private static final long serialVersionUID = 1L; | ||||||
|  |  | ||||||
|  |     public UserPasswordRetryLimitExceedException(int retryLimitCount, int lockTime) { | ||||||
|  |         super("user.password.retry.limit.exceed", retryLimitCount, lockTime); | ||||||
|  |     } | ||||||
|  |  | ||||||
|  | } | ||||||
| @@ -1,6 +1,7 @@ | |||||||
| package com.ruoyi.common.filter; | package com.ruoyi.common.filter; | ||||||
|  |  | ||||||
| import cn.hutool.core.io.IoUtil; | import cn.hutool.core.io.IoUtil; | ||||||
|  | import com.ruoyi.common.constant.Constants; | ||||||
|  |  | ||||||
| import javax.servlet.ReadListener; | import javax.servlet.ReadListener; | ||||||
| import javax.servlet.ServletInputStream; | import javax.servlet.ServletInputStream; | ||||||
| @@ -23,8 +24,8 @@ public class RepeatedlyRequestWrapper extends HttpServletRequestWrapper { | |||||||
|  |  | ||||||
|     public RepeatedlyRequestWrapper(HttpServletRequest request, ServletResponse response) throws IOException { |     public RepeatedlyRequestWrapper(HttpServletRequest request, ServletResponse response) throws IOException { | ||||||
|         super(request); |         super(request); | ||||||
|         request.setCharacterEncoding("UTF-8"); |         request.setCharacterEncoding(Constants.UTF8); | ||||||
|         response.setCharacterEncoding("UTF-8"); |         response.setCharacterEncoding(Constants.UTF8); | ||||||
|  |  | ||||||
|         body = IoUtil.readUtf8(request.getInputStream()).getBytes(StandardCharsets.UTF_8); |         body = IoUtil.readUtf8(request.getInputStream()).getBytes(StandardCharsets.UTF_8); | ||||||
|     } |     } | ||||||
|   | |||||||
| @@ -1,5 +1,6 @@ | |||||||
| package com.ruoyi.common.filter; | package com.ruoyi.common.filter; | ||||||
|  |  | ||||||
|  | import com.ruoyi.common.enums.HttpMethod; | ||||||
| import com.ruoyi.common.utils.StringUtils; | import com.ruoyi.common.utils.StringUtils; | ||||||
|  |  | ||||||
| import javax.servlet.*; | import javax.servlet.*; | ||||||
| @@ -48,7 +49,7 @@ public class XssFilter implements Filter { | |||||||
|         String url = request.getServletPath(); |         String url = request.getServletPath(); | ||||||
|         String method = request.getMethod(); |         String method = request.getMethod(); | ||||||
|         // GET DELETE 不过滤 |         // GET DELETE 不过滤 | ||||||
|         if (method == null || method.matches("GET") || method.matches("DELETE")) { |         if (method == null || HttpMethod.GET.matches(method) || HttpMethod.DELETE.matches(method)) { | ||||||
|             return true; |             return true; | ||||||
|         } |         } | ||||||
|         return StringUtils.matches(url, excludes); |         return StringUtils.matches(url, excludes); | ||||||
|   | |||||||
| @@ -89,7 +89,6 @@ public class XssHttpServletRequestWrapper extends HttpServletRequestWrapper { | |||||||
|     /** |     /** | ||||||
|      * 是否是Json请求 |      * 是否是Json请求 | ||||||
|      * |      * | ||||||
|      * @param request |  | ||||||
|      */ |      */ | ||||||
|     public boolean isJsonRequest() { |     public boolean isJsonRequest() { | ||||||
|         String header = super.getHeader(HttpHeaders.CONTENT_TYPE); |         String header = super.getHeader(HttpHeaders.CONTENT_TYPE); | ||||||
|   | |||||||
| @@ -1,5 +1,6 @@ | |||||||
| package com.ruoyi.common.jackson; | package com.ruoyi.common.jackson; | ||||||
|  |  | ||||||
|  | import cn.hutool.core.util.ObjectUtil; | ||||||
| import com.fasterxml.jackson.core.JsonGenerator; | import com.fasterxml.jackson.core.JsonGenerator; | ||||||
| import com.fasterxml.jackson.databind.BeanProperty; | import com.fasterxml.jackson.databind.BeanProperty; | ||||||
| import com.fasterxml.jackson.databind.JsonMappingException; | import com.fasterxml.jackson.databind.JsonMappingException; | ||||||
| @@ -10,6 +11,8 @@ import com.ruoyi.common.annotation.Sensitive; | |||||||
| import com.ruoyi.common.core.service.SensitiveService; | import com.ruoyi.common.core.service.SensitiveService; | ||||||
| import com.ruoyi.common.enums.SensitiveStrategy; | import com.ruoyi.common.enums.SensitiveStrategy; | ||||||
| import com.ruoyi.common.utils.spring.SpringUtils; | import com.ruoyi.common.utils.spring.SpringUtils; | ||||||
|  | import lombok.extern.slf4j.Slf4j; | ||||||
|  | import org.springframework.beans.BeansException; | ||||||
|  |  | ||||||
| import java.io.IOException; | import java.io.IOException; | ||||||
| import java.util.Objects; | import java.util.Objects; | ||||||
| @@ -19,19 +22,24 @@ import java.util.Objects; | |||||||
|  * |  * | ||||||
|  * @author Yjoioooo |  * @author Yjoioooo | ||||||
|  */ |  */ | ||||||
|  | @Slf4j | ||||||
| public class SensitiveJsonSerializer extends JsonSerializer<String> implements ContextualSerializer { | public class SensitiveJsonSerializer extends JsonSerializer<String> implements ContextualSerializer { | ||||||
|  |  | ||||||
|     private SensitiveStrategy strategy; |     private SensitiveStrategy strategy; | ||||||
|  |  | ||||||
|     @Override |     @Override | ||||||
|     public void serialize(String value, JsonGenerator gen, SerializerProvider serializers) throws IOException { |     public void serialize(String value, JsonGenerator gen, SerializerProvider serializers) throws IOException { | ||||||
|  |         try { | ||||||
|             SensitiveService sensitiveService = SpringUtils.getBean(SensitiveService.class); |             SensitiveService sensitiveService = SpringUtils.getBean(SensitiveService.class); | ||||||
|         if (sensitiveService.isSensitive()) { |             if (ObjectUtil.isNotNull(sensitiveService) && sensitiveService.isSensitive()) { | ||||||
|                 gen.writeString(strategy.desensitizer().apply(value)); |                 gen.writeString(strategy.desensitizer().apply(value)); | ||||||
|             } else { |             } else { | ||||||
|                 gen.writeString(value); |                 gen.writeString(value); | ||||||
|             } |             } | ||||||
|  |         } catch (BeansException e) { | ||||||
|  |             log.error("脱敏实现不存在, 采用默认处理 => {}", e.getMessage()); | ||||||
|  |             gen.writeString(value); | ||||||
|  |         } | ||||||
|     } |     } | ||||||
|  |  | ||||||
|     @Override |     @Override | ||||||
|   | |||||||
| @@ -14,7 +14,6 @@ import org.springframework.cglib.core.Converter; | |||||||
|  |  | ||||||
| import java.util.List; | import java.util.List; | ||||||
| import java.util.Map; | import java.util.Map; | ||||||
| import java.util.stream.Collectors; |  | ||||||
|  |  | ||||||
| /** | /** | ||||||
|  * bean深拷贝工具(基于 cglib 性能优异) |  * bean深拷贝工具(基于 cglib 性能优异) | ||||||
| @@ -79,11 +78,11 @@ public class BeanCopyUtils { | |||||||
|         if (CollUtil.isEmpty(sourceList)) { |         if (CollUtil.isEmpty(sourceList)) { | ||||||
|             return CollUtil.newArrayList(); |             return CollUtil.newArrayList(); | ||||||
|         } |         } | ||||||
|         return sourceList.stream().map(source -> { |         return StreamUtils.toList(sourceList, source -> { | ||||||
|             V target = ReflectUtil.newInstanceIfPossible(desc); |             V target = ReflectUtil.newInstanceIfPossible(desc); | ||||||
|             copy(source, target); |             copy(source, target); | ||||||
|             return target; |             return target; | ||||||
|         }).collect(Collectors.toList()); |         }); | ||||||
|     } |     } | ||||||
|  |  | ||||||
|     /** |     /** | ||||||
|   | |||||||
| @@ -3,6 +3,7 @@ package com.ruoyi.common.utils; | |||||||
| import cn.hutool.core.convert.Convert; | import cn.hutool.core.convert.Convert; | ||||||
| import cn.hutool.extra.servlet.ServletUtil; | import cn.hutool.extra.servlet.ServletUtil; | ||||||
| import cn.hutool.http.HttpStatus; | import cn.hutool.http.HttpStatus; | ||||||
|  | import com.ruoyi.common.constant.Constants; | ||||||
| import lombok.AccessLevel; | import lombok.AccessLevel; | ||||||
| import lombok.NoArgsConstructor; | import lombok.NoArgsConstructor; | ||||||
| import org.springframework.http.MediaType; | import org.springframework.http.MediaType; | ||||||
| @@ -14,6 +15,9 @@ import javax.servlet.http.HttpServletRequest; | |||||||
| import javax.servlet.http.HttpServletResponse; | import javax.servlet.http.HttpServletResponse; | ||||||
| import javax.servlet.http.HttpSession; | import javax.servlet.http.HttpSession; | ||||||
| import java.io.IOException; | import java.io.IOException; | ||||||
|  | import java.io.UnsupportedEncodingException; | ||||||
|  | import java.net.URLDecoder; | ||||||
|  | import java.net.URLEncoder; | ||||||
| import java.nio.charset.StandardCharsets; | import java.nio.charset.StandardCharsets; | ||||||
|  |  | ||||||
| /** | /** | ||||||
| @@ -117,7 +121,7 @@ public class ServletUtils extends ServletUtil { | |||||||
|     public static boolean isAjaxRequest(HttpServletRequest request) { |     public static boolean isAjaxRequest(HttpServletRequest request) { | ||||||
|  |  | ||||||
|         String accept = request.getHeader("accept"); |         String accept = request.getHeader("accept"); | ||||||
|         if (accept != null && accept.contains("application/json")) { |         if (accept != null && accept.contains(MediaType.APPLICATION_JSON_VALUE)) { | ||||||
|             return true; |             return true; | ||||||
|         } |         } | ||||||
|  |  | ||||||
| @@ -139,4 +143,32 @@ public class ServletUtils extends ServletUtil { | |||||||
|         return getClientIP(getRequest()); |         return getClientIP(getRequest()); | ||||||
|     } |     } | ||||||
|  |  | ||||||
|  |     /** | ||||||
|  |      * 内容编码 | ||||||
|  |      * | ||||||
|  |      * @param str 内容 | ||||||
|  |      * @return 编码后的内容 | ||||||
|  |      */ | ||||||
|  |     public static String urlEncode(String str) { | ||||||
|  |         try { | ||||||
|  |             return URLEncoder.encode(str, Constants.UTF8); | ||||||
|  |         } catch (UnsupportedEncodingException e) { | ||||||
|  |             return StringUtils.EMPTY; | ||||||
|  |         } | ||||||
|  |     } | ||||||
|  |  | ||||||
|  |     /** | ||||||
|  |      * 内容解码 | ||||||
|  |      * | ||||||
|  |      * @param str 内容 | ||||||
|  |      * @return 解码后的内容 | ||||||
|  |      */ | ||||||
|  |     public static String urlDecode(String str) { | ||||||
|  |         try { | ||||||
|  |             return URLDecoder.decode(str, Constants.UTF8); | ||||||
|  |         } catch (UnsupportedEncodingException e) { | ||||||
|  |             return StringUtils.EMPTY; | ||||||
|  |         } | ||||||
|  |     } | ||||||
|  |  | ||||||
| } | } | ||||||
|   | |||||||
| @@ -0,0 +1,251 @@ | |||||||
|  | package com.ruoyi.common.utils; | ||||||
|  |  | ||||||
|  | import cn.hutool.core.collection.CollUtil; | ||||||
|  | import cn.hutool.core.map.MapUtil; | ||||||
|  | import lombok.AccessLevel; | ||||||
|  | import lombok.NoArgsConstructor; | ||||||
|  |  | ||||||
|  | import java.util.*; | ||||||
|  | import java.util.function.BiFunction; | ||||||
|  | import java.util.function.Function; | ||||||
|  | import java.util.function.Predicate; | ||||||
|  | import java.util.stream.Collectors; | ||||||
|  |  | ||||||
|  | /** | ||||||
|  |  * stream 流工具类 | ||||||
|  |  * | ||||||
|  |  * @author Lion Li | ||||||
|  |  */ | ||||||
|  | @NoArgsConstructor(access = AccessLevel.PRIVATE) | ||||||
|  | public class StreamUtils { | ||||||
|  |  | ||||||
|  |     /** | ||||||
|  |      * 将collection过滤 | ||||||
|  |      * | ||||||
|  |      * @param collection 需要转化的集合 | ||||||
|  |      * @param function   过滤方法 | ||||||
|  |      * @return 过滤后的list | ||||||
|  |      */ | ||||||
|  |     public static <E> List<E> filter(Collection<E> collection, Predicate<E> function) { | ||||||
|  |         if (CollUtil.isEmpty(collection)) { | ||||||
|  |             return CollUtil.newArrayList(); | ||||||
|  |         } | ||||||
|  |         return collection.stream().filter(function).collect(Collectors.toList()); | ||||||
|  |     } | ||||||
|  |  | ||||||
|  |     /** | ||||||
|  |      * 将collection拼接 | ||||||
|  |      * | ||||||
|  |      * @param collection 需要转化的集合 | ||||||
|  |      * @param function   拼接方法 | ||||||
|  |      * @return 拼接后的list | ||||||
|  |      */ | ||||||
|  |     public static <E> String join(Collection<E> collection, Function<E, String> function) { | ||||||
|  |         return join(collection, function, ","); | ||||||
|  |     } | ||||||
|  |  | ||||||
|  |     /** | ||||||
|  |      * 将collection拼接 | ||||||
|  |      * | ||||||
|  |      * @param collection 需要转化的集合 | ||||||
|  |      * @param function   拼接方法 | ||||||
|  |      * @param delimiter  拼接符 | ||||||
|  |      * @return 拼接后的list | ||||||
|  |      */ | ||||||
|  |     public static <E> String join(Collection<E> collection, Function<E, String> function, CharSequence delimiter) { | ||||||
|  |         if (CollUtil.isEmpty(collection)) { | ||||||
|  |             return StringUtils.EMPTY; | ||||||
|  |         } | ||||||
|  |         return collection.stream().map(function).filter(Objects::nonNull).collect(Collectors.joining(delimiter)); | ||||||
|  |     } | ||||||
|  |  | ||||||
|  |     /** | ||||||
|  |      * 将collection排序 | ||||||
|  |      * | ||||||
|  |      * @param collection 需要转化的集合 | ||||||
|  |      * @param comparing  排序方法 | ||||||
|  |      * @return 排序后的list | ||||||
|  |      */ | ||||||
|  |     public static <E> List<E> sorted(Collection<E> collection, Comparator<E> comparing) { | ||||||
|  |         if (CollUtil.isEmpty(collection)) { | ||||||
|  |             return CollUtil.newArrayList(); | ||||||
|  |         } | ||||||
|  |         return collection.stream().sorted(comparing).collect(Collectors.toList()); | ||||||
|  |     } | ||||||
|  |  | ||||||
|  |     /** | ||||||
|  |      * 将collection转化为类型不变的map<br> | ||||||
|  |      * <B>{@code Collection<V>  ---->  Map<K,V>}</B> | ||||||
|  |      * | ||||||
|  |      * @param collection 需要转化的集合 | ||||||
|  |      * @param key        V类型转化为K类型的lambda方法 | ||||||
|  |      * @param <V>        collection中的泛型 | ||||||
|  |      * @param <K>        map中的key类型 | ||||||
|  |      * @return 转化后的map | ||||||
|  |      */ | ||||||
|  |     public static <V, K> Map<K, V> toIdentityMap(Collection<V> collection, Function<V, K> key) { | ||||||
|  |         if (CollUtil.isEmpty(collection)) { | ||||||
|  |             return MapUtil.newHashMap(); | ||||||
|  |         } | ||||||
|  |         return collection.stream().collect(Collectors.toMap(key, Function.identity(), (l, r) -> l)); | ||||||
|  |     } | ||||||
|  |  | ||||||
|  |     /** | ||||||
|  |      * 将Collection转化为map(value类型与collection的泛型不同)<br> | ||||||
|  |      * <B>{@code Collection<E> -----> Map<K,V>  }</B> | ||||||
|  |      * | ||||||
|  |      * @param collection 需要转化的集合 | ||||||
|  |      * @param key        E类型转化为K类型的lambda方法 | ||||||
|  |      * @param value      E类型转化为V类型的lambda方法 | ||||||
|  |      * @param <E>        collection中的泛型 | ||||||
|  |      * @param <K>        map中的key类型 | ||||||
|  |      * @param <V>        map中的value类型 | ||||||
|  |      * @return 转化后的map | ||||||
|  |      */ | ||||||
|  |     public static <E, K, V> Map<K, V> toMap(Collection<E> collection, Function<E, K> key, Function<E, V> value) { | ||||||
|  |         if (CollUtil.isEmpty(collection)) { | ||||||
|  |             return MapUtil.newHashMap(); | ||||||
|  |         } | ||||||
|  |         return collection.stream().collect(Collectors.toMap(key, value, (l, r) -> l)); | ||||||
|  |     } | ||||||
|  |  | ||||||
|  |     /** | ||||||
|  |      * 将collection按照规则(比如有相同的班级id)分类成map<br> | ||||||
|  |      * <B>{@code Collection<E> -------> Map<K,List<E>> } </B> | ||||||
|  |      * | ||||||
|  |      * @param collection 需要分类的集合 | ||||||
|  |      * @param key        分类的规则 | ||||||
|  |      * @param <E>        collection中的泛型 | ||||||
|  |      * @param <K>        map中的key类型 | ||||||
|  |      * @return 分类后的map | ||||||
|  |      */ | ||||||
|  |     public static <E, K> Map<K, List<E>> groupByKey(Collection<E> collection, Function<E, K> key) { | ||||||
|  |         if (CollUtil.isEmpty(collection)) { | ||||||
|  |             return MapUtil.newHashMap(); | ||||||
|  |         } | ||||||
|  |         return collection | ||||||
|  |             .stream() | ||||||
|  |             .collect(Collectors.groupingBy(key, LinkedHashMap::new, Collectors.toList())); | ||||||
|  |     } | ||||||
|  |  | ||||||
|  |     /** | ||||||
|  |      * 将collection按照两个规则(比如有相同的年级id,班级id)分类成双层map<br> | ||||||
|  |      * <B>{@code Collection<E>  --->  Map<T,Map<U,List<E>>> } </B> | ||||||
|  |      * | ||||||
|  |      * @param collection 需要分类的集合 | ||||||
|  |      * @param key1       第一个分类的规则 | ||||||
|  |      * @param key2       第二个分类的规则 | ||||||
|  |      * @param <E>        集合元素类型 | ||||||
|  |      * @param <K>        第一个map中的key类型 | ||||||
|  |      * @param <U>        第二个map中的key类型 | ||||||
|  |      * @return 分类后的map | ||||||
|  |      */ | ||||||
|  |     public static <E, K, U> Map<K, Map<U, List<E>>> groupBy2Key(Collection<E> collection, Function<E, K> key1, Function<E, U> key2) { | ||||||
|  |         if (CollUtil.isEmpty(collection)) { | ||||||
|  |             return MapUtil.newHashMap(); | ||||||
|  |         } | ||||||
|  |         return collection | ||||||
|  |             .stream() | ||||||
|  |             .collect(Collectors.groupingBy(key1, LinkedHashMap::new, Collectors.groupingBy(key2, LinkedHashMap::new, Collectors.toList()))); | ||||||
|  |     } | ||||||
|  |  | ||||||
|  |     /** | ||||||
|  |      * 将collection按照两个规则(比如有相同的年级id,班级id)分类成双层map<br> | ||||||
|  |      * <B>{@code Collection<E>  --->  Map<T,Map<U,E>> } </B> | ||||||
|  |      * | ||||||
|  |      * @param collection 需要分类的集合 | ||||||
|  |      * @param key1       第一个分类的规则 | ||||||
|  |      * @param key2       第二个分类的规则 | ||||||
|  |      * @param <T>        第一个map中的key类型 | ||||||
|  |      * @param <U>        第二个map中的key类型 | ||||||
|  |      * @param <E>        collection中的泛型 | ||||||
|  |      * @return 分类后的map | ||||||
|  |      */ | ||||||
|  |     public static <E, T, U> Map<T, Map<U, E>> group2Map(Collection<E> collection, Function<E, T> key1, Function<E, U> key2) { | ||||||
|  |         if (CollUtil.isEmpty(collection) || key1 == null || key2 == null) { | ||||||
|  |             return MapUtil.newHashMap(); | ||||||
|  |         } | ||||||
|  |         return collection | ||||||
|  |             .stream() | ||||||
|  |             .collect(Collectors.groupingBy(key1, LinkedHashMap::new, Collectors.toMap(key2, Function.identity(), (l, r) -> l))); | ||||||
|  |     } | ||||||
|  |  | ||||||
|  |     /** | ||||||
|  |      * 将collection转化为List集合,但是两者的泛型不同<br> | ||||||
|  |      * <B>{@code Collection<E>  ------>  List<T> } </B> | ||||||
|  |      * | ||||||
|  |      * @param collection 需要转化的集合 | ||||||
|  |      * @param function   collection中的泛型转化为list泛型的lambda表达式 | ||||||
|  |      * @param <E>        collection中的泛型 | ||||||
|  |      * @param <T>        List中的泛型 | ||||||
|  |      * @return 转化后的list | ||||||
|  |      */ | ||||||
|  |     public static <E, T> List<T> toList(Collection<E> collection, Function<E, T> function) { | ||||||
|  |         if (CollUtil.isEmpty(collection)) { | ||||||
|  |             return CollUtil.newArrayList(); | ||||||
|  |         } | ||||||
|  |         return collection | ||||||
|  |             .stream() | ||||||
|  |             .map(function) | ||||||
|  |             .filter(Objects::nonNull) | ||||||
|  |             .collect(Collectors.toList()); | ||||||
|  |     } | ||||||
|  |  | ||||||
|  |     /** | ||||||
|  |      * 将collection转化为Set集合,但是两者的泛型不同<br> | ||||||
|  |      * <B>{@code Collection<E>  ------>  Set<T> } </B> | ||||||
|  |      * | ||||||
|  |      * @param collection 需要转化的集合 | ||||||
|  |      * @param function   collection中的泛型转化为set泛型的lambda表达式 | ||||||
|  |      * @param <E>        collection中的泛型 | ||||||
|  |      * @param <T>        Set中的泛型 | ||||||
|  |      * @return 转化后的Set | ||||||
|  |      */ | ||||||
|  |     public static <E, T> Set<T> toSet(Collection<E> collection, Function<E, T> function) { | ||||||
|  |         if (CollUtil.isEmpty(collection) || function == null) { | ||||||
|  |             return CollUtil.newHashSet(); | ||||||
|  |         } | ||||||
|  |         return collection | ||||||
|  |             .stream() | ||||||
|  |             .map(function) | ||||||
|  |             .filter(Objects::nonNull) | ||||||
|  |             .collect(Collectors.toSet()); | ||||||
|  |     } | ||||||
|  |  | ||||||
|  |  | ||||||
|  |     /** | ||||||
|  |      * 合并两个相同key类型的map | ||||||
|  |      * | ||||||
|  |      * @param map1  第一个需要合并的 map | ||||||
|  |      * @param map2  第二个需要合并的 map | ||||||
|  |      * @param merge 合并的lambda,将key  value1 value2合并成最终的类型,注意value可能为空的情况 | ||||||
|  |      * @param <K>   map中的key类型 | ||||||
|  |      * @param <X>   第一个 map的value类型 | ||||||
|  |      * @param <Y>   第二个 map的value类型 | ||||||
|  |      * @param <V>   最终map的value类型 | ||||||
|  |      * @return 合并后的map | ||||||
|  |      */ | ||||||
|  |     public static <K, X, Y, V> Map<K, V> merge(Map<K, X> map1, Map<K, Y> map2, BiFunction<X, Y, V> merge) { | ||||||
|  |         if (MapUtil.isEmpty(map1) && MapUtil.isEmpty(map2)) { | ||||||
|  |             return MapUtil.newHashMap(); | ||||||
|  |         } else if (MapUtil.isEmpty(map1)) { | ||||||
|  |             map1 = MapUtil.newHashMap(); | ||||||
|  |         } else if (MapUtil.isEmpty(map2)) { | ||||||
|  |             map2 = MapUtil.newHashMap(); | ||||||
|  |         } | ||||||
|  |         Set<K> key = new HashSet<>(); | ||||||
|  |         key.addAll(map1.keySet()); | ||||||
|  |         key.addAll(map2.keySet()); | ||||||
|  |         Map<K, V> map = new HashMap<>(); | ||||||
|  |         for (K t : key) { | ||||||
|  |             X x = map1.get(t); | ||||||
|  |             Y y = map2.get(t); | ||||||
|  |             V z = merge.apply(x, y); | ||||||
|  |             if (z != null) { | ||||||
|  |                 map.put(t, z); | ||||||
|  |             } | ||||||
|  |         } | ||||||
|  |         return map; | ||||||
|  |     } | ||||||
|  |  | ||||||
|  | } | ||||||
| @@ -0,0 +1,75 @@ | |||||||
|  | package com.ruoyi.common.utils.redis; | ||||||
|  |  | ||||||
|  | import com.ruoyi.common.utils.spring.SpringUtils; | ||||||
|  | import lombok.AccessLevel; | ||||||
|  | import lombok.NoArgsConstructor; | ||||||
|  | import org.redisson.api.RMap; | ||||||
|  | import org.springframework.cache.Cache; | ||||||
|  | import org.springframework.cache.CacheManager; | ||||||
|  |  | ||||||
|  | import java.util.Set; | ||||||
|  |  | ||||||
|  | /** | ||||||
|  |  * 缓存操作工具类 {@link } | ||||||
|  |  * | ||||||
|  |  * @author Michelle.Chung | ||||||
|  |  * @date 2022/8/13 | ||||||
|  |  */ | ||||||
|  | @NoArgsConstructor(access = AccessLevel.PRIVATE) | ||||||
|  | @SuppressWarnings(value = {"unchecked"}) | ||||||
|  | public class CacheUtils { | ||||||
|  |  | ||||||
|  |     private static final CacheManager CACHE_MANAGER = SpringUtils.getBean(CacheManager.class); | ||||||
|  |  | ||||||
|  |     /** | ||||||
|  |      * 获取缓存组内所有的KEY | ||||||
|  |      * | ||||||
|  |      * @param cacheNames 缓存组名称 | ||||||
|  |      */ | ||||||
|  |     public static Set<Object> keys(String cacheNames) { | ||||||
|  |         RMap<Object, Object> rmap = (RMap<Object, Object>) CACHE_MANAGER.getCache(cacheNames).getNativeCache(); | ||||||
|  |         return rmap.keySet(); | ||||||
|  |     } | ||||||
|  |  | ||||||
|  |     /** | ||||||
|  |      * 获取缓存值 | ||||||
|  |      * | ||||||
|  |      * @param cacheNames 缓存组名称 | ||||||
|  |      * @param key        缓存key | ||||||
|  |      */ | ||||||
|  |     public static <T> T get(String cacheNames, Object key) { | ||||||
|  |         Cache.ValueWrapper wrapper = CACHE_MANAGER.getCache(cacheNames).get(key); | ||||||
|  |         return wrapper != null ? (T) wrapper.get() : null; | ||||||
|  |     } | ||||||
|  |  | ||||||
|  |     /** | ||||||
|  |      * 保存缓存值 | ||||||
|  |      * | ||||||
|  |      * @param cacheNames 缓存组名称 | ||||||
|  |      * @param key        缓存key | ||||||
|  |      * @param value      缓存值 | ||||||
|  |      */ | ||||||
|  |     public static void put(String cacheNames, Object key, Object value) { | ||||||
|  |         CACHE_MANAGER.getCache(cacheNames).put(key, value); | ||||||
|  |     } | ||||||
|  |  | ||||||
|  |     /** | ||||||
|  |      * 删除缓存值 | ||||||
|  |      * | ||||||
|  |      * @param cacheNames 缓存组名称 | ||||||
|  |      * @param key        缓存key | ||||||
|  |      */ | ||||||
|  |     public static void evict(String cacheNames, Object key) { | ||||||
|  |         CACHE_MANAGER.getCache(cacheNames).evict(key); | ||||||
|  |     } | ||||||
|  |  | ||||||
|  |     /** | ||||||
|  |      * 清空缓存值 | ||||||
|  |      * | ||||||
|  |      * @param cacheNames 缓存组名称 | ||||||
|  |      */ | ||||||
|  |     public static void clear(String cacheNames) { | ||||||
|  |         CACHE_MANAGER.getCache(cacheNames).clear(); | ||||||
|  |     } | ||||||
|  |  | ||||||
|  | } | ||||||
| @@ -1,10 +1,10 @@ | |||||||
| package com.ruoyi.common.utils.redis; | package com.ruoyi.common.utils.redis; | ||||||
|  |  | ||||||
| import cn.hutool.core.collection.IterUtil; |  | ||||||
| import com.ruoyi.common.utils.spring.SpringUtils; | import com.ruoyi.common.utils.spring.SpringUtils; | ||||||
| import lombok.AccessLevel; | import lombok.AccessLevel; | ||||||
| import lombok.NoArgsConstructor; | import lombok.NoArgsConstructor; | ||||||
| import org.redisson.api.*; | import org.redisson.api.*; | ||||||
|  | import org.redisson.config.Config; | ||||||
|  |  | ||||||
| import java.time.Duration; | import java.time.Duration; | ||||||
| import java.util.Collection; | import java.util.Collection; | ||||||
| @@ -12,6 +12,8 @@ import java.util.List; | |||||||
| import java.util.Map; | import java.util.Map; | ||||||
| import java.util.Set; | import java.util.Set; | ||||||
| import java.util.function.Consumer; | import java.util.function.Consumer; | ||||||
|  | import java.util.stream.Collectors; | ||||||
|  | import java.util.stream.Stream; | ||||||
|  |  | ||||||
| /** | /** | ||||||
|  * redis 工具类 |  * redis 工具类 | ||||||
| @@ -25,6 +27,14 @@ public class RedisUtils { | |||||||
|  |  | ||||||
|     private static final RedissonClient CLIENT = SpringUtils.getBean(RedissonClient.class); |     private static final RedissonClient CLIENT = SpringUtils.getBean(RedissonClient.class); | ||||||
|  |  | ||||||
|  |     public static NameMapper getNameMapper() { | ||||||
|  |         Config config = CLIENT.getConfig(); | ||||||
|  |         if (config.isClusterConfig()) { | ||||||
|  |             return config.useClusterServers().getNameMapper(); | ||||||
|  |         } | ||||||
|  |         return config.useSingleServer().getNameMapper(); | ||||||
|  |     } | ||||||
|  |  | ||||||
|     /** |     /** | ||||||
|      * 限流 |      * 限流 | ||||||
|      * |      * | ||||||
| @@ -100,14 +110,13 @@ public class RedisUtils { | |||||||
|      * @since Redis 6.X 以上使用 setAndKeepTTL 兼容 5.X 方案 |      * @since Redis 6.X 以上使用 setAndKeepTTL 兼容 5.X 方案 | ||||||
|      */ |      */ | ||||||
|     public static <T> void setCacheObject(final String key, final T value, final boolean isSaveTtl) { |     public static <T> void setCacheObject(final String key, final T value, final boolean isSaveTtl) { | ||||||
|         RBucket<Object> bucket = CLIENT.getBucket(key); |         RBucket<T> bucket = CLIENT.getBucket(key); | ||||||
|         if (isSaveTtl) { |         if (isSaveTtl) { | ||||||
|             try { |             try { | ||||||
|                 bucket.setAndKeepTTL(value); |                 bucket.setAndKeepTTL(value); | ||||||
|             } catch (Exception e) { |             } catch (Exception e) { | ||||||
|                 long timeToLive = bucket.remainTimeToLive(); |                 long timeToLive = bucket.remainTimeToLive(); | ||||||
|                 bucket.set(value); |                 setCacheObject(key, value, Duration.ofMillis(timeToLive)); | ||||||
|                 bucket.expire(Duration.ofMillis(timeToLive)); |  | ||||||
|             } |             } | ||||||
|         } else { |         } else { | ||||||
|             bucket.set(value); |             bucket.set(value); | ||||||
| @@ -122,9 +131,11 @@ public class RedisUtils { | |||||||
|      * @param duration 时间 |      * @param duration 时间 | ||||||
|      */ |      */ | ||||||
|     public static <T> void setCacheObject(final String key, final T value, final Duration duration) { |     public static <T> void setCacheObject(final String key, final T value, final Duration duration) { | ||||||
|         RBucket<T> result = CLIENT.getBucket(key); |         RBatch batch = CLIENT.createBatch(); | ||||||
|         result.set(value); |         RBucketAsync<T> bucket = batch.getBucket(key); | ||||||
|         result.expire(duration); |         bucket.setAsync(value); | ||||||
|  |         bucket.expireAsync(duration); | ||||||
|  |         batch.execute(); | ||||||
|     } |     } | ||||||
|  |  | ||||||
|     /** |     /** | ||||||
| @@ -415,8 +426,17 @@ public class RedisUtils { | |||||||
|      * @return 对象列表 |      * @return 对象列表 | ||||||
|      */ |      */ | ||||||
|     public static Collection<String> keys(final String pattern) { |     public static Collection<String> keys(final String pattern) { | ||||||
|         Iterable<String> iterable = CLIENT.getKeys().getKeysByPattern(pattern); |         Stream<String> stream = CLIENT.getKeys().getKeysStreamByPattern(getNameMapper().map(pattern)); | ||||||
|         return IterUtil.toList(iterable); |         return stream.map(key -> getNameMapper().unmap(key)).collect(Collectors.toList()); | ||||||
|  |     } | ||||||
|  |  | ||||||
|  |     /** | ||||||
|  |      * 删除缓存的基本对象列表 | ||||||
|  |      * | ||||||
|  |      * @param pattern 字符串前缀 | ||||||
|  |      */ | ||||||
|  |     public static void deleteKeys(final String pattern) { | ||||||
|  |         CLIENT.getKeys().deleteByPattern(getNameMapper().map(pattern)); | ||||||
|     } |     } | ||||||
|  |  | ||||||
|     /** |     /** | ||||||
| @@ -426,6 +446,6 @@ public class RedisUtils { | |||||||
|      */ |      */ | ||||||
|     public static Boolean hasKey(String key) { |     public static Boolean hasKey(String key) { | ||||||
|         RKeys rKeys = CLIENT.getKeys(); |         RKeys rKeys = CLIENT.getKeys(); | ||||||
|         return rKeys.countExists(key) > 0; |         return rKeys.countExists(getNameMapper().map(key)) > 0; | ||||||
|     } |     } | ||||||
| } | } | ||||||
|   | |||||||
| @@ -5,7 +5,7 @@ | |||||||
|     <parent> |     <parent> | ||||||
|         <artifactId>ruoyi-vue-plus</artifactId> |         <artifactId>ruoyi-vue-plus</artifactId> | ||||||
|         <groupId>com.ruoyi</groupId> |         <groupId>com.ruoyi</groupId> | ||||||
|         <version>4.2.0</version> |         <version>4.3.0-beta2</version> | ||||||
|     </parent> |     </parent> | ||||||
|     <modelVersion>4.0.0</modelVersion> |     <modelVersion>4.0.0</modelVersion> | ||||||
|  |  | ||||||
|   | |||||||
| @@ -2,9 +2,6 @@ package com.ruoyi.demo.controller; | |||||||
|  |  | ||||||
| import com.ruoyi.common.core.domain.R; | import com.ruoyi.common.core.domain.R; | ||||||
| import com.ruoyi.common.utils.email.MailUtils; | import com.ruoyi.common.utils.email.MailUtils; | ||||||
| import io.swagger.annotations.Api; |  | ||||||
| import io.swagger.annotations.ApiOperation; |  | ||||||
| import io.swagger.annotations.ApiParam; |  | ||||||
| import lombok.RequiredArgsConstructor; | import lombok.RequiredArgsConstructor; | ||||||
| import org.springframework.validation.annotation.Validated; | import org.springframework.validation.annotation.Validated; | ||||||
| import org.springframework.web.bind.annotation.GetMapping; | import org.springframework.web.bind.annotation.GetMapping; | ||||||
| @@ -20,27 +17,34 @@ import java.io.File; | |||||||
|  * @author Michelle.Chung |  * @author Michelle.Chung | ||||||
|  */ |  */ | ||||||
| @Validated | @Validated | ||||||
| @Api(value = "邮件发送案例", tags = {"邮件发送案例"}) |  | ||||||
| @RequiredArgsConstructor | @RequiredArgsConstructor | ||||||
| @RestController | @RestController | ||||||
| @RequestMapping("/demo/mail") | @RequestMapping("/demo/mail") | ||||||
| public class MailController { | public class MailController { | ||||||
|  |  | ||||||
|     @ApiOperation("发送邮件") |     /** | ||||||
|  |      * 发送邮件 | ||||||
|  |      * | ||||||
|  |      * @param to      接收人 | ||||||
|  |      * @param subject 标题 | ||||||
|  |      * @param text    内容 | ||||||
|  |      */ | ||||||
|     @GetMapping("/sendSimpleMessage") |     @GetMapping("/sendSimpleMessage") | ||||||
|     public R<Void> sendSimpleMessage(@ApiParam("接收人") String to, |     public R<Void> sendSimpleMessage(String to, String subject, String text) { | ||||||
|                                      @ApiParam("标题") String subject, |  | ||||||
|                                      @ApiParam("内容") String text) { |  | ||||||
|         MailUtils.sendText(to, subject, text); |         MailUtils.sendText(to, subject, text); | ||||||
|         return R.ok(); |         return R.ok(); | ||||||
|     } |     } | ||||||
|  |  | ||||||
|     @ApiOperation("发送邮件(带附件)") |     /** | ||||||
|  |      * 发送邮件(带附件) | ||||||
|  |      * | ||||||
|  |      * @param to       接收人 | ||||||
|  |      * @param subject  标题 | ||||||
|  |      * @param text     内容 | ||||||
|  |      * @param filePath 附件路径 | ||||||
|  |      */ | ||||||
|     @GetMapping("/sendMessageWithAttachment") |     @GetMapping("/sendMessageWithAttachment") | ||||||
|     public R<Void> sendMessageWithAttachment(@ApiParam("接收人") String to, |     public R<Void> sendMessageWithAttachment(String to, String subject, String text, String filePath) { | ||||||
|                                              @ApiParam("标题") String subject, |  | ||||||
|                                              @ApiParam("内容") String text, |  | ||||||
|                                              @ApiParam("附件路径") String filePath) { |  | ||||||
|         MailUtils.sendText(to, subject, text, new File(filePath)); |         MailUtils.sendText(to, subject, text, new File(filePath)); | ||||||
|         return R.ok(); |         return R.ok(); | ||||||
|     } |     } | ||||||
|   | |||||||
| @@ -1,9 +1,8 @@ | |||||||
| package com.ruoyi.demo.controller; | package com.ruoyi.demo.controller; | ||||||
|  |  | ||||||
|  | import com.ruoyi.common.constant.CacheNames; | ||||||
| import com.ruoyi.common.core.domain.R; | import com.ruoyi.common.core.domain.R; | ||||||
| import com.ruoyi.common.utils.redis.RedisUtils; | import com.ruoyi.common.utils.redis.RedisUtils; | ||||||
| import io.swagger.annotations.Api; |  | ||||||
| import io.swagger.annotations.ApiOperation; |  | ||||||
| import lombok.RequiredArgsConstructor; | import lombok.RequiredArgsConstructor; | ||||||
| import org.springframework.cache.annotation.CacheEvict; | import org.springframework.cache.annotation.CacheEvict; | ||||||
| import org.springframework.cache.annotation.CachePut; | import org.springframework.cache.annotation.CachePut; | ||||||
| @@ -20,8 +19,7 @@ import java.time.Duration; | |||||||
|  * @author Lion Li |  * @author Lion Li | ||||||
|  */ |  */ | ||||||
| // 类级别 缓存统一配置 | // 类级别 缓存统一配置 | ||||||
| //@CacheConfig(cacheNames = "redissonCacheMap") | //@CacheConfig(cacheNames = CacheNames.DEMO_CACHE) | ||||||
| @Api(value = "spring-cache 演示案例", tags = {"spring-cache 演示案例"}) |  | ||||||
| @RequiredArgsConstructor | @RequiredArgsConstructor | ||||||
| @RestController | @RestController | ||||||
| @RequestMapping("/demo/cache") | @RequestMapping("/demo/cache") | ||||||
| @@ -39,10 +37,9 @@ public class RedisCacheController { | |||||||
|      * 重点说明: 缓存注解严谨与其他筛选数据功能一起使用 |      * 重点说明: 缓存注解严谨与其他筛选数据功能一起使用 | ||||||
|      * 例如: 数据权限注解 会造成 缓存击穿 与 数据不一致问题 |      * 例如: 数据权限注解 会造成 缓存击穿 与 数据不一致问题 | ||||||
|      * <p> |      * <p> | ||||||
|      * cacheNames 为配置文件内 groupId |      * cacheNames 命名规则 查看 {@link CacheNames} 注释 支持多参数 | ||||||
|      */ |      */ | ||||||
|     @ApiOperation("测试 @Cacheable") |     @Cacheable(cacheNames = "demo:cache#60s#10m#20", key = "#key", condition = "#key != null") | ||||||
|     @Cacheable(cacheNames = "redissonCacheMap", key = "#key", condition = "#key != null") |  | ||||||
|     @GetMapping("/test1") |     @GetMapping("/test1") | ||||||
|     public R<String> test1(String key, String value) { |     public R<String> test1(String key, String value) { | ||||||
|         return R.ok("操作成功", value); |         return R.ok("操作成功", value); | ||||||
| @@ -52,12 +49,11 @@ public class RedisCacheController { | |||||||
|      * 测试 @CachePut |      * 测试 @CachePut | ||||||
|      * <p> |      * <p> | ||||||
|      * 加了@CachePut注解的方法,会把方法的返回值put到缓存里面缓存起来,供其它地方使用 |      * 加了@CachePut注解的方法,会把方法的返回值put到缓存里面缓存起来,供其它地方使用 | ||||||
|      * 它「通常用在新增方法上」 |      * 它「通常用在新增或者实时更新方法上」 | ||||||
|      * <p> |      * <p> | ||||||
|      * cacheNames 为 配置文件内 groupId |      * cacheNames 命名规则 查看 {@link CacheNames} 注释 支持多参数 | ||||||
|      */ |      */ | ||||||
|     @ApiOperation("测试 @CachePut") |     @CachePut(cacheNames = CacheNames.DEMO_CACHE, key = "#key", condition = "#key != null") | ||||||
|     @CachePut(cacheNames = "redissonCacheMap", key = "#key", condition = "#key != null") |  | ||||||
|     @GetMapping("/test2") |     @GetMapping("/test2") | ||||||
|     public R<String> test2(String key, String value) { |     public R<String> test2(String key, String value) { | ||||||
|         return R.ok("操作成功", value); |         return R.ok("操作成功", value); | ||||||
| @@ -67,12 +63,11 @@ public class RedisCacheController { | |||||||
|      * 测试 @CacheEvict |      * 测试 @CacheEvict | ||||||
|      * <p> |      * <p> | ||||||
|      * 使用了CacheEvict注解的方法,会清空指定缓存 |      * 使用了CacheEvict注解的方法,会清空指定缓存 | ||||||
|      * 「一般用在更新或者删除的方法上」 |      * 「一般用在删除的方法上」 | ||||||
|      * <p> |      * <p> | ||||||
|      * cacheNames 为 配置文件内 groupId |      * cacheNames 命名规则 查看 {@link CacheNames} 注释 支持多参数 | ||||||
|      */ |      */ | ||||||
|     @ApiOperation("测试 @CacheEvict") |     @CacheEvict(cacheNames = CacheNames.DEMO_CACHE, key = "#key", condition = "#key != null") | ||||||
|     @CacheEvict(cacheNames = "redissonCacheMap", key = "#key", condition = "#key != null") |  | ||||||
|     @GetMapping("/test3") |     @GetMapping("/test3") | ||||||
|     public R<String> test3(String key, String value) { |     public R<String> test3(String key, String value) { | ||||||
|         return R.ok("操作成功", value); |         return R.ok("操作成功", value); | ||||||
| @@ -83,7 +78,6 @@ public class RedisCacheController { | |||||||
|      * 手动设置过期时间10秒 |      * 手动设置过期时间10秒 | ||||||
|      * 11秒后获取 判断是否相等 |      * 11秒后获取 判断是否相等 | ||||||
|      */ |      */ | ||||||
|     @ApiOperation("测试设置过期时间") |  | ||||||
|     @GetMapping("/test6") |     @GetMapping("/test6") | ||||||
|     public R<Boolean> test6(String key, String value) { |     public R<Boolean> test6(String key, String value) { | ||||||
|         RedisUtils.setCacheObject(key, value); |         RedisUtils.setCacheObject(key, value); | ||||||
|   | |||||||
| @@ -5,8 +5,6 @@ import com.baomidou.lock.LockTemplate; | |||||||
| import com.baomidou.lock.annotation.Lock4j; | import com.baomidou.lock.annotation.Lock4j; | ||||||
| import com.baomidou.lock.executor.RedissonLockExecutor; | import com.baomidou.lock.executor.RedissonLockExecutor; | ||||||
| import com.ruoyi.common.core.domain.R; | import com.ruoyi.common.core.domain.R; | ||||||
| import io.swagger.annotations.Api; |  | ||||||
| import io.swagger.annotations.ApiOperation; |  | ||||||
| import lombok.extern.slf4j.Slf4j; | import lombok.extern.slf4j.Slf4j; | ||||||
| import org.springframework.beans.factory.annotation.Autowired; | import org.springframework.beans.factory.annotation.Autowired; | ||||||
| import org.springframework.web.bind.annotation.GetMapping; | import org.springframework.web.bind.annotation.GetMapping; | ||||||
| @@ -21,7 +19,6 @@ import java.time.LocalTime; | |||||||
|  * |  * | ||||||
|  * @author shenxinquan |  * @author shenxinquan | ||||||
|  */ |  */ | ||||||
| @Api(value = "测试分布式锁的样例", tags = {"测试分布式锁的样例"}) |  | ||||||
| @Slf4j | @Slf4j | ||||||
| @RestController | @RestController | ||||||
| @RequestMapping("/demo/redisLock") | @RequestMapping("/demo/redisLock") | ||||||
| @@ -33,7 +30,6 @@ public class RedisLockController { | |||||||
|     /** |     /** | ||||||
|      * 测试lock4j 注解 |      * 测试lock4j 注解 | ||||||
|      */ |      */ | ||||||
|     @ApiOperation("测试lock4j 注解") |  | ||||||
|     @Lock4j(keys = {"#key"}) |     @Lock4j(keys = {"#key"}) | ||||||
|     @GetMapping("/testLock4j") |     @GetMapping("/testLock4j") | ||||||
|     public R<String> testLock4j(String key, String value) { |     public R<String> testLock4j(String key, String value) { | ||||||
| @@ -50,7 +46,6 @@ public class RedisLockController { | |||||||
|     /** |     /** | ||||||
|      * 测试lock4j 工具 |      * 测试lock4j 工具 | ||||||
|      */ |      */ | ||||||
|     @ApiOperation("测试lock4j 工具") |  | ||||||
|     @GetMapping("/testLock4jLockTemplate") |     @GetMapping("/testLock4jLockTemplate") | ||||||
|     public R<String> testLock4jLockTemplate(String key, String value) { |     public R<String> testLock4jLockTemplate(String key, String value) { | ||||||
|         final LockInfo lockInfo = lockTemplate.lock(key, 30000L, 5000L, RedissonLockExecutor.class); |         final LockInfo lockInfo = lockTemplate.lock(key, 30000L, 5000L, RedissonLockExecutor.class); | ||||||
|   | |||||||
| @@ -2,9 +2,6 @@ package com.ruoyi.demo.controller; | |||||||
|  |  | ||||||
| import com.ruoyi.common.core.domain.R; | import com.ruoyi.common.core.domain.R; | ||||||
| import com.ruoyi.common.utils.redis.RedisUtils; | import com.ruoyi.common.utils.redis.RedisUtils; | ||||||
| import io.swagger.annotations.Api; |  | ||||||
| import io.swagger.annotations.ApiOperation; |  | ||||||
| import io.swagger.annotations.ApiParam; |  | ||||||
| import lombok.RequiredArgsConstructor; | import lombok.RequiredArgsConstructor; | ||||||
| import org.springframework.web.bind.annotation.GetMapping; | import org.springframework.web.bind.annotation.GetMapping; | ||||||
| import org.springframework.web.bind.annotation.RequestMapping; | import org.springframework.web.bind.annotation.RequestMapping; | ||||||
| @@ -15,24 +12,32 @@ import org.springframework.web.bind.annotation.RestController; | |||||||
|  * |  * | ||||||
|  * @author Lion Li |  * @author Lion Li | ||||||
|  */ |  */ | ||||||
| @Api(value = "Redis发布订阅 演示案例", tags = {"Redis发布订阅"}) |  | ||||||
| @RequiredArgsConstructor | @RequiredArgsConstructor | ||||||
| @RestController | @RestController | ||||||
| @RequestMapping("/demo/redis/pubsub") | @RequestMapping("/demo/redis/pubsub") | ||||||
| public class RedisPubSubController { | public class RedisPubSubController { | ||||||
|  |  | ||||||
|     @ApiOperation("发布消息") |     /** | ||||||
|  |      * 发布消息 | ||||||
|  |      * | ||||||
|  |      * @param key   通道Key | ||||||
|  |      * @param value 发送内容 | ||||||
|  |      */ | ||||||
|     @GetMapping("/pub") |     @GetMapping("/pub") | ||||||
|     public R<Void> pub(@ApiParam("通道Key") String key, @ApiParam("发送内容") String value) { |     public R<Void> pub(String key, String value) { | ||||||
|         RedisUtils.publish(key, value, consumer -> { |         RedisUtils.publish(key, value, consumer -> { | ||||||
|             System.out.println("发布通道 => " + key + ", 发送值 => " + value); |             System.out.println("发布通道 => " + key + ", 发送值 => " + value); | ||||||
|         }); |         }); | ||||||
|         return R.ok("操作成功"); |         return R.ok("操作成功"); | ||||||
|     } |     } | ||||||
|  |  | ||||||
|     @ApiOperation("订阅消息") |     /** | ||||||
|  |      * 订阅消息 | ||||||
|  |      * | ||||||
|  |      * @param key 通道Key | ||||||
|  |      */ | ||||||
|     @GetMapping("/sub") |     @GetMapping("/sub") | ||||||
|     public R<Void> sub(@ApiParam("通道Key") String key) { |     public R<Void> sub(String key) { | ||||||
|         RedisUtils.subscribe(key, String.class, msg -> { |         RedisUtils.subscribe(key, String.class, msg -> { | ||||||
|             System.out.println("订阅通道 => " + key + ", 接收值 => " + msg); |             System.out.println("订阅通道 => " + key + ", 接收值 => " + msg); | ||||||
|         }); |         }); | ||||||
|   | |||||||
| @@ -3,8 +3,6 @@ package com.ruoyi.demo.controller; | |||||||
| import com.ruoyi.common.annotation.RateLimiter; | import com.ruoyi.common.annotation.RateLimiter; | ||||||
| import com.ruoyi.common.core.domain.R; | import com.ruoyi.common.core.domain.R; | ||||||
| import com.ruoyi.common.enums.LimitType; | import com.ruoyi.common.enums.LimitType; | ||||||
| import io.swagger.annotations.Api; |  | ||||||
| import io.swagger.annotations.ApiOperation; |  | ||||||
| import lombok.extern.slf4j.Slf4j; | import lombok.extern.slf4j.Slf4j; | ||||||
| import org.springframework.web.bind.annotation.GetMapping; | import org.springframework.web.bind.annotation.GetMapping; | ||||||
| import org.springframework.web.bind.annotation.RequestMapping; | import org.springframework.web.bind.annotation.RequestMapping; | ||||||
| @@ -16,7 +14,6 @@ import org.springframework.web.bind.annotation.RestController; | |||||||
|  * |  * | ||||||
|  * @author Lion Li |  * @author Lion Li | ||||||
|  */ |  */ | ||||||
| @Api(value = "测试分布式限流样例", tags = {"测试分布式限流样例"}) |  | ||||||
| @Slf4j | @Slf4j | ||||||
| @RestController | @RestController | ||||||
| @RequestMapping("/demo/rateLimiter") | @RequestMapping("/demo/rateLimiter") | ||||||
| @@ -26,7 +23,6 @@ public class RedisRateLimiterController { | |||||||
|      * 测试全局限流 |      * 测试全局限流 | ||||||
|      * 全局影响 |      * 全局影响 | ||||||
|      */ |      */ | ||||||
|     @ApiOperation("测试全局限流") |  | ||||||
|     @RateLimiter(count = 2, time = 10) |     @RateLimiter(count = 2, time = 10) | ||||||
|     @GetMapping("/test") |     @GetMapping("/test") | ||||||
|     public R<String> test(String value) { |     public R<String> test(String value) { | ||||||
| @@ -37,7 +33,6 @@ public class RedisRateLimiterController { | |||||||
|      * 测试请求IP限流 |      * 测试请求IP限流 | ||||||
|      * 同一IP请求受影响 |      * 同一IP请求受影响 | ||||||
|      */ |      */ | ||||||
|     @ApiOperation("测试请求IP限流") |  | ||||||
|     @RateLimiter(count = 2, time = 10, limitType = LimitType.IP) |     @RateLimiter(count = 2, time = 10, limitType = LimitType.IP) | ||||||
|     @GetMapping("/testip") |     @GetMapping("/testip") | ||||||
|     public R<String> testip(String value) { |     public R<String> testip(String value) { | ||||||
| @@ -48,7 +43,6 @@ public class RedisRateLimiterController { | |||||||
|      * 测试集群实例限流 |      * 测试集群实例限流 | ||||||
|      * 启动两个后端服务互不影响 |      * 启动两个后端服务互不影响 | ||||||
|      */ |      */ | ||||||
|     @ApiOperation("测试集群实例限流") |  | ||||||
|     @RateLimiter(count = 2, time = 10, limitType = LimitType.CLUSTER) |     @RateLimiter(count = 2, time = 10, limitType = LimitType.CLUSTER) | ||||||
|     @GetMapping("/testcluster") |     @GetMapping("/testcluster") | ||||||
|     public R<String> testcluster(String value) { |     public R<String> testcluster(String value) { | ||||||
|   | |||||||
| @@ -4,9 +4,6 @@ import com.ruoyi.common.core.domain.R; | |||||||
| import com.ruoyi.common.utils.spring.SpringUtils; | import com.ruoyi.common.utils.spring.SpringUtils; | ||||||
| import com.ruoyi.sms.config.properties.SmsProperties; | import com.ruoyi.sms.config.properties.SmsProperties; | ||||||
| import com.ruoyi.sms.core.SmsTemplate; | import com.ruoyi.sms.core.SmsTemplate; | ||||||
| import io.swagger.annotations.Api; |  | ||||||
| import io.swagger.annotations.ApiOperation; |  | ||||||
| import io.swagger.annotations.ApiParam; |  | ||||||
| import lombok.RequiredArgsConstructor; | import lombok.RequiredArgsConstructor; | ||||||
| import org.springframework.validation.annotation.Validated; | import org.springframework.validation.annotation.Validated; | ||||||
| import org.springframework.web.bind.annotation.GetMapping; | import org.springframework.web.bind.annotation.GetMapping; | ||||||
| @@ -24,7 +21,6 @@ import java.util.Map; | |||||||
|  * @version 4.2.0 |  * @version 4.2.0 | ||||||
|  */ |  */ | ||||||
| @Validated | @Validated | ||||||
| @Api(value = "短信演示案例", tags = {"短信演示案例"}) |  | ||||||
| @RequiredArgsConstructor | @RequiredArgsConstructor | ||||||
| @RestController | @RestController | ||||||
| @RequestMapping("/demo/sms") | @RequestMapping("/demo/sms") | ||||||
| @@ -34,10 +30,14 @@ public class SmsController { | |||||||
| //    private final SmsTemplate smsTemplate; // 可以使用spring注入 | //    private final SmsTemplate smsTemplate; // 可以使用spring注入 | ||||||
| //    private final AliyunSmsTemplate smsTemplate; // 也可以注入某个厂家的模板工具 | //    private final AliyunSmsTemplate smsTemplate; // 也可以注入某个厂家的模板工具 | ||||||
|  |  | ||||||
|     @ApiOperation("发送短信Aliyun") |     /** | ||||||
|  |      * 发送短信Aliyun | ||||||
|  |      * | ||||||
|  |      * @param phones     电话号 | ||||||
|  |      * @param templateId 模板ID | ||||||
|  |      */ | ||||||
|     @GetMapping("/sendAliyun") |     @GetMapping("/sendAliyun") | ||||||
|     public R<Object> sendAliyun(@ApiParam("电话号") String phones, |     public R<Object> sendAliyun(String phones, String templateId) { | ||||||
|                                      @ApiParam("模板ID") String templateId) { |  | ||||||
|         if (!smsProperties.getEnabled()) { |         if (!smsProperties.getEnabled()) { | ||||||
|             return R.fail("当前系统没有开启短信功能!"); |             return R.fail("当前系统没有开启短信功能!"); | ||||||
|         } |         } | ||||||
| @@ -51,10 +51,14 @@ public class SmsController { | |||||||
|         return R.ok(send); |         return R.ok(send); | ||||||
|     } |     } | ||||||
|  |  | ||||||
|     @ApiOperation("发送短信Tencent") |     /** | ||||||
|  |      * 发送短信Tencent | ||||||
|  |      * | ||||||
|  |      * @param phones     电话号 | ||||||
|  |      * @param templateId 模板ID | ||||||
|  |      */ | ||||||
|     @GetMapping("/sendTencent") |     @GetMapping("/sendTencent") | ||||||
|     public R<Object> sendTencent(@ApiParam("电话号") String phones, |     public R<Object> sendTencent(String phones, String templateId) { | ||||||
|                                              @ApiParam("模板ID") String templateId) { |  | ||||||
|         if (!smsProperties.getEnabled()) { |         if (!smsProperties.getEnabled()) { | ||||||
|             return R.fail("当前系统没有开启短信功能!"); |             return R.fail("当前系统没有开启短信功能!"); | ||||||
|         } |         } | ||||||
|   | |||||||
| @@ -1,24 +1,18 @@ | |||||||
| package com.ruoyi.demo.controller; | package com.ruoyi.demo.controller; | ||||||
|  |  | ||||||
| import com.ruoyi.common.core.domain.R; | import com.ruoyi.common.core.domain.R; | ||||||
| import io.swagger.annotations.Api; | import org.springframework.http.MediaType; | ||||||
| import io.swagger.annotations.ApiImplicitParam; |  | ||||||
| import io.swagger.annotations.ApiImplicitParams; |  | ||||||
| import io.swagger.annotations.ApiOperation; |  | ||||||
| import org.springframework.web.bind.annotation.PostMapping; | import org.springframework.web.bind.annotation.PostMapping; | ||||||
| import org.springframework.web.bind.annotation.RequestMapping; | import org.springframework.web.bind.annotation.RequestMapping; | ||||||
| import org.springframework.web.bind.annotation.RequestPart; | import org.springframework.web.bind.annotation.RequestPart; | ||||||
| import org.springframework.web.bind.annotation.RestController; | import org.springframework.web.bind.annotation.RestController; | ||||||
| import org.springframework.web.multipart.MultipartFile; | import org.springframework.web.multipart.MultipartFile; | ||||||
|  |  | ||||||
| import java.io.File; |  | ||||||
|  |  | ||||||
| /** | /** | ||||||
|  * swagger3 用法示例 |  * swagger3 用法示例 | ||||||
|  * |  * | ||||||
|  * @author Lion Li |  * @author Lion Li | ||||||
|  */ |  */ | ||||||
| @Api(value = "演示swagger3控制器", tags = {"演示swagger3接口"}) |  | ||||||
| @RestController | @RestController | ||||||
| @RequestMapping("/swagger/demo") | @RequestMapping("/swagger/demo") | ||||||
| public class Swagger3DemoController { | public class Swagger3DemoController { | ||||||
| @@ -26,12 +20,10 @@ public class Swagger3DemoController { | |||||||
|     /** |     /** | ||||||
|      * 上传请求 |      * 上传请求 | ||||||
|      * 必须使用 @RequestPart 注解标注为文件 |      * 必须使用 @RequestPart 注解标注为文件 | ||||||
|  |      * | ||||||
|  |      * @param file 文件 | ||||||
|      */ |      */ | ||||||
|     @ApiOperation(value = "通用上传请求") |     @PostMapping(value = "/upload", consumes = MediaType.MULTIPART_FORM_DATA_VALUE) | ||||||
|     @ApiImplicitParams({ |  | ||||||
|         @ApiImplicitParam(name = "file", value = "文件", paramType = "query", dataTypeClass = File.class, required = true) |  | ||||||
|     }) |  | ||||||
|     @PostMapping(value = "/upload") |  | ||||||
|     public R<String> upload(@RequestPart("file") MultipartFile file) { |     public R<String> upload(@RequestPart("file") MultipartFile file) { | ||||||
|         return R.ok("操作成功", file.getOriginalFilename()); |         return R.ok("操作成功", file.getOriginalFilename()); | ||||||
|     } |     } | ||||||
|   | |||||||
| @@ -5,8 +5,6 @@ import com.ruoyi.common.core.controller.BaseController; | |||||||
| import com.ruoyi.common.core.domain.R; | import com.ruoyi.common.core.domain.R; | ||||||
| import com.ruoyi.demo.domain.TestDemo; | import com.ruoyi.demo.domain.TestDemo; | ||||||
| import com.ruoyi.demo.mapper.TestDemoMapper; | import com.ruoyi.demo.mapper.TestDemoMapper; | ||||||
| import io.swagger.annotations.Api; |  | ||||||
| import io.swagger.annotations.ApiOperation; |  | ||||||
| import lombok.RequiredArgsConstructor; | import lombok.RequiredArgsConstructor; | ||||||
| import org.springframework.web.bind.annotation.DeleteMapping; | import org.springframework.web.bind.annotation.DeleteMapping; | ||||||
| import org.springframework.web.bind.annotation.PostMapping; | import org.springframework.web.bind.annotation.PostMapping; | ||||||
| @@ -22,7 +20,6 @@ import java.util.List; | |||||||
|  * @author Lion Li |  * @author Lion Li | ||||||
|  * @date 2021-05-30 |  * @date 2021-05-30 | ||||||
|  */ |  */ | ||||||
| @Api(value = "测试批量方法", tags = {"测试批量方法"}) |  | ||||||
| @RequiredArgsConstructor | @RequiredArgsConstructor | ||||||
| @RestController | @RestController | ||||||
| @RequestMapping("/demo/batch") | @RequestMapping("/demo/batch") | ||||||
| @@ -38,7 +35,6 @@ public class TestBatchController extends BaseController { | |||||||
|      * <p> |      * <p> | ||||||
|      * 3.5.0 版本 增加 rewriteBatchedStatements=true 批处理参数 使 MP 原生批处理可以达到同样的速度 |      * 3.5.0 版本 增加 rewriteBatchedStatements=true 批处理参数 使 MP 原生批处理可以达到同样的速度 | ||||||
|      */ |      */ | ||||||
|     @ApiOperation(value = "新增批量方法") |  | ||||||
|     @PostMapping("/add") |     @PostMapping("/add") | ||||||
| //    @DS("slave") | //    @DS("slave") | ||||||
|     public R<Void> add() { |     public R<Void> add() { | ||||||
| @@ -58,7 +54,6 @@ public class TestBatchController extends BaseController { | |||||||
|      * <p> |      * <p> | ||||||
|      * 3.5.0 版本 增加 rewriteBatchedStatements=true 批处理参数 使 MP 原生批处理可以达到同样的速度 |      * 3.5.0 版本 增加 rewriteBatchedStatements=true 批处理参数 使 MP 原生批处理可以达到同样的速度 | ||||||
|      */ |      */ | ||||||
|     @ApiOperation(value = "新增或更新批量方法") |  | ||||||
|     @PostMapping("/addOrUpdate") |     @PostMapping("/addOrUpdate") | ||||||
| //    @DS("slave") | //    @DS("slave") | ||||||
|     public R<Void> addOrUpdate() { |     public R<Void> addOrUpdate() { | ||||||
| @@ -68,7 +63,8 @@ public class TestBatchController extends BaseController { | |||||||
|             testDemo.setOrderNum(-1); |             testDemo.setOrderNum(-1); | ||||||
|             testDemo.setTestKey("批量新增"); |             testDemo.setTestKey("批量新增"); | ||||||
|             testDemo.setValue("测试新增"); |             testDemo.setValue("测试新增"); | ||||||
|             list.add(testDemo);        } |             list.add(testDemo); | ||||||
|  |         } | ||||||
|         testDemoMapper.insertBatch(list); |         testDemoMapper.insertBatch(list); | ||||||
|         for (int i = 0; i < list.size(); i++) { |         for (int i = 0; i < list.size(); i++) { | ||||||
|             TestDemo testDemo = list.get(i); |             TestDemo testDemo = list.get(i); | ||||||
| @@ -84,7 +80,6 @@ public class TestBatchController extends BaseController { | |||||||
|     /** |     /** | ||||||
|      * 删除批量方法 |      * 删除批量方法 | ||||||
|      */ |      */ | ||||||
|     @ApiOperation(value = "删除批量方法") |  | ||||||
|     @DeleteMapping() |     @DeleteMapping() | ||||||
| //    @DS("slave") | //    @DS("slave") | ||||||
|     public R<Void> remove() { |     public R<Void> remove() { | ||||||
|   | |||||||
| @@ -5,8 +5,8 @@ import cn.hutool.core.bean.BeanUtil; | |||||||
| import com.ruoyi.common.annotation.Log; | import com.ruoyi.common.annotation.Log; | ||||||
| import com.ruoyi.common.annotation.RepeatSubmit; | import com.ruoyi.common.annotation.RepeatSubmit; | ||||||
| import com.ruoyi.common.core.controller.BaseController; | import com.ruoyi.common.core.controller.BaseController; | ||||||
| import com.ruoyi.common.core.domain.R; |  | ||||||
| import com.ruoyi.common.core.domain.PageQuery; | import com.ruoyi.common.core.domain.PageQuery; | ||||||
|  | import com.ruoyi.common.core.domain.R; | ||||||
| import com.ruoyi.common.core.page.TableDataInfo; | import com.ruoyi.common.core.page.TableDataInfo; | ||||||
| import com.ruoyi.common.core.validate.AddGroup; | import com.ruoyi.common.core.validate.AddGroup; | ||||||
| import com.ruoyi.common.core.validate.EditGroup; | import com.ruoyi.common.core.validate.EditGroup; | ||||||
| @@ -20,8 +20,8 @@ import com.ruoyi.demo.domain.bo.TestDemoBo; | |||||||
| import com.ruoyi.demo.domain.bo.TestDemoImportVo; | import com.ruoyi.demo.domain.bo.TestDemoImportVo; | ||||||
| import com.ruoyi.demo.domain.vo.TestDemoVo; | import com.ruoyi.demo.domain.vo.TestDemoVo; | ||||||
| import com.ruoyi.demo.service.ITestDemoService; | import com.ruoyi.demo.service.ITestDemoService; | ||||||
| import io.swagger.annotations.*; |  | ||||||
| import lombok.RequiredArgsConstructor; | import lombok.RequiredArgsConstructor; | ||||||
|  | import org.springframework.http.MediaType; | ||||||
| import org.springframework.validation.annotation.Validated; | import org.springframework.validation.annotation.Validated; | ||||||
| import org.springframework.web.bind.annotation.*; | import org.springframework.web.bind.annotation.*; | ||||||
| import org.springframework.web.multipart.MultipartFile; | import org.springframework.web.multipart.MultipartFile; | ||||||
| @@ -29,7 +29,6 @@ import org.springframework.web.multipart.MultipartFile; | |||||||
| import javax.servlet.http.HttpServletResponse; | import javax.servlet.http.HttpServletResponse; | ||||||
| import javax.validation.constraints.NotEmpty; | import javax.validation.constraints.NotEmpty; | ||||||
| import javax.validation.constraints.NotNull; | import javax.validation.constraints.NotNull; | ||||||
| import java.io.File; |  | ||||||
| import java.util.Arrays; | import java.util.Arrays; | ||||||
| import java.util.List; | import java.util.List; | ||||||
| import java.util.concurrent.TimeUnit; | import java.util.concurrent.TimeUnit; | ||||||
| @@ -41,7 +40,6 @@ import java.util.concurrent.TimeUnit; | |||||||
|  * @date 2021-07-26 |  * @date 2021-07-26 | ||||||
|  */ |  */ | ||||||
| @Validated | @Validated | ||||||
| @Api(value = "测试单表控制器", tags = {"测试单表管理"}) |  | ||||||
| @RequiredArgsConstructor | @RequiredArgsConstructor | ||||||
| @RestController | @RestController | ||||||
| @RequestMapping("/demo/demo") | @RequestMapping("/demo/demo") | ||||||
| @@ -52,7 +50,6 @@ public class TestDemoController extends BaseController { | |||||||
|     /** |     /** | ||||||
|      * 查询测试单表列表 |      * 查询测试单表列表 | ||||||
|      */ |      */ | ||||||
|     @ApiOperation("查询测试单表列表") |  | ||||||
|     @SaCheckPermission("demo:demo:list") |     @SaCheckPermission("demo:demo:list") | ||||||
|     @GetMapping("/list") |     @GetMapping("/list") | ||||||
|     public TableDataInfo<TestDemoVo> list(@Validated(QueryGroup.class) TestDemoBo bo, PageQuery pageQuery) { |     public TableDataInfo<TestDemoVo> list(@Validated(QueryGroup.class) TestDemoBo bo, PageQuery pageQuery) { | ||||||
| @@ -62,20 +59,20 @@ public class TestDemoController extends BaseController { | |||||||
|     /** |     /** | ||||||
|      * 自定义分页查询 |      * 自定义分页查询 | ||||||
|      */ |      */ | ||||||
|     @ApiOperation("自定义分页查询") |  | ||||||
|     @SaCheckPermission("demo:demo:list") |     @SaCheckPermission("demo:demo:list") | ||||||
|     @GetMapping("/page") |     @GetMapping("/page") | ||||||
|     public TableDataInfo<TestDemoVo> page(@Validated(QueryGroup.class) TestDemoBo bo, PageQuery pageQuery) { |     public TableDataInfo<TestDemoVo> page(@Validated(QueryGroup.class) TestDemoBo bo, PageQuery pageQuery) { | ||||||
|         return iTestDemoService.customPageList(bo, pageQuery); |         return iTestDemoService.customPageList(bo, pageQuery); | ||||||
|     } |     } | ||||||
|  |  | ||||||
|     @ApiOperation("导入测试-校验") |     /** | ||||||
|     @ApiImplicitParams({ |      * 导入数据 | ||||||
|         @ApiImplicitParam(name = "file", value = "导入文件", paramType = "query", dataTypeClass = File.class, required = true), |      * | ||||||
|     }) |      * @param file 导入文件 | ||||||
|  |      */ | ||||||
|     @Log(title = "测试单表", businessType = BusinessType.IMPORT) |     @Log(title = "测试单表", businessType = BusinessType.IMPORT) | ||||||
|     @SaCheckPermission("demo:demo:import") |     @SaCheckPermission("demo:demo:import") | ||||||
|     @PostMapping("/importData") |     @PostMapping(value = "/importData", consumes = MediaType.MULTIPART_FORM_DATA_VALUE) | ||||||
|     public R<Void> importData(@RequestPart("file") MultipartFile file) throws Exception { |     public R<Void> importData(@RequestPart("file") MultipartFile file) throws Exception { | ||||||
|         ExcelResult<TestDemoImportVo> excelResult = ExcelUtil.importExcel(file.getInputStream(), TestDemoImportVo.class, true); |         ExcelResult<TestDemoImportVo> excelResult = ExcelUtil.importExcel(file.getInputStream(), TestDemoImportVo.class, true); | ||||||
|         List<TestDemoImportVo> volist = excelResult.getList(); |         List<TestDemoImportVo> volist = excelResult.getList(); | ||||||
| @@ -87,7 +84,6 @@ public class TestDemoController extends BaseController { | |||||||
|     /** |     /** | ||||||
|      * 导出测试单表列表 |      * 导出测试单表列表 | ||||||
|      */ |      */ | ||||||
|     @ApiOperation("导出测试单表列表") |  | ||||||
|     @SaCheckPermission("demo:demo:export") |     @SaCheckPermission("demo:demo:export") | ||||||
|     @Log(title = "测试单表", businessType = BusinessType.EXPORT) |     @Log(title = "测试单表", businessType = BusinessType.EXPORT) | ||||||
|     @PostMapping("/export") |     @PostMapping("/export") | ||||||
| @@ -102,12 +98,12 @@ public class TestDemoController extends BaseController { | |||||||
|  |  | ||||||
|     /** |     /** | ||||||
|      * 获取测试单表详细信息 |      * 获取测试单表详细信息 | ||||||
|  |      * | ||||||
|  |      * @param id 测试ID | ||||||
|      */ |      */ | ||||||
|     @ApiOperation("获取测试单表详细信息") |  | ||||||
|     @SaCheckPermission("demo:demo:query") |     @SaCheckPermission("demo:demo:query") | ||||||
|     @GetMapping("/{id}") |     @GetMapping("/{id}") | ||||||
|     public R<TestDemoVo> getInfo(@ApiParam("测试ID") |     public R<TestDemoVo> getInfo(@NotNull(message = "主键不能为空") | ||||||
|                                           @NotNull(message = "主键不能为空") |  | ||||||
|                                  @PathVariable("id") Long id) { |                                  @PathVariable("id") Long id) { | ||||||
|         return R.ok(iTestDemoService.queryById(id)); |         return R.ok(iTestDemoService.queryById(id)); | ||||||
|     } |     } | ||||||
| @@ -115,7 +111,6 @@ public class TestDemoController extends BaseController { | |||||||
|     /** |     /** | ||||||
|      * 新增测试单表 |      * 新增测试单表 | ||||||
|      */ |      */ | ||||||
|     @ApiOperation("新增测试单表") |  | ||||||
|     @SaCheckPermission("demo:demo:add") |     @SaCheckPermission("demo:demo:add") | ||||||
|     @Log(title = "测试单表", businessType = BusinessType.INSERT) |     @Log(title = "测试单表", businessType = BusinessType.INSERT) | ||||||
|     @RepeatSubmit(interval = 2, timeUnit = TimeUnit.SECONDS, message = "{repeat.submit.message}") |     @RepeatSubmit(interval = 2, timeUnit = TimeUnit.SECONDS, message = "{repeat.submit.message}") | ||||||
| @@ -130,7 +125,6 @@ public class TestDemoController extends BaseController { | |||||||
|     /** |     /** | ||||||
|      * 修改测试单表 |      * 修改测试单表 | ||||||
|      */ |      */ | ||||||
|     @ApiOperation("修改测试单表") |  | ||||||
|     @SaCheckPermission("demo:demo:edit") |     @SaCheckPermission("demo:demo:edit") | ||||||
|     @Log(title = "测试单表", businessType = BusinessType.UPDATE) |     @Log(title = "测试单表", businessType = BusinessType.UPDATE) | ||||||
|     @RepeatSubmit |     @RepeatSubmit | ||||||
| @@ -141,13 +135,13 @@ public class TestDemoController extends BaseController { | |||||||
|  |  | ||||||
|     /** |     /** | ||||||
|      * 删除测试单表 |      * 删除测试单表 | ||||||
|  |      * | ||||||
|  |      * @param ids 测试ID串 | ||||||
|      */ |      */ | ||||||
|     @ApiOperation("删除测试单表") |  | ||||||
|     @SaCheckPermission("demo:demo:remove") |     @SaCheckPermission("demo:demo:remove") | ||||||
|     @Log(title = "测试单表", businessType = BusinessType.DELETE) |     @Log(title = "测试单表", businessType = BusinessType.DELETE) | ||||||
|     @DeleteMapping("/{ids}") |     @DeleteMapping("/{ids}") | ||||||
|     public R<Void> remove(@ApiParam("测试ID串") |     public R<Void> remove(@NotEmpty(message = "主键不能为空") | ||||||
|                                    @NotEmpty(message = "主键不能为空") |  | ||||||
|                           @PathVariable Long[] ids) { |                           @PathVariable Long[] ids) { | ||||||
|         return toAjax(iTestDemoService.deleteWithValidByIds(Arrays.asList(ids), true) ? 1 : 0); |         return toAjax(iTestDemoService.deleteWithValidByIds(Arrays.asList(ids), true) ? 1 : 0); | ||||||
|     } |     } | ||||||
|   | |||||||
| @@ -2,8 +2,6 @@ package com.ruoyi.demo.controller; | |||||||
|  |  | ||||||
| import cn.hutool.core.collection.CollUtil; | import cn.hutool.core.collection.CollUtil; | ||||||
| import com.ruoyi.common.utils.poi.ExcelUtil; | import com.ruoyi.common.utils.poi.ExcelUtil; | ||||||
| import io.swagger.annotations.Api; |  | ||||||
| import io.swagger.annotations.ApiOperation; |  | ||||||
| import lombok.AllArgsConstructor; | import lombok.AllArgsConstructor; | ||||||
| import lombok.Data; | import lombok.Data; | ||||||
| import org.springframework.web.bind.annotation.GetMapping; | import org.springframework.web.bind.annotation.GetMapping; | ||||||
| @@ -21,7 +19,6 @@ import java.util.Map; | |||||||
|  * |  * | ||||||
|  * @author Lion Li |  * @author Lion Li | ||||||
|  */ |  */ | ||||||
| @Api(value = "测试Excel功能", tags = {"测试Excel功能"}) |  | ||||||
| @RestController | @RestController | ||||||
| @RequestMapping("/demo/excel") | @RequestMapping("/demo/excel") | ||||||
| public class TestExcelController { | public class TestExcelController { | ||||||
| @@ -29,7 +26,6 @@ public class TestExcelController { | |||||||
|     /** |     /** | ||||||
|      * 单列表多数据 |      * 单列表多数据 | ||||||
|      */ |      */ | ||||||
|     @ApiOperation(value = "单列表多数据") |  | ||||||
|     @GetMapping("/exportTemplateOne") |     @GetMapping("/exportTemplateOne") | ||||||
|     public void exportTemplateOne(HttpServletResponse response) { |     public void exportTemplateOne(HttpServletResponse response) { | ||||||
|         Map<String, String> map = new HashMap<>(); |         Map<String, String> map = new HashMap<>(); | ||||||
| @@ -49,7 +45,6 @@ public class TestExcelController { | |||||||
|     /** |     /** | ||||||
|      * 多列表多数据 |      * 多列表多数据 | ||||||
|      */ |      */ | ||||||
|     @ApiOperation(value = "多列表多数据") |  | ||||||
|     @GetMapping("/exportTemplateMuliti") |     @GetMapping("/exportTemplateMuliti") | ||||||
|     public void exportTemplateMuliti(HttpServletResponse response) { |     public void exportTemplateMuliti(HttpServletResponse response) { | ||||||
|         Map<String, String> map = new HashMap<>(); |         Map<String, String> map = new HashMap<>(); | ||||||
|   | |||||||
| @@ -2,9 +2,6 @@ package com.ruoyi.demo.controller; | |||||||
|  |  | ||||||
| import com.ruoyi.common.core.domain.R; | import com.ruoyi.common.core.domain.R; | ||||||
| import com.ruoyi.common.utils.MessageUtils; | import com.ruoyi.common.utils.MessageUtils; | ||||||
| import io.swagger.annotations.Api; |  | ||||||
| import io.swagger.annotations.ApiOperation; |  | ||||||
| import io.swagger.annotations.ApiParam; |  | ||||||
| import lombok.Data; | import lombok.Data; | ||||||
| import org.hibernate.validator.constraints.Range; | import org.hibernate.validator.constraints.Range; | ||||||
| import org.springframework.validation.annotation.Validated; | import org.springframework.validation.annotation.Validated; | ||||||
| @@ -22,7 +19,6 @@ import javax.validation.constraints.NotNull; | |||||||
|  * @author Lion Li |  * @author Lion Li | ||||||
|  */ |  */ | ||||||
| @Validated | @Validated | ||||||
| @Api(value = "测试国际化控制器", tags = {"测试国际化管理"}) |  | ||||||
| @RestController | @RestController | ||||||
| @RequestMapping("/demo/i18n") | @RequestMapping("/demo/i18n") | ||||||
| public class TestI18nController { | public class TestI18nController { | ||||||
| @@ -32,10 +28,11 @@ public class TestI18nController { | |||||||
|      * code为 messages.properties 中的 key |      * code为 messages.properties 中的 key | ||||||
|      * <p> |      * <p> | ||||||
|      * 测试使用 user.register.success |      * 测试使用 user.register.success | ||||||
|  |      * | ||||||
|  |      * @param code 国际化code | ||||||
|      */ |      */ | ||||||
|     @ApiOperation("通过code获取国际化内容") |  | ||||||
|     @GetMapping() |     @GetMapping() | ||||||
|     public R<Void> get(@ApiParam("国际化code") String code) { |     public R<Void> get(String code) { | ||||||
|         return R.ok(MessageUtils.message(code)); |         return R.ok(MessageUtils.message(code)); | ||||||
|     } |     } | ||||||
|  |  | ||||||
| @@ -45,7 +42,6 @@ public class TestI18nController { | |||||||
|      * <p> |      * <p> | ||||||
|      * 测试使用 not.null |      * 测试使用 not.null | ||||||
|      */ |      */ | ||||||
|     @ApiOperation("Validator 校验国际化") |  | ||||||
|     @GetMapping("/test1") |     @GetMapping("/test1") | ||||||
|     public R<Void> test1(@NotBlank(message = "{not.null}") String str) { |     public R<Void> test1(@NotBlank(message = "{not.null}") String str) { | ||||||
|         return R.ok(str); |         return R.ok(str); | ||||||
| @@ -57,7 +53,6 @@ public class TestI18nController { | |||||||
|      * <p> |      * <p> | ||||||
|      * 测试使用 not.null |      * 测试使用 not.null | ||||||
|      */ |      */ | ||||||
|     @ApiOperation("Bean 校验国际化") |  | ||||||
|     @GetMapping("/test2") |     @GetMapping("/test2") | ||||||
|     public R<TestI18nBo> test2(@Validated TestI18nBo bo) { |     public R<TestI18nBo> test2(@Validated TestI18nBo bo) { | ||||||
|         return R.ok(bo); |         return R.ok(bo); | ||||||
|   | |||||||
| @@ -4,8 +4,6 @@ import com.ruoyi.common.annotation.Sensitive; | |||||||
| import com.ruoyi.common.core.controller.BaseController; | import com.ruoyi.common.core.controller.BaseController; | ||||||
| import com.ruoyi.common.core.domain.R; | import com.ruoyi.common.core.domain.R; | ||||||
| import com.ruoyi.common.enums.SensitiveStrategy; | import com.ruoyi.common.enums.SensitiveStrategy; | ||||||
| import io.swagger.annotations.Api; |  | ||||||
| import io.swagger.annotations.ApiOperation; |  | ||||||
| import lombok.Data; | import lombok.Data; | ||||||
| import org.springframework.web.bind.annotation.GetMapping; | import org.springframework.web.bind.annotation.GetMapping; | ||||||
| import org.springframework.web.bind.annotation.RequestMapping; | import org.springframework.web.bind.annotation.RequestMapping; | ||||||
| @@ -21,7 +19,6 @@ import org.springframework.web.bind.annotation.RestController; | |||||||
|  * @version 3.6.0 |  * @version 3.6.0 | ||||||
|  * @see com.ruoyi.common.core.service.SensitiveService |  * @see com.ruoyi.common.core.service.SensitiveService | ||||||
|  */ |  */ | ||||||
| @Api(value = "测试数据脱敏控制器", tags = {"测试数据脱敏管理"}) |  | ||||||
| @RestController | @RestController | ||||||
| @RequestMapping("/demo/sensitive") | @RequestMapping("/demo/sensitive") | ||||||
| public class TestSensitiveController extends BaseController { | public class TestSensitiveController extends BaseController { | ||||||
| @@ -29,7 +26,6 @@ public class TestSensitiveController extends BaseController { | |||||||
|     /** |     /** | ||||||
|      * 测试数据脱敏 |      * 测试数据脱敏 | ||||||
|      */ |      */ | ||||||
|     @ApiOperation("查询测试单表列表") |  | ||||||
|     @GetMapping("/test") |     @GetMapping("/test") | ||||||
|     public R<TestSensitive> test() { |     public R<TestSensitive> test() { | ||||||
|         TestSensitive testSensitive = new TestSensitive(); |         TestSensitive testSensitive = new TestSensitive(); | ||||||
|   | |||||||
| @@ -13,9 +13,6 @@ import com.ruoyi.common.utils.poi.ExcelUtil; | |||||||
| import com.ruoyi.demo.domain.bo.TestTreeBo; | import com.ruoyi.demo.domain.bo.TestTreeBo; | ||||||
| import com.ruoyi.demo.domain.vo.TestTreeVo; | import com.ruoyi.demo.domain.vo.TestTreeVo; | ||||||
| import com.ruoyi.demo.service.ITestTreeService; | import com.ruoyi.demo.service.ITestTreeService; | ||||||
| import io.swagger.annotations.Api; |  | ||||||
| import io.swagger.annotations.ApiOperation; |  | ||||||
| import io.swagger.annotations.ApiParam; |  | ||||||
| import lombok.RequiredArgsConstructor; | import lombok.RequiredArgsConstructor; | ||||||
| import org.springframework.validation.annotation.Validated; | import org.springframework.validation.annotation.Validated; | ||||||
| import org.springframework.web.bind.annotation.*; | import org.springframework.web.bind.annotation.*; | ||||||
| @@ -33,7 +30,6 @@ import java.util.List; | |||||||
|  * @date 2021-07-26 |  * @date 2021-07-26 | ||||||
|  */ |  */ | ||||||
| @Validated | @Validated | ||||||
| @Api(value = "测试树表控制器", tags = {"测试树表管理"}) |  | ||||||
| @RequiredArgsConstructor | @RequiredArgsConstructor | ||||||
| @RestController | @RestController | ||||||
| @RequestMapping("/demo/tree") | @RequestMapping("/demo/tree") | ||||||
| @@ -44,7 +40,6 @@ public class TestTreeController extends BaseController { | |||||||
|     /** |     /** | ||||||
|      * 查询测试树表列表 |      * 查询测试树表列表 | ||||||
|      */ |      */ | ||||||
|     @ApiOperation("查询测试树表列表") |  | ||||||
|     @SaCheckPermission("demo:tree:list") |     @SaCheckPermission("demo:tree:list") | ||||||
|     @GetMapping("/list") |     @GetMapping("/list") | ||||||
|     public R<List<TestTreeVo>> list(@Validated(QueryGroup.class) TestTreeBo bo) { |     public R<List<TestTreeVo>> list(@Validated(QueryGroup.class) TestTreeBo bo) { | ||||||
| @@ -55,7 +50,6 @@ public class TestTreeController extends BaseController { | |||||||
|     /** |     /** | ||||||
|      * 导出测试树表列表 |      * 导出测试树表列表 | ||||||
|      */ |      */ | ||||||
|     @ApiOperation("导出测试树表列表") |  | ||||||
|     @SaCheckPermission("demo:tree:export") |     @SaCheckPermission("demo:tree:export") | ||||||
|     @Log(title = "测试树表", businessType = BusinessType.EXPORT) |     @Log(title = "测试树表", businessType = BusinessType.EXPORT) | ||||||
|     @GetMapping("/export") |     @GetMapping("/export") | ||||||
| @@ -66,12 +60,12 @@ public class TestTreeController extends BaseController { | |||||||
|  |  | ||||||
|     /** |     /** | ||||||
|      * 获取测试树表详细信息 |      * 获取测试树表详细信息 | ||||||
|  |      * | ||||||
|  |      * @param id 测试树ID | ||||||
|      */ |      */ | ||||||
|     @ApiOperation("获取测试树表详细信息") |  | ||||||
|     @SaCheckPermission("demo:tree:query") |     @SaCheckPermission("demo:tree:query") | ||||||
|     @GetMapping("/{id}") |     @GetMapping("/{id}") | ||||||
|     public R<TestTreeVo> getInfo(@ApiParam("测试树ID") |     public R<TestTreeVo> getInfo(@NotNull(message = "主键不能为空") | ||||||
|                                           @NotNull(message = "主键不能为空") |  | ||||||
|                                  @PathVariable("id") Long id) { |                                  @PathVariable("id") Long id) { | ||||||
|         return R.ok(iTestTreeService.queryById(id)); |         return R.ok(iTestTreeService.queryById(id)); | ||||||
|     } |     } | ||||||
| @@ -79,7 +73,6 @@ public class TestTreeController extends BaseController { | |||||||
|     /** |     /** | ||||||
|      * 新增测试树表 |      * 新增测试树表 | ||||||
|      */ |      */ | ||||||
|     @ApiOperation("新增测试树表") |  | ||||||
|     @SaCheckPermission("demo:tree:add") |     @SaCheckPermission("demo:tree:add") | ||||||
|     @Log(title = "测试树表", businessType = BusinessType.INSERT) |     @Log(title = "测试树表", businessType = BusinessType.INSERT) | ||||||
|     @RepeatSubmit |     @RepeatSubmit | ||||||
| @@ -91,7 +84,6 @@ public class TestTreeController extends BaseController { | |||||||
|     /** |     /** | ||||||
|      * 修改测试树表 |      * 修改测试树表 | ||||||
|      */ |      */ | ||||||
|     @ApiOperation("修改测试树表") |  | ||||||
|     @SaCheckPermission("demo:tree:edit") |     @SaCheckPermission("demo:tree:edit") | ||||||
|     @Log(title = "测试树表", businessType = BusinessType.UPDATE) |     @Log(title = "测试树表", businessType = BusinessType.UPDATE) | ||||||
|     @RepeatSubmit |     @RepeatSubmit | ||||||
| @@ -102,13 +94,13 @@ public class TestTreeController extends BaseController { | |||||||
|  |  | ||||||
|     /** |     /** | ||||||
|      * 删除测试树表 |      * 删除测试树表 | ||||||
|  |      * | ||||||
|  |      * @param ids 测试树ID串 | ||||||
|      */ |      */ | ||||||
|     @ApiOperation("删除测试树表") |  | ||||||
|     @SaCheckPermission("demo:tree:remove") |     @SaCheckPermission("demo:tree:remove") | ||||||
|     @Log(title = "测试树表", businessType = BusinessType.DELETE) |     @Log(title = "测试树表", businessType = BusinessType.DELETE) | ||||||
|     @DeleteMapping("/{ids}") |     @DeleteMapping("/{ids}") | ||||||
|     public R<Void> remove(@ApiParam("测试树ID串") |     public R<Void> remove(@NotEmpty(message = "主键不能为空") | ||||||
|                                    @NotEmpty(message = "主键不能为空") |  | ||||||
|                           @PathVariable Long[] ids) { |                           @PathVariable Long[] ids) { | ||||||
|         return toAjax(iTestTreeService.deleteWithValidByIds(Arrays.asList(ids), true) ? 1 : 0); |         return toAjax(iTestTreeService.deleteWithValidByIds(Arrays.asList(ids), true) ? 1 : 0); | ||||||
|     } |     } | ||||||
|   | |||||||
| @@ -2,9 +2,6 @@ package com.ruoyi.demo.controller.queue; | |||||||
|  |  | ||||||
| import com.ruoyi.common.core.domain.R; | import com.ruoyi.common.core.domain.R; | ||||||
| import com.ruoyi.common.utils.redis.QueueUtils; | import com.ruoyi.common.utils.redis.QueueUtils; | ||||||
| import io.swagger.annotations.Api; |  | ||||||
| import io.swagger.annotations.ApiOperation; |  | ||||||
| import io.swagger.annotations.ApiParam; |  | ||||||
| import lombok.RequiredArgsConstructor; | import lombok.RequiredArgsConstructor; | ||||||
| import lombok.extern.slf4j.Slf4j; | import lombok.extern.slf4j.Slf4j; | ||||||
| import org.springframework.web.bind.annotation.GetMapping; | import org.springframework.web.bind.annotation.GetMapping; | ||||||
| @@ -23,17 +20,20 @@ import org.springframework.web.bind.annotation.RestController; | |||||||
|  * @version 3.6.0 |  * @version 3.6.0 | ||||||
|  */ |  */ | ||||||
| @Slf4j | @Slf4j | ||||||
| @Api(value = "有界队列 演示案例", tags = {"有界队列"}) |  | ||||||
| @RequiredArgsConstructor | @RequiredArgsConstructor | ||||||
| @RestController | @RestController | ||||||
| @RequestMapping("/demo/queue/bounded") | @RequestMapping("/demo/queue/bounded") | ||||||
| public class BoundedQueueController { | public class BoundedQueueController { | ||||||
|  |  | ||||||
|  |  | ||||||
|     @ApiOperation("添加队列数据") |     /** | ||||||
|  |      * 添加队列数据 | ||||||
|  |      * | ||||||
|  |      * @param queueName 队列名 | ||||||
|  |      * @param capacity  容量 | ||||||
|  |      */ | ||||||
|     @GetMapping("/add") |     @GetMapping("/add") | ||||||
|     public R<Void> add(@ApiParam("队列名") String queueName, |     public R<Void> add(String queueName, int capacity) { | ||||||
|                                 @ApiParam("容量") int capacity) { |  | ||||||
|         // 用完了一定要销毁 否则会一直存在 |         // 用完了一定要销毁 否则会一直存在 | ||||||
|         boolean b = QueueUtils.destroyBoundedQueueObject(queueName); |         boolean b = QueueUtils.destroyBoundedQueueObject(queueName); | ||||||
|         log.info("通道: {} , 删除: {}", queueName, b); |         log.info("通道: {} , 删除: {}", queueName, b); | ||||||
| @@ -56,9 +56,13 @@ public class BoundedQueueController { | |||||||
|         return R.ok("操作成功"); |         return R.ok("操作成功"); | ||||||
|     } |     } | ||||||
|  |  | ||||||
|     @ApiOperation("删除队列数据") |     /** | ||||||
|  |      * 删除队列数据 | ||||||
|  |      * | ||||||
|  |      * @param queueName 队列名 | ||||||
|  |      */ | ||||||
|     @GetMapping("/remove") |     @GetMapping("/remove") | ||||||
|     public R<Void> remove(@ApiParam("队列名") String queueName) { |     public R<Void> remove(String queueName) { | ||||||
|         String data = "data-" + 5; |         String data = "data-" + 5; | ||||||
|         if (QueueUtils.removeBoundedQueueObject(queueName, data)) { |         if (QueueUtils.removeBoundedQueueObject(queueName, data)) { | ||||||
|             log.info("通道: {} , 删除数据: {}", queueName, data); |             log.info("通道: {} , 删除数据: {}", queueName, data); | ||||||
| @@ -68,9 +72,13 @@ public class BoundedQueueController { | |||||||
|         return R.ok("操作成功"); |         return R.ok("操作成功"); | ||||||
|     } |     } | ||||||
|  |  | ||||||
|     @ApiOperation("获取队列数据") |     /** | ||||||
|  |      * 获取队列数据 | ||||||
|  |      * | ||||||
|  |      * @param queueName 队列名 | ||||||
|  |      */ | ||||||
|     @GetMapping("/get") |     @GetMapping("/get") | ||||||
|     public R<Void> get(@ApiParam("队列名") String queueName) { |     public R<Void> get(String queueName) { | ||||||
|         String data; |         String data; | ||||||
|         do { |         do { | ||||||
|             data = QueueUtils.getBoundedQueueObject(queueName); |             data = QueueUtils.getBoundedQueueObject(queueName); | ||||||
|   | |||||||
| @@ -2,9 +2,6 @@ package com.ruoyi.demo.controller.queue; | |||||||
|  |  | ||||||
| import com.ruoyi.common.core.domain.R; | import com.ruoyi.common.core.domain.R; | ||||||
| import com.ruoyi.common.utils.redis.QueueUtils; | import com.ruoyi.common.utils.redis.QueueUtils; | ||||||
| import io.swagger.annotations.Api; |  | ||||||
| import io.swagger.annotations.ApiOperation; |  | ||||||
| import io.swagger.annotations.ApiParam; |  | ||||||
| import lombok.RequiredArgsConstructor; | import lombok.RequiredArgsConstructor; | ||||||
| import lombok.extern.slf4j.Slf4j; | import lombok.extern.slf4j.Slf4j; | ||||||
| import org.springframework.web.bind.annotation.GetMapping; | import org.springframework.web.bind.annotation.GetMapping; | ||||||
| @@ -26,15 +23,18 @@ import java.util.concurrent.TimeUnit; | |||||||
|  * @version 3.6.0 |  * @version 3.6.0 | ||||||
|  */ |  */ | ||||||
| @Slf4j | @Slf4j | ||||||
| @Api(value = "延迟队列 演示案例", tags = {"延迟队列"}) |  | ||||||
| @RequiredArgsConstructor | @RequiredArgsConstructor | ||||||
| @RestController | @RestController | ||||||
| @RequestMapping("/demo/queue/delayed") | @RequestMapping("/demo/queue/delayed") | ||||||
| public class DelayedQueueController { | public class DelayedQueueController { | ||||||
|  |  | ||||||
|     @ApiOperation("订阅队列") |     /** | ||||||
|  |      * 订阅队列 | ||||||
|  |      * | ||||||
|  |      * @param queueName 队列名 | ||||||
|  |      */ | ||||||
|     @GetMapping("/subscribe") |     @GetMapping("/subscribe") | ||||||
|     public R<Void> subscribe(@ApiParam("队列名") String queueName) { |     public R<Void> subscribe(String queueName) { | ||||||
|         log.info("通道: {} 监听中......", queueName); |         log.info("通道: {} 监听中......", queueName); | ||||||
|         // 项目初始化设置一次即可 |         // 项目初始化设置一次即可 | ||||||
|         QueueUtils.subscribeBlockingQueue(queueName, (String orderNum) -> { |         QueueUtils.subscribeBlockingQueue(queueName, (String orderNum) -> { | ||||||
| @@ -44,21 +44,29 @@ public class DelayedQueueController { | |||||||
|         return R.ok("操作成功"); |         return R.ok("操作成功"); | ||||||
|     } |     } | ||||||
|  |  | ||||||
|     @ApiOperation("添加队列数据") |     /** | ||||||
|  |      * 添加队列数据 | ||||||
|  |      * | ||||||
|  |      * @param queueName 队列名 | ||||||
|  |      * @param orderNum  订单号 | ||||||
|  |      * @param time      延迟时间(秒) | ||||||
|  |      */ | ||||||
|     @GetMapping("/add") |     @GetMapping("/add") | ||||||
|     public R<Void> add(@ApiParam("队列名") String queueName, |     public R<Void> add(String queueName, String orderNum, Long time) { | ||||||
|                                 @ApiParam("订单号") String orderNum, |  | ||||||
|                                 @ApiParam("延迟时间(秒)") Long time) { |  | ||||||
|         QueueUtils.addDelayedQueueObject(queueName, orderNum, time, TimeUnit.SECONDS); |         QueueUtils.addDelayedQueueObject(queueName, orderNum, time, TimeUnit.SECONDS); | ||||||
|         // 观察发送时间 |         // 观察发送时间 | ||||||
|         log.info("通道: {} , 发送数据: {}", queueName, orderNum); |         log.info("通道: {} , 发送数据: {}", queueName, orderNum); | ||||||
|         return R.ok("操作成功"); |         return R.ok("操作成功"); | ||||||
|     } |     } | ||||||
|  |  | ||||||
|     @ApiOperation("删除队列数据") |     /** | ||||||
|  |      * 删除队列数据 | ||||||
|  |      * | ||||||
|  |      * @param queueName 队列名 | ||||||
|  |      * @param orderNum  订单号 | ||||||
|  |      */ | ||||||
|     @GetMapping("/remove") |     @GetMapping("/remove") | ||||||
|     public R<Void> remove(@ApiParam("队列名") String queueName, |     public R<Void> remove(String queueName, String orderNum) { | ||||||
|                                    @ApiParam("订单号") String orderNum) { |  | ||||||
|         if (QueueUtils.removeDelayedQueueObject(queueName, orderNum)) { |         if (QueueUtils.removeDelayedQueueObject(queueName, orderNum)) { | ||||||
|             log.info("通道: {} , 删除数据: {}", queueName, orderNum); |             log.info("通道: {} , 删除数据: {}", queueName, orderNum); | ||||||
|         } else { |         } else { | ||||||
| @@ -67,9 +75,13 @@ public class DelayedQueueController { | |||||||
|         return R.ok("操作成功"); |         return R.ok("操作成功"); | ||||||
|     } |     } | ||||||
|  |  | ||||||
|     @ApiOperation("销毁队列") |     /** | ||||||
|  |      * 销毁队列 | ||||||
|  |      * | ||||||
|  |      * @param queueName 队列名 | ||||||
|  |      */ | ||||||
|     @GetMapping("/destroy") |     @GetMapping("/destroy") | ||||||
|     public R<Void> destroy(@ApiParam("队列名") String queueName) { |     public R<Void> destroy(String queueName) { | ||||||
|         // 用完了一定要销毁 否则会一直存在 |         // 用完了一定要销毁 否则会一直存在 | ||||||
|         QueueUtils.destroyDelayedQueue(queueName); |         QueueUtils.destroyDelayedQueue(queueName); | ||||||
|         return R.ok("操作成功"); |         return R.ok("操作成功"); | ||||||
|   | |||||||
| @@ -3,9 +3,6 @@ package com.ruoyi.demo.controller.queue; | |||||||
| import cn.hutool.core.util.RandomUtil; | import cn.hutool.core.util.RandomUtil; | ||||||
| import com.ruoyi.common.core.domain.R; | import com.ruoyi.common.core.domain.R; | ||||||
| import com.ruoyi.common.utils.redis.QueueUtils; | import com.ruoyi.common.utils.redis.QueueUtils; | ||||||
| import io.swagger.annotations.Api; |  | ||||||
| import io.swagger.annotations.ApiOperation; |  | ||||||
| import io.swagger.annotations.ApiParam; |  | ||||||
| import lombok.RequiredArgsConstructor; | import lombok.RequiredArgsConstructor; | ||||||
| import lombok.extern.slf4j.Slf4j; | import lombok.extern.slf4j.Slf4j; | ||||||
| import org.springframework.web.bind.annotation.GetMapping; | import org.springframework.web.bind.annotation.GetMapping; | ||||||
| @@ -24,15 +21,18 @@ import org.springframework.web.bind.annotation.RestController; | |||||||
|  * @version 3.6.0 |  * @version 3.6.0 | ||||||
|  */ |  */ | ||||||
| @Slf4j | @Slf4j | ||||||
| @Api(value = "优先队列 演示案例", tags = {"优先队列"}) |  | ||||||
| @RequiredArgsConstructor | @RequiredArgsConstructor | ||||||
| @RestController | @RestController | ||||||
| @RequestMapping("/demo/queue/priority") | @RequestMapping("/demo/queue/priority") | ||||||
| public class PriorityQueueController { | public class PriorityQueueController { | ||||||
|  |  | ||||||
|     @ApiOperation("添加队列数据") |     /** | ||||||
|  |      * 添加队列数据 | ||||||
|  |      * | ||||||
|  |      * @param queueName 队列名 | ||||||
|  |      */ | ||||||
|     @GetMapping("/add") |     @GetMapping("/add") | ||||||
|     public R<Void> add(@ApiParam("队列名") String queueName) { |     public R<Void> add(String queueName) { | ||||||
|         // 用完了一定要销毁 否则会一直存在 |         // 用完了一定要销毁 否则会一直存在 | ||||||
|         boolean b = QueueUtils.destroyPriorityQueueObject(queueName); |         boolean b = QueueUtils.destroyPriorityQueueObject(queueName); | ||||||
|         log.info("通道: {} , 删除: {}", queueName, b); |         log.info("通道: {} , 删除: {}", queueName, b); | ||||||
| @@ -58,11 +58,15 @@ public class PriorityQueueController { | |||||||
|         return R.ok("操作成功"); |         return R.ok("操作成功"); | ||||||
|     } |     } | ||||||
|  |  | ||||||
|     @ApiOperation("删除队列数据") |     /** | ||||||
|  |      * 删除队列数据 | ||||||
|  |      * | ||||||
|  |      * @param queueName 队列名 | ||||||
|  |      * @param name      对象名 | ||||||
|  |      * @param orderNum  排序号 | ||||||
|  |      */ | ||||||
|     @GetMapping("/remove") |     @GetMapping("/remove") | ||||||
|     public R<Void> remove(@ApiParam("队列名") String queueName, |     public R<Void> remove(String queueName, String name, Integer orderNum) { | ||||||
|                                    @ApiParam("对象名") String name, |  | ||||||
|                                    @ApiParam("排序号") Integer orderNum) { |  | ||||||
|         PriorityDemo data = new PriorityDemo(); |         PriorityDemo data = new PriorityDemo(); | ||||||
|         data.setName(name); |         data.setName(name); | ||||||
|         data.setOrderNum(orderNum); |         data.setOrderNum(orderNum); | ||||||
| @@ -74,9 +78,13 @@ public class PriorityQueueController { | |||||||
|         return R.ok("操作成功"); |         return R.ok("操作成功"); | ||||||
|     } |     } | ||||||
|  |  | ||||||
|     @ApiOperation("获取队列数据") |     /** | ||||||
|  |      * 获取队列数据 | ||||||
|  |      * | ||||||
|  |      * @param queueName 队列名 | ||||||
|  |      */ | ||||||
|     @GetMapping("/get") |     @GetMapping("/get") | ||||||
|     public R<Void> get(@ApiParam("队列名") String queueName) { |     public R<Void> get(String queueName) { | ||||||
|         PriorityDemo data; |         PriorityDemo data; | ||||||
|         do { |         do { | ||||||
|             data = QueueUtils.getPriorityQueueObject(queueName); |             data = QueueUtils.getPriorityQueueObject(queueName); | ||||||
|   | |||||||
| @@ -3,8 +3,6 @@ package com.ruoyi.demo.domain.bo; | |||||||
| import com.ruoyi.common.core.domain.BaseEntity; | import com.ruoyi.common.core.domain.BaseEntity; | ||||||
| import com.ruoyi.common.core.validate.AddGroup; | import com.ruoyi.common.core.validate.AddGroup; | ||||||
| import com.ruoyi.common.core.validate.EditGroup; | import com.ruoyi.common.core.validate.EditGroup; | ||||||
| import io.swagger.annotations.ApiModel; |  | ||||||
| import io.swagger.annotations.ApiModelProperty; |  | ||||||
| import lombok.Data; | import lombok.Data; | ||||||
| import lombok.EqualsAndHashCode; | import lombok.EqualsAndHashCode; | ||||||
|  |  | ||||||
| @@ -20,48 +18,41 @@ import javax.validation.constraints.NotNull; | |||||||
|  |  | ||||||
| @Data | @Data | ||||||
| @EqualsAndHashCode(callSuper = true) | @EqualsAndHashCode(callSuper = true) | ||||||
| @ApiModel("测试单表业务对象") |  | ||||||
| public class TestDemoBo extends BaseEntity { | public class TestDemoBo extends BaseEntity { | ||||||
|  |  | ||||||
|     /** |     /** | ||||||
|      * 主键 |      * 主键 | ||||||
|      */ |      */ | ||||||
|     @ApiModelProperty("主键") |  | ||||||
|     @NotNull(message = "主键不能为空", groups = {EditGroup.class}) |     @NotNull(message = "主键不能为空", groups = {EditGroup.class}) | ||||||
|     private Long id; |     private Long id; | ||||||
|  |  | ||||||
|     /** |     /** | ||||||
|      * 部门id |      * 部门id | ||||||
|      */ |      */ | ||||||
|     @ApiModelProperty("部门id") |  | ||||||
|     @NotNull(message = "部门id不能为空", groups = {AddGroup.class, EditGroup.class}) |     @NotNull(message = "部门id不能为空", groups = {AddGroup.class, EditGroup.class}) | ||||||
|     private Long deptId; |     private Long deptId; | ||||||
|  |  | ||||||
|     /** |     /** | ||||||
|      * 用户id |      * 用户id | ||||||
|      */ |      */ | ||||||
|     @ApiModelProperty("用户id") |  | ||||||
|     @NotNull(message = "用户id不能为空", groups = {AddGroup.class, EditGroup.class}) |     @NotNull(message = "用户id不能为空", groups = {AddGroup.class, EditGroup.class}) | ||||||
|     private Long userId; |     private Long userId; | ||||||
|  |  | ||||||
|     /** |     /** | ||||||
|      * 排序号 |      * 排序号 | ||||||
|      */ |      */ | ||||||
|     @ApiModelProperty("排序号") |  | ||||||
|     @NotNull(message = "排序号不能为空", groups = {AddGroup.class, EditGroup.class}) |     @NotNull(message = "排序号不能为空", groups = {AddGroup.class, EditGroup.class}) | ||||||
|     private Integer orderNum; |     private Integer orderNum; | ||||||
|  |  | ||||||
|     /** |     /** | ||||||
|      * key键 |      * key键 | ||||||
|      */ |      */ | ||||||
|     @ApiModelProperty("key键") |  | ||||||
|     @NotBlank(message = "key键不能为空", groups = {AddGroup.class, EditGroup.class}) |     @NotBlank(message = "key键不能为空", groups = {AddGroup.class, EditGroup.class}) | ||||||
|     private String testKey; |     private String testKey; | ||||||
|  |  | ||||||
|     /** |     /** | ||||||
|      * 值 |      * 值 | ||||||
|      */ |      */ | ||||||
|     @ApiModelProperty("值") |  | ||||||
|     @NotBlank(message = "值不能为空", groups = {AddGroup.class, EditGroup.class}) |     @NotBlank(message = "值不能为空", groups = {AddGroup.class, EditGroup.class}) | ||||||
|     private String value; |     private String value; | ||||||
|  |  | ||||||
|   | |||||||
| @@ -1,8 +1,6 @@ | |||||||
| package com.ruoyi.demo.domain.bo; | package com.ruoyi.demo.domain.bo; | ||||||
|  |  | ||||||
| import com.alibaba.excel.annotation.ExcelProperty; | import com.alibaba.excel.annotation.ExcelProperty; | ||||||
| import io.swagger.annotations.ApiModel; |  | ||||||
| import io.swagger.annotations.ApiModelProperty; |  | ||||||
| import lombok.Data; | import lombok.Data; | ||||||
|  |  | ||||||
| import javax.validation.constraints.NotBlank; | import javax.validation.constraints.NotBlank; | ||||||
| @@ -15,13 +13,11 @@ import javax.validation.constraints.NotNull; | |||||||
|  * @date 2021-07-26 |  * @date 2021-07-26 | ||||||
|  */ |  */ | ||||||
| @Data | @Data | ||||||
| @ApiModel("测试单表业务对象") |  | ||||||
| public class TestDemoImportVo { | public class TestDemoImportVo { | ||||||
|  |  | ||||||
|     /** |     /** | ||||||
|      * 部门id |      * 部门id | ||||||
|      */ |      */ | ||||||
|     @ApiModelProperty("部门id") |  | ||||||
|     @NotNull(message = "部门id不能为空") |     @NotNull(message = "部门id不能为空") | ||||||
|     @ExcelProperty(value = "部门id") |     @ExcelProperty(value = "部门id") | ||||||
|     private Long deptId; |     private Long deptId; | ||||||
| @@ -29,7 +25,6 @@ public class TestDemoImportVo { | |||||||
|     /** |     /** | ||||||
|      * 用户id |      * 用户id | ||||||
|      */ |      */ | ||||||
|     @ApiModelProperty("用户id") |  | ||||||
|     @NotNull(message = "用户id不能为空") |     @NotNull(message = "用户id不能为空") | ||||||
|     @ExcelProperty(value = "用户id") |     @ExcelProperty(value = "用户id") | ||||||
|     private Long userId; |     private Long userId; | ||||||
| @@ -37,7 +32,6 @@ public class TestDemoImportVo { | |||||||
|     /** |     /** | ||||||
|      * 排序号 |      * 排序号 | ||||||
|      */ |      */ | ||||||
|     @ApiModelProperty("排序号") |  | ||||||
|     @NotNull(message = "排序号不能为空") |     @NotNull(message = "排序号不能为空") | ||||||
|     @ExcelProperty(value = "排序号") |     @ExcelProperty(value = "排序号") | ||||||
|     private Long orderNum; |     private Long orderNum; | ||||||
| @@ -45,7 +39,6 @@ public class TestDemoImportVo { | |||||||
|     /** |     /** | ||||||
|      * key键 |      * key键 | ||||||
|      */ |      */ | ||||||
|     @ApiModelProperty("key键") |  | ||||||
|     @NotBlank(message = "key键不能为空") |     @NotBlank(message = "key键不能为空") | ||||||
|     @ExcelProperty(value = "key键") |     @ExcelProperty(value = "key键") | ||||||
|     private String testKey; |     private String testKey; | ||||||
| @@ -53,7 +46,6 @@ public class TestDemoImportVo { | |||||||
|     /** |     /** | ||||||
|      * 值 |      * 值 | ||||||
|      */ |      */ | ||||||
|     @ApiModelProperty("值") |  | ||||||
|     @NotBlank(message = "值不能为空") |     @NotBlank(message = "值不能为空") | ||||||
|     @ExcelProperty(value = "值") |     @ExcelProperty(value = "值") | ||||||
|     private String value; |     private String value; | ||||||
|   | |||||||
| @@ -3,8 +3,6 @@ package com.ruoyi.demo.domain.bo; | |||||||
| import com.ruoyi.common.core.domain.TreeEntity; | import com.ruoyi.common.core.domain.TreeEntity; | ||||||
| import com.ruoyi.common.core.validate.AddGroup; | import com.ruoyi.common.core.validate.AddGroup; | ||||||
| import com.ruoyi.common.core.validate.EditGroup; | import com.ruoyi.common.core.validate.EditGroup; | ||||||
| import io.swagger.annotations.ApiModel; |  | ||||||
| import io.swagger.annotations.ApiModelProperty; |  | ||||||
| import lombok.Data; | import lombok.Data; | ||||||
| import lombok.EqualsAndHashCode; | import lombok.EqualsAndHashCode; | ||||||
|  |  | ||||||
| @@ -20,34 +18,29 @@ import javax.validation.constraints.NotNull; | |||||||
|  |  | ||||||
| @Data | @Data | ||||||
| @EqualsAndHashCode(callSuper = true) | @EqualsAndHashCode(callSuper = true) | ||||||
| @ApiModel("测试树表业务对象") |  | ||||||
| public class TestTreeBo extends TreeEntity<TestTreeBo> { | public class TestTreeBo extends TreeEntity<TestTreeBo> { | ||||||
|  |  | ||||||
|     /** |     /** | ||||||
|      * 主键 |      * 主键 | ||||||
|      */ |      */ | ||||||
|     @ApiModelProperty("主键") |  | ||||||
|     @NotNull(message = "主键不能为空", groups = {EditGroup.class}) |     @NotNull(message = "主键不能为空", groups = {EditGroup.class}) | ||||||
|     private Long id; |     private Long id; | ||||||
|  |  | ||||||
|     /** |     /** | ||||||
|      * 部门id |      * 部门id | ||||||
|      */ |      */ | ||||||
|     @ApiModelProperty("部门id") |  | ||||||
|     @NotNull(message = "部门id不能为空", groups = {AddGroup.class, EditGroup.class}) |     @NotNull(message = "部门id不能为空", groups = {AddGroup.class, EditGroup.class}) | ||||||
|     private Long deptId; |     private Long deptId; | ||||||
|  |  | ||||||
|     /** |     /** | ||||||
|      * 用户id |      * 用户id | ||||||
|      */ |      */ | ||||||
|     @ApiModelProperty("用户id") |  | ||||||
|     @NotNull(message = "用户id不能为空", groups = {AddGroup.class, EditGroup.class}) |     @NotNull(message = "用户id不能为空", groups = {AddGroup.class, EditGroup.class}) | ||||||
|     private Long userId; |     private Long userId; | ||||||
|  |  | ||||||
|     /** |     /** | ||||||
|      * 树节点名 |      * 树节点名 | ||||||
|      */ |      */ | ||||||
|     @ApiModelProperty("树节点名") |  | ||||||
|     @NotBlank(message = "树节点名不能为空", groups = {AddGroup.class, EditGroup.class}) |     @NotBlank(message = "树节点名不能为空", groups = {AddGroup.class, EditGroup.class}) | ||||||
|     private String treeName; |     private String treeName; | ||||||
|  |  | ||||||
|   | |||||||
| @@ -2,8 +2,6 @@ package com.ruoyi.demo.domain.vo; | |||||||
|  |  | ||||||
| import com.alibaba.excel.annotation.ExcelIgnoreUnannotated; | import com.alibaba.excel.annotation.ExcelIgnoreUnannotated; | ||||||
| import com.alibaba.excel.annotation.ExcelProperty; | import com.alibaba.excel.annotation.ExcelProperty; | ||||||
| import io.swagger.annotations.ApiModel; |  | ||||||
| import io.swagger.annotations.ApiModelProperty; |  | ||||||
| import lombok.Data; | import lombok.Data; | ||||||
|  |  | ||||||
| import java.util.Date; | import java.util.Date; | ||||||
| @@ -16,7 +14,6 @@ import java.util.Date; | |||||||
|  * @date 2021-07-26 |  * @date 2021-07-26 | ||||||
|  */ |  */ | ||||||
| @Data | @Data | ||||||
| @ApiModel("测试单表视图对象") |  | ||||||
| @ExcelIgnoreUnannotated | @ExcelIgnoreUnannotated | ||||||
| public class TestDemoVo { | public class TestDemoVo { | ||||||
|  |  | ||||||
| @@ -26,70 +23,60 @@ public class TestDemoVo { | |||||||
|      * 主键 |      * 主键 | ||||||
|      */ |      */ | ||||||
|     @ExcelProperty(value = "主键") |     @ExcelProperty(value = "主键") | ||||||
|     @ApiModelProperty("主键") |  | ||||||
|     private Long id; |     private Long id; | ||||||
|  |  | ||||||
|     /** |     /** | ||||||
|      * 部门id |      * 部门id | ||||||
|      */ |      */ | ||||||
|     @ExcelProperty(value = "部门id") |     @ExcelProperty(value = "部门id") | ||||||
|     @ApiModelProperty("部门id") |  | ||||||
|     private Long deptId; |     private Long deptId; | ||||||
|  |  | ||||||
|     /** |     /** | ||||||
|      * 用户id |      * 用户id | ||||||
|      */ |      */ | ||||||
|     @ExcelProperty(value = "用户id") |     @ExcelProperty(value = "用户id") | ||||||
|     @ApiModelProperty("用户id") |  | ||||||
|     private Long userId; |     private Long userId; | ||||||
|  |  | ||||||
|     /** |     /** | ||||||
|      * 排序号 |      * 排序号 | ||||||
|      */ |      */ | ||||||
|     @ExcelProperty(value = "排序号") |     @ExcelProperty(value = "排序号") | ||||||
|     @ApiModelProperty("排序号") |  | ||||||
|     private Integer orderNum; |     private Integer orderNum; | ||||||
|  |  | ||||||
|     /** |     /** | ||||||
|      * key键 |      * key键 | ||||||
|      */ |      */ | ||||||
|     @ExcelProperty(value = "key键") |     @ExcelProperty(value = "key键") | ||||||
|     @ApiModelProperty("key键") |  | ||||||
|     private String testKey; |     private String testKey; | ||||||
|  |  | ||||||
|     /** |     /** | ||||||
|      * 值 |      * 值 | ||||||
|      */ |      */ | ||||||
|     @ExcelProperty(value = "值") |     @ExcelProperty(value = "值") | ||||||
|     @ApiModelProperty("值") |  | ||||||
|     private String value; |     private String value; | ||||||
|  |  | ||||||
|     /** |     /** | ||||||
|      * 创建时间 |      * 创建时间 | ||||||
|      */ |      */ | ||||||
|     @ExcelProperty(value = "创建时间") |     @ExcelProperty(value = "创建时间") | ||||||
|     @ApiModelProperty("创建时间") |  | ||||||
|     private Date createTime; |     private Date createTime; | ||||||
|  |  | ||||||
|     /** |     /** | ||||||
|      * 创建人 |      * 创建人 | ||||||
|      */ |      */ | ||||||
|     @ExcelProperty(value = "创建人") |     @ExcelProperty(value = "创建人") | ||||||
|     @ApiModelProperty("创建人") |  | ||||||
|     private String createBy; |     private String createBy; | ||||||
|  |  | ||||||
|     /** |     /** | ||||||
|      * 更新时间 |      * 更新时间 | ||||||
|      */ |      */ | ||||||
|     @ExcelProperty(value = "更新时间") |     @ExcelProperty(value = "更新时间") | ||||||
|     @ApiModelProperty("更新时间") |  | ||||||
|     private Date updateTime; |     private Date updateTime; | ||||||
|  |  | ||||||
|     /** |     /** | ||||||
|      * 更新人 |      * 更新人 | ||||||
|      */ |      */ | ||||||
|     @ExcelProperty(value = "更新人") |     @ExcelProperty(value = "更新人") | ||||||
|     @ApiModelProperty("更新人") |  | ||||||
|     private String updateBy; |     private String updateBy; | ||||||
|  |  | ||||||
|  |  | ||||||
|   | |||||||
| @@ -2,8 +2,6 @@ package com.ruoyi.demo.domain.vo; | |||||||
|  |  | ||||||
| import com.alibaba.excel.annotation.ExcelIgnoreUnannotated; | import com.alibaba.excel.annotation.ExcelIgnoreUnannotated; | ||||||
| import com.alibaba.excel.annotation.ExcelProperty; | import com.alibaba.excel.annotation.ExcelProperty; | ||||||
| import io.swagger.annotations.ApiModel; |  | ||||||
| import io.swagger.annotations.ApiModelProperty; |  | ||||||
| import lombok.Data; | import lombok.Data; | ||||||
|  |  | ||||||
| import java.util.Date; | import java.util.Date; | ||||||
| @@ -16,7 +14,6 @@ import java.util.Date; | |||||||
|  * @date 2021-07-26 |  * @date 2021-07-26 | ||||||
|  */ |  */ | ||||||
| @Data | @Data | ||||||
| @ApiModel("测试树表视图对象") |  | ||||||
| @ExcelIgnoreUnannotated | @ExcelIgnoreUnannotated | ||||||
| public class TestTreeVo { | public class TestTreeVo { | ||||||
|  |  | ||||||
| @@ -25,42 +22,36 @@ public class TestTreeVo { | |||||||
|     /** |     /** | ||||||
|      * 主键 |      * 主键 | ||||||
|      */ |      */ | ||||||
|     @ApiModelProperty("主键") |  | ||||||
|     private Long id; |     private Long id; | ||||||
|  |  | ||||||
|     /** |     /** | ||||||
|      * 父id |      * 父id | ||||||
|      */ |      */ | ||||||
|     @ExcelProperty(value = "父id") |     @ExcelProperty(value = "父id") | ||||||
|     @ApiModelProperty("父id") |  | ||||||
|     private Long parentId; |     private Long parentId; | ||||||
|  |  | ||||||
|     /** |     /** | ||||||
|      * 部门id |      * 部门id | ||||||
|      */ |      */ | ||||||
|     @ExcelProperty(value = "部门id") |     @ExcelProperty(value = "部门id") | ||||||
|     @ApiModelProperty("部门id") |  | ||||||
|     private Long deptId; |     private Long deptId; | ||||||
|  |  | ||||||
|     /** |     /** | ||||||
|      * 用户id |      * 用户id | ||||||
|      */ |      */ | ||||||
|     @ExcelProperty(value = "用户id") |     @ExcelProperty(value = "用户id") | ||||||
|     @ApiModelProperty("用户id") |  | ||||||
|     private Long userId; |     private Long userId; | ||||||
|  |  | ||||||
|     /** |     /** | ||||||
|      * 树节点名 |      * 树节点名 | ||||||
|      */ |      */ | ||||||
|     @ExcelProperty(value = "树节点名") |     @ExcelProperty(value = "树节点名") | ||||||
|     @ApiModelProperty("树节点名") |  | ||||||
|     private String treeName; |     private String treeName; | ||||||
|  |  | ||||||
|     /** |     /** | ||||||
|      * 创建时间 |      * 创建时间 | ||||||
|      */ |      */ | ||||||
|     @ExcelProperty(value = "创建时间") |     @ExcelProperty(value = "创建时间") | ||||||
|     @ApiModelProperty("创建时间") |  | ||||||
|     private Date createTime; |     private Date createTime; | ||||||
|  |  | ||||||
|  |  | ||||||
|   | |||||||
| @@ -5,7 +5,7 @@ | |||||||
|     <parent> |     <parent> | ||||||
|         <artifactId>ruoyi-vue-plus</artifactId> |         <artifactId>ruoyi-vue-plus</artifactId> | ||||||
|         <groupId>com.ruoyi</groupId> |         <groupId>com.ruoyi</groupId> | ||||||
|         <version>4.2.0</version> |         <version>4.3.0-beta2</version> | ||||||
|     </parent> |     </parent> | ||||||
|     <modelVersion>4.0.0</modelVersion> |     <modelVersion>4.0.0</modelVersion> | ||||||
|     <artifactId>ruoyi-extend</artifactId> |     <artifactId>ruoyi-extend</artifactId> | ||||||
|   | |||||||
| @@ -5,7 +5,7 @@ | |||||||
|     <parent> |     <parent> | ||||||
|         <artifactId>ruoyi-extend</artifactId> |         <artifactId>ruoyi-extend</artifactId> | ||||||
|         <groupId>com.ruoyi</groupId> |         <groupId>com.ruoyi</groupId> | ||||||
|         <version>4.2.0</version> |         <version>4.3.0-beta2</version> | ||||||
|     </parent> |     </parent> | ||||||
|     <modelVersion>4.0.0</modelVersion> |     <modelVersion>4.0.0</modelVersion> | ||||||
|     <packaging>jar</packaging> |     <packaging>jar</packaging> | ||||||
|   | |||||||
| @@ -1,10 +1,10 @@ | |||||||
| package com.ruoyi.monitor.admin.config; | package com.ruoyi.monitor.admin.config; | ||||||
|  |  | ||||||
| import de.codecentric.boot.admin.server.config.AdminServerProperties; | import de.codecentric.boot.admin.server.config.AdminServerProperties; | ||||||
| import org.springframework.context.annotation.Configuration; | import org.springframework.context.annotation.Bean; | ||||||
| import org.springframework.security.config.annotation.web.builders.HttpSecurity; | import org.springframework.security.config.annotation.web.builders.HttpSecurity; | ||||||
| import org.springframework.security.config.annotation.web.configuration.EnableWebSecurity; | import org.springframework.security.config.annotation.web.configuration.EnableWebSecurity; | ||||||
| import org.springframework.security.config.annotation.web.configuration.WebSecurityConfigurerAdapter; | import org.springframework.security.web.SecurityFilterChain; | ||||||
| import org.springframework.security.web.authentication.SavedRequestAwareAuthenticationSuccessHandler; | import org.springframework.security.web.authentication.SavedRequestAwareAuthenticationSuccessHandler; | ||||||
|  |  | ||||||
| /** | /** | ||||||
| @@ -12,9 +12,8 @@ import org.springframework.security.web.authentication.SavedRequestAwareAuthenti | |||||||
|  * |  * | ||||||
|  * @author Lion Li |  * @author Lion Li | ||||||
|  */ |  */ | ||||||
| @Configuration |  | ||||||
| @EnableWebSecurity | @EnableWebSecurity | ||||||
| public class SecurityConfig extends WebSecurityConfigurerAdapter { | public class SecurityConfig { | ||||||
|  |  | ||||||
|     private final String adminContextPath; |     private final String adminContextPath; | ||||||
|  |  | ||||||
| @@ -22,27 +21,30 @@ public class SecurityConfig extends WebSecurityConfigurerAdapter { | |||||||
|         this.adminContextPath = adminServerProperties.getContextPath(); |         this.adminContextPath = adminServerProperties.getContextPath(); | ||||||
|     } |     } | ||||||
|  |  | ||||||
|     @Override |     @Bean | ||||||
|     protected void configure(HttpSecurity httpSecurity) throws Exception { |     public SecurityFilterChain filterChain(HttpSecurity httpSecurity) throws Exception { | ||||||
|         SavedRequestAwareAuthenticationSuccessHandler successHandler = new SavedRequestAwareAuthenticationSuccessHandler(); |         SavedRequestAwareAuthenticationSuccessHandler successHandler = new SavedRequestAwareAuthenticationSuccessHandler(); | ||||||
|         successHandler.setTargetUrlParameter("redirectTo"); |         successHandler.setTargetUrlParameter("redirectTo"); | ||||||
|         successHandler.setDefaultTargetUrl(adminContextPath + "/"); |         successHandler.setDefaultTargetUrl(adminContextPath + "/"); | ||||||
|         // admin监控 用户鉴权 |  | ||||||
|         httpSecurity.authorizeRequests() |         return httpSecurity | ||||||
|             //授予对所有静态资产和登录页面的公共访问权限。 |                 .headers().frameOptions().disable() | ||||||
|             .antMatchers(adminContextPath + "/assets/**").permitAll() |                 .and().authorizeRequests() | ||||||
|             .antMatchers(adminContextPath + "/login").permitAll() |                 .antMatchers(adminContextPath + "/assets/**" | ||||||
|             .antMatchers("/actuator").permitAll() |                     , adminContextPath + "/login" | ||||||
|             .antMatchers("/actuator/**").permitAll() |                     , "/actuator" | ||||||
|             //必须对每个其他请求进行身份验证 |                     , "/actuator/**" | ||||||
|             .anyRequest().authenticated().and() |                 ).permitAll() | ||||||
|             //配置登录和注销 |                 .anyRequest().authenticated() | ||||||
|  |                 .and() | ||||||
|                 .formLogin().loginPage(adminContextPath + "/login") |                 .formLogin().loginPage(adminContextPath + "/login") | ||||||
|                 .successHandler(successHandler).and() |                 .successHandler(successHandler).and() | ||||||
|             .logout().logoutUrl(adminContextPath + "/logout").and() |                 .logout().logoutUrl(adminContextPath + "/logout") | ||||||
|             //启用HTTP-Basic支持。这是Spring Boot Admin Client注册所必需的 |                 .and() | ||||||
|             .httpBasic().and().csrf().disable() |                 .httpBasic().and() | ||||||
|             .headers().frameOptions().disable(); |                 .csrf() | ||||||
|  |                 .disable() | ||||||
|  |                 .build(); | ||||||
|     } |     } | ||||||
|  |  | ||||||
| } | } | ||||||
|   | |||||||
| @@ -1,14 +0,0 @@ | |||||||
| --- # 监控配置 |  | ||||||
| spring: |  | ||||||
|   boot: |  | ||||||
|     admin: |  | ||||||
|       # Spring Boot Admin Client 客户端的相关配置 |  | ||||||
|       client: |  | ||||||
|         # 增加客户端开关 |  | ||||||
|         enabled: true |  | ||||||
|         # 设置 Spring Boot Admin Server 地址 |  | ||||||
|         url: http://localhost:9090/admin |  | ||||||
|         instance: |  | ||||||
|           service-host-type: IP |  | ||||||
|         username: ruoyi |  | ||||||
|         password: 123456 |  | ||||||
| @@ -1,14 +0,0 @@ | |||||||
| --- # 监控配置 |  | ||||||
| spring: |  | ||||||
|   boot: |  | ||||||
|     admin: |  | ||||||
|       # Spring Boot Admin Client 客户端的相关配置 |  | ||||||
|       client: |  | ||||||
|         # 增加客户端开关 |  | ||||||
|         enabled: true |  | ||||||
|         # 设置 Spring Boot Admin Server 地址 |  | ||||||
|         url: http://172.30.0.90:9090/admin |  | ||||||
|         instance: |  | ||||||
|           service-host-type: IP |  | ||||||
|         username: ruoyi |  | ||||||
|         password: 123456 |  | ||||||
| @@ -14,18 +14,29 @@ spring: | |||||||
|       password: 123456 |       password: 123456 | ||||||
|   boot: |   boot: | ||||||
|     admin: |     admin: | ||||||
|  |       ui: | ||||||
|  |         title: RuoYi-Vue-Plus服务监控中心 | ||||||
|       context-path: /admin |       context-path: /admin | ||||||
|  |  | ||||||
| --- # Actuator 监控端点的配置项 | --- # Actuator 监控端点的配置项 | ||||||
| management: | management: | ||||||
|   endpoints: |   endpoints: | ||||||
|     web: |     web: | ||||||
|       # Actuator 提供的 API 接口的根目录。默认为 /actuator |  | ||||||
|       base-path: /actuator |  | ||||||
|       exposure: |       exposure: | ||||||
|         # 需要开放的端点。默认值只打开 health 和 info 两个端点。通过设置 * ,可以开放所有端点。 |         include: '*' | ||||||
|         # 生产环境不建议放开所有 根据项目需求放开即可 |  | ||||||
|         include: @endpoints.include@ |  | ||||||
|   endpoint: |   endpoint: | ||||||
|  |     health: | ||||||
|  |       show-details: ALWAYS | ||||||
|     logfile: |     logfile: | ||||||
|       external-file: ./logs/ruoyi-monitor-admin.log |       external-file: ./logs/ruoyi-monitor-admin.log | ||||||
|  |  | ||||||
|  | --- # 监控配置 | ||||||
|  | spring.boot.admin.client: | ||||||
|  |   # 增加客户端开关 | ||||||
|  |   enabled: true | ||||||
|  |   # 设置 Spring Boot Admin Server 地址 | ||||||
|  |   url: http://localhost:9090/admin | ||||||
|  |   instance: | ||||||
|  |     service-host-type: IP | ||||||
|  |   username: ruoyi | ||||||
|  |   password: 123456 | ||||||
|   | |||||||
| @@ -4,7 +4,7 @@ | |||||||
|     <parent> |     <parent> | ||||||
|         <artifactId>ruoyi-extend</artifactId> |         <artifactId>ruoyi-extend</artifactId> | ||||||
|         <groupId>com.ruoyi</groupId> |         <groupId>com.ruoyi</groupId> | ||||||
|         <version>4.2.0</version> |         <version>4.3.0-beta2</version> | ||||||
|     </parent> |     </parent> | ||||||
|     <artifactId>ruoyi-xxl-job-admin</artifactId> |     <artifactId>ruoyi-xxl-job-admin</artifactId> | ||||||
|     <packaging>jar</packaging> |     <packaging>jar</packaging> | ||||||
|   | |||||||
| @@ -21,10 +21,10 @@ import java.io.IOException; | |||||||
| public class JacksonUtil { | public class JacksonUtil { | ||||||
|     private static Logger logger = LoggerFactory.getLogger(JacksonUtil.class); |     private static Logger logger = LoggerFactory.getLogger(JacksonUtil.class); | ||||||
|  |  | ||||||
|     private final static ObjectMapper objectMapper = new ObjectMapper(); |     private final static ObjectMapper OBJECT_MAPPER = new ObjectMapper(); | ||||||
|  |  | ||||||
|     public static ObjectMapper getInstance() { |     public static ObjectMapper getInstance() { | ||||||
|         return objectMapper; |         return OBJECT_MAPPER; | ||||||
|     } |     } | ||||||
|  |  | ||||||
|     /** |     /** | ||||||
|   | |||||||
| @@ -1,9 +1,5 @@ | |||||||
| --- # 监控配置 | --- # 监控配置 | ||||||
| spring: | spring.boot.admin.client: | ||||||
|   boot: |  | ||||||
|     admin: |  | ||||||
|       # Spring Boot Admin Client 客户端的相关配置 |  | ||||||
|       client: |  | ||||||
|   # 增加客户端开关 |   # 增加客户端开关 | ||||||
|   enabled: true |   enabled: true | ||||||
|   # 设置 Spring Boot Admin Server 地址 |   # 设置 Spring Boot Admin Server 地址 | ||||||
|   | |||||||
| @@ -1,13 +1,9 @@ | |||||||
| --- # 监控配置 | --- # 监控配置 | ||||||
| spring: | spring.boot.admin.client: | ||||||
|   boot: |  | ||||||
|     admin: |  | ||||||
|       # Spring Boot Admin Client 客户端的相关配置 |  | ||||||
|       client: |  | ||||||
|   # 增加客户端开关 |   # 增加客户端开关 | ||||||
|   enabled: true |   enabled: true | ||||||
|   # 设置 Spring Boot Admin Server 地址 |   # 设置 Spring Boot Admin Server 地址 | ||||||
|         url: http://172.30.0.90:9090/admin |   url: http://localhost:9090/admin | ||||||
|   instance: |   instance: | ||||||
|     service-host-type: IP |     service-host-type: IP | ||||||
|   username: ruoyi |   username: ruoyi | ||||||
| @@ -18,7 +14,7 @@ spring: | |||||||
|   datasource: |   datasource: | ||||||
|     type: com.zaxxer.hikari.HikariDataSource |     type: com.zaxxer.hikari.HikariDataSource | ||||||
|     driver-class-name: com.mysql.cj.jdbc.Driver |     driver-class-name: com.mysql.cj.jdbc.Driver | ||||||
|     url: jdbc:mysql://172.30.0.36:3306/ry-vue?useUnicode=true&characterEncoding=UTF-8&autoReconnect=true&serverTimezone=Asia/Shanghai |     url: jdbc:mysql://127.0.0.1:3306/ry-vue?useUnicode=true&characterEncoding=UTF-8&autoReconnect=true&serverTimezone=Asia/Shanghai | ||||||
|     username: root |     username: root | ||||||
|     password: root |     password: root | ||||||
|     hikari: |     hikari: | ||||||
|   | |||||||
| @@ -37,13 +37,11 @@ management: | |||||||
|       enabled: false |       enabled: false | ||||||
|   endpoints: |   endpoints: | ||||||
|     web: |     web: | ||||||
|       # Actuator 提供的 API 接口的根目录。默认为 /actuator |  | ||||||
|       base-path: /actuator |  | ||||||
|       exposure: |       exposure: | ||||||
|         # 需要开放的端点。默认值只打开 health 和 info 两个端点。通过设置 * ,可以开放所有端点。 |         include: '*' | ||||||
|         # 生产环境不建议放开所有 根据项目需求放开即可 |  | ||||||
|         include: @endpoints.include@ |  | ||||||
|   endpoint: |   endpoint: | ||||||
|  |     health: | ||||||
|  |       show-details: ALWAYS | ||||||
|     logfile: |     logfile: | ||||||
|       external-file: ./logs/ruoyi-xxl-job-admin.log |       external-file: ./logs/ruoyi-xxl-job-admin.log | ||||||
|  |  | ||||||
|   | |||||||
| @@ -5,7 +5,7 @@ | |||||||
|     <parent> |     <parent> | ||||||
|         <artifactId>ruoyi-vue-plus</artifactId> |         <artifactId>ruoyi-vue-plus</artifactId> | ||||||
|         <groupId>com.ruoyi</groupId> |         <groupId>com.ruoyi</groupId> | ||||||
|         <version>4.2.0</version> |         <version>4.3.0-beta2</version> | ||||||
|     </parent> |     </parent> | ||||||
|     <modelVersion>4.0.0</modelVersion> |     <modelVersion>4.0.0</modelVersion> | ||||||
|  |  | ||||||
|   | |||||||
| @@ -4,7 +4,7 @@ import cn.dev33.satoken.SaManager; | |||||||
| import cn.hutool.core.util.ObjectUtil; | import cn.hutool.core.util.ObjectUtil; | ||||||
| import cn.hutool.crypto.SecureUtil; | import cn.hutool.crypto.SecureUtil; | ||||||
| import com.ruoyi.common.annotation.RepeatSubmit; | import com.ruoyi.common.annotation.RepeatSubmit; | ||||||
| import com.ruoyi.common.constant.Constants; | import com.ruoyi.common.constant.CacheConstants; | ||||||
| import com.ruoyi.common.core.domain.R; | import com.ruoyi.common.core.domain.R; | ||||||
| import com.ruoyi.common.exception.ServiceException; | import com.ruoyi.common.exception.ServiceException; | ||||||
| import com.ruoyi.common.utils.JsonUtils; | import com.ruoyi.common.utils.JsonUtils; | ||||||
| @@ -63,7 +63,7 @@ public class RepeatSubmitAspect { | |||||||
|  |  | ||||||
|         submitKey = SecureUtil.md5(submitKey + ":" + nowParams); |         submitKey = SecureUtil.md5(submitKey + ":" + nowParams); | ||||||
|         // 唯一标识(指定key + url + 消息头) |         // 唯一标识(指定key + url + 消息头) | ||||||
|         String cacheRepeatKey = Constants.REPEAT_SUBMIT_KEY + url + submitKey; |         String cacheRepeatKey = CacheConstants.REPEAT_SUBMIT_KEY + url + submitKey; | ||||||
|         String key = RedisUtils.getCacheObject(cacheRepeatKey); |         String key = RedisUtils.getCacheObject(cacheRepeatKey); | ||||||
|         if (key == null) { |         if (key == null) { | ||||||
|             RedisUtils.setCacheObject(cacheRepeatKey, "", Duration.ofMillis(interval)); |             RedisUtils.setCacheObject(cacheRepeatKey, "", Duration.ofMillis(interval)); | ||||||
| @@ -85,14 +85,18 @@ public class RepeatSubmitAspect { | |||||||
|     @AfterReturning(pointcut = "@annotation(repeatSubmit)", returning = "jsonResult") |     @AfterReturning(pointcut = "@annotation(repeatSubmit)", returning = "jsonResult") | ||||||
|     public void doAfterReturning(JoinPoint joinPoint, RepeatSubmit repeatSubmit, Object jsonResult) { |     public void doAfterReturning(JoinPoint joinPoint, RepeatSubmit repeatSubmit, Object jsonResult) { | ||||||
|         if (jsonResult instanceof R) { |         if (jsonResult instanceof R) { | ||||||
|  |             try { | ||||||
|                 R<?> r = (R<?>) jsonResult; |                 R<?> r = (R<?>) jsonResult; | ||||||
|  |                 // 成功则不删除redis数据 保证在有效时间内无法重复提交 | ||||||
|                 if (r.getCode() == R.SUCCESS) { |                 if (r.getCode() == R.SUCCESS) { | ||||||
|                     return; |                     return; | ||||||
|                 } |                 } | ||||||
|                 RedisUtils.deleteObject(KEY_CACHE.get()); |                 RedisUtils.deleteObject(KEY_CACHE.get()); | ||||||
|  |             } finally { | ||||||
|                 KEY_CACHE.remove(); |                 KEY_CACHE.remove(); | ||||||
|             } |             } | ||||||
|         } |         } | ||||||
|  |     } | ||||||
|  |  | ||||||
|     /** |     /** | ||||||
|      * 拦截异常操作 |      * 拦截异常操作 | ||||||
|   | |||||||
| @@ -3,11 +3,10 @@ package com.ruoyi.framework.config; | |||||||
| import cn.hutool.core.util.ObjectUtil; | import cn.hutool.core.util.ObjectUtil; | ||||||
| import com.fasterxml.jackson.databind.ObjectMapper; | import com.fasterxml.jackson.databind.ObjectMapper; | ||||||
| import com.ruoyi.framework.config.properties.RedissonProperties; | import com.ruoyi.framework.config.properties.RedissonProperties; | ||||||
|  | import com.ruoyi.framework.handler.KeyPrefixHandler; | ||||||
|  | import com.ruoyi.framework.manager.PlusSpringCacheManager; | ||||||
| import lombok.extern.slf4j.Slf4j; | import lombok.extern.slf4j.Slf4j; | ||||||
| import org.redisson.api.RedissonClient; |  | ||||||
| import org.redisson.codec.JsonJacksonCodec; | import org.redisson.codec.JsonJacksonCodec; | ||||||
| import org.redisson.spring.cache.CacheConfig; |  | ||||||
| import org.redisson.spring.cache.RedissonSpringCacheManager; |  | ||||||
| import org.redisson.spring.starter.RedissonAutoConfigurationCustomizer; | import org.redisson.spring.starter.RedissonAutoConfigurationCustomizer; | ||||||
| import org.springframework.beans.factory.annotation.Autowired; | import org.springframework.beans.factory.annotation.Autowired; | ||||||
| import org.springframework.boot.context.properties.EnableConfigurationProperties; | import org.springframework.boot.context.properties.EnableConfigurationProperties; | ||||||
| @@ -17,10 +16,6 @@ import org.springframework.cache.annotation.EnableCaching; | |||||||
| 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 java.util.HashMap; |  | ||||||
| import java.util.List; |  | ||||||
| import java.util.Map; |  | ||||||
|  |  | ||||||
| /** | /** | ||||||
|  * redis配置 |  * redis配置 | ||||||
|  * |  * | ||||||
| @@ -48,6 +43,8 @@ public class RedisConfig extends CachingConfigurerSupport { | |||||||
|             if (ObjectUtil.isNotNull(singleServerConfig)) { |             if (ObjectUtil.isNotNull(singleServerConfig)) { | ||||||
|                 // 使用单机模式 |                 // 使用单机模式 | ||||||
|                 config.useSingleServer() |                 config.useSingleServer() | ||||||
|  |                     //设置redis key前缀 | ||||||
|  |                     .setNameMapper(new KeyPrefixHandler(redissonProperties.getKeyPrefix())) | ||||||
|                     .setTimeout(singleServerConfig.getTimeout()) |                     .setTimeout(singleServerConfig.getTimeout()) | ||||||
|                     .setClientName(singleServerConfig.getClientName()) |                     .setClientName(singleServerConfig.getClientName()) | ||||||
|                     .setIdleConnectionTimeout(singleServerConfig.getIdleConnectionTimeout()) |                     .setIdleConnectionTimeout(singleServerConfig.getIdleConnectionTimeout()) | ||||||
| @@ -59,6 +56,8 @@ public class RedisConfig extends CachingConfigurerSupport { | |||||||
|             RedissonProperties.ClusterServersConfig clusterServersConfig = redissonProperties.getClusterServersConfig(); |             RedissonProperties.ClusterServersConfig clusterServersConfig = redissonProperties.getClusterServersConfig(); | ||||||
|             if (ObjectUtil.isNotNull(clusterServersConfig)) { |             if (ObjectUtil.isNotNull(clusterServersConfig)) { | ||||||
|                 config.useClusterServers() |                 config.useClusterServers() | ||||||
|  |                     //设置redis key前缀 | ||||||
|  |                     .setNameMapper(new KeyPrefixHandler(redissonProperties.getKeyPrefix())) | ||||||
|                     .setTimeout(clusterServersConfig.getTimeout()) |                     .setTimeout(clusterServersConfig.getTimeout()) | ||||||
|                     .setClientName(clusterServersConfig.getClientName()) |                     .setClientName(clusterServersConfig.getClientName()) | ||||||
|                     .setIdleConnectionTimeout(clusterServersConfig.getIdleConnectionTimeout()) |                     .setIdleConnectionTimeout(clusterServersConfig.getIdleConnectionTimeout()) | ||||||
| @@ -75,18 +74,11 @@ public class RedisConfig extends CachingConfigurerSupport { | |||||||
|     } |     } | ||||||
|  |  | ||||||
|     /** |     /** | ||||||
|      * 整合spring-cache |      * 自定义缓存管理器 整合spring-cache | ||||||
|      */ |      */ | ||||||
|     @Bean |     @Bean | ||||||
|     public CacheManager cacheManager(RedissonClient redissonClient) { |     public CacheManager cacheManager() { | ||||||
|         List<RedissonProperties.CacheGroup> cacheGroup = redissonProperties.getCacheGroup(); |         return new PlusSpringCacheManager(); | ||||||
|         Map<String, CacheConfig> config = new HashMap<>(); |  | ||||||
|         for (RedissonProperties.CacheGroup group : cacheGroup) { |  | ||||||
|             CacheConfig cacheConfig = new CacheConfig(group.getTtl(), group.getMaxIdleTime()); |  | ||||||
|             cacheConfig.setMaxSize(group.getMaxSize()); |  | ||||||
|             config.put(group.getGroupId(), cacheConfig); |  | ||||||
|         } |  | ||||||
|         return new RedissonSpringCacheManager(redissonClient, config, new JsonJacksonCodec(objectMapper)); |  | ||||||
|     } |     } | ||||||
|  |  | ||||||
|     /** |     /** | ||||||
|   | |||||||
| @@ -1,33 +1,28 @@ | |||||||
| package com.ruoyi.framework.config; | package com.ruoyi.framework.config; | ||||||
|  |  | ||||||
| import cn.dev33.satoken.config.SaTokenConfig; |  | ||||||
| import com.github.xiaoymin.knife4j.spring.annotations.EnableKnife4j; |  | ||||||
| import com.github.xiaoymin.knife4j.spring.extension.OpenApiExtensionResolver; |  | ||||||
| import com.ruoyi.common.utils.StringUtils; | import com.ruoyi.common.utils.StringUtils; | ||||||
| import com.ruoyi.common.utils.spring.SpringUtils; |  | ||||||
| import com.ruoyi.framework.config.properties.SwaggerProperties; | import com.ruoyi.framework.config.properties.SwaggerProperties; | ||||||
| import io.swagger.models.auth.In; | import com.ruoyi.framework.handler.OpenApiHandler; | ||||||
|  | import io.swagger.v3.oas.models.OpenAPI; | ||||||
|  | import io.swagger.v3.oas.models.Paths; | ||||||
|  | import io.swagger.v3.oas.models.info.Info; | ||||||
|  | import io.swagger.v3.oas.models.security.SecurityRequirement; | ||||||
| import lombok.RequiredArgsConstructor; | import lombok.RequiredArgsConstructor; | ||||||
| import org.springframework.beans.BeansException; | import org.springdoc.core.*; | ||||||
| import org.springframework.beans.factory.config.BeanPostProcessor; | import org.springdoc.core.customizers.OpenApiBuilderCustomizer; | ||||||
|  | import org.springdoc.core.customizers.OpenApiCustomiser; | ||||||
|  | import org.springdoc.core.customizers.ServerBaseUrlCustomizer; | ||||||
|  | import org.springdoc.core.providers.JavadocProvider; | ||||||
|  | import org.springframework.boot.autoconfigure.AutoConfigureBefore; | ||||||
|  | import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean; | ||||||
|  | import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty; | ||||||
|  | import org.springframework.boot.autoconfigure.web.ServerProperties; | ||||||
| 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.util.ReflectionUtils; |  | ||||||
| import org.springframework.web.servlet.mvc.method.RequestMappingInfoHandlerMapping; |  | ||||||
| import springfox.documentation.builders.ApiInfoBuilder; |  | ||||||
| import springfox.documentation.builders.PathSelectors; |  | ||||||
| import springfox.documentation.builders.RequestHandlerSelectors; |  | ||||||
| import springfox.documentation.service.*; |  | ||||||
| import springfox.documentation.spi.DocumentationType; |  | ||||||
| import springfox.documentation.spi.service.contexts.SecurityContext; |  | ||||||
| import springfox.documentation.spring.web.plugins.Docket; |  | ||||||
| import springfox.documentation.spring.web.plugins.WebFluxRequestHandlerProvider; |  | ||||||
| import springfox.documentation.spring.web.plugins.WebMvcRequestHandlerProvider; |  | ||||||
|  |  | ||||||
| import javax.annotation.PostConstruct; |  | ||||||
| import java.lang.reflect.Field; |  | ||||||
| import java.util.ArrayList; | import java.util.ArrayList; | ||||||
| import java.util.List; | import java.util.List; | ||||||
|  | import java.util.Optional; | ||||||
|  |  | ||||||
| /** | /** | ||||||
|  * Swagger 文档配置 |  * Swagger 文档配置 | ||||||
| @@ -36,125 +31,74 @@ import java.util.List; | |||||||
|  */ |  */ | ||||||
| @RequiredArgsConstructor | @RequiredArgsConstructor | ||||||
| @Configuration | @Configuration | ||||||
| @EnableKnife4j | @AutoConfigureBefore(SpringDocConfiguration.class) | ||||||
|  | @ConditionalOnProperty(name = "swagger.enabled", havingValue = "true", matchIfMissing = true) | ||||||
| public class SwaggerConfig { | public class SwaggerConfig { | ||||||
|  |  | ||||||
|     private final SwaggerProperties swaggerProperties; |     private final SwaggerProperties swaggerProperties; | ||||||
|     private final SaTokenConfig saTokenConfig; |     private final ServerProperties serverProperties; | ||||||
|     private final OpenApiExtensionResolver openApiExtensionResolver; |  | ||||||
|  |     @Bean | ||||||
|  |     @ConditionalOnMissingBean(OpenAPI.class) | ||||||
|  |     public OpenAPI openApi() { | ||||||
|  |         OpenAPI openApi = new OpenAPI(); | ||||||
|  |         // 文档基本信息 | ||||||
|  |         SwaggerProperties.InfoProperties infoProperties = swaggerProperties.getInfo(); | ||||||
|  |         Info info = convertInfo(infoProperties); | ||||||
|  |         openApi.info(info); | ||||||
|  |         // 扩展文档信息 | ||||||
|  |         openApi.externalDocs(swaggerProperties.getExternalDocs()); | ||||||
|  |         openApi.tags(swaggerProperties.getTags()); | ||||||
|  |         openApi.paths(swaggerProperties.getPaths()); | ||||||
|  |         openApi.components(swaggerProperties.getComponents()); | ||||||
|  |         List<SecurityRequirement> list = new ArrayList<>(); | ||||||
|  |         list.add(new SecurityRequirement().addList("apikey")); | ||||||
|  |         openApi.security(list); | ||||||
|  |  | ||||||
|  |         return openApi; | ||||||
|  |     } | ||||||
|  |  | ||||||
|  |     private Info convertInfo(SwaggerProperties.InfoProperties infoProperties) { | ||||||
|  |         Info info = new Info(); | ||||||
|  |         info.setTitle(infoProperties.getTitle()); | ||||||
|  |         info.setDescription(infoProperties.getDescription()); | ||||||
|  |         info.setContact(infoProperties.getContact()); | ||||||
|  |         info.setLicense(infoProperties.getLicense()); | ||||||
|  |         info.setVersion(infoProperties.getVersion()); | ||||||
|  |         return info; | ||||||
|  |     } | ||||||
|  |  | ||||||
|     /** |     /** | ||||||
|      * 用于适配springboot 2.6 |      * 自定义 openapi 处理器 | ||||||
|      */ |      */ | ||||||
|     @Bean |     @Bean | ||||||
|     @SuppressWarnings("all") |     public OpenAPIService openApiBuilder(Optional<OpenAPI> openAPI, | ||||||
|     public BeanPostProcessor springfoxHandlerProviderBeanPostProcessor() { |                                          SecurityService securityParser, | ||||||
|         return new BeanPostProcessor() { |                                          SpringDocConfigProperties springDocConfigProperties, PropertyResolverUtils propertyResolverUtils, | ||||||
|             @Override |                                          Optional<List<OpenApiBuilderCustomizer>> openApiBuilderCustomisers, | ||||||
|             public Object postProcessAfterInitialization(Object bean, String beanName) throws BeansException { |                                          Optional<List<ServerBaseUrlCustomizer>> serverBaseUrlCustomisers, Optional<JavadocProvider> javadocProvider) { | ||||||
|                 if (bean instanceof WebMvcRequestHandlerProvider || bean instanceof WebFluxRequestHandlerProvider) { |         return new OpenApiHandler(openAPI, securityParser, springDocConfigProperties, propertyResolverUtils, openApiBuilderCustomisers, serverBaseUrlCustomisers, javadocProvider); | ||||||
|                     customizeSpringfoxHandlerMappings(getHandlerMappings(bean)); |  | ||||||
|                 } |  | ||||||
|                 return bean; |  | ||||||
|     } |     } | ||||||
|  |  | ||||||
|             private <T extends RequestMappingInfoHandlerMapping> void customizeSpringfoxHandlerMappings(List<T> mappings) { |     /** | ||||||
|                 mappings.removeIf(mapping -> mapping.getPatternParser() != null); |      * 对已经生成好的 OpenApi 进行自定义操作 | ||||||
|             } |      */ | ||||||
|  |     @Bean | ||||||
|             private List<RequestMappingInfoHandlerMapping> getHandlerMappings(Object bean) { |     public OpenApiCustomiser openApiCustomiser() { | ||||||
|                 try { |         String contextPath = serverProperties.getServlet().getContextPath(); | ||||||
|                     Field field = ReflectionUtils.findField(bean.getClass(), "handlerMappings"); |         String finalContextPath; | ||||||
|                     field.setAccessible(true); |         if (StringUtils.isBlank(contextPath) || "/".equals(contextPath)) { | ||||||
|                     return (List<RequestMappingInfoHandlerMapping>) field.get(bean); |             finalContextPath = ""; | ||||||
|                 } catch (IllegalArgumentException | IllegalAccessException e) { |         } else { | ||||||
|                     throw new IllegalStateException(e); |             finalContextPath = contextPath; | ||||||
|                 } |  | ||||||
|         } |         } | ||||||
|  |         // 对所有路径增加前置上下文路径 | ||||||
|  |         return openApi -> { | ||||||
|  |             Paths oldPaths = openApi.getPaths(); | ||||||
|  |             Paths newPaths = new Paths(); | ||||||
|  |             oldPaths.forEach((k,v) -> newPaths.addPathItem(finalContextPath + k, v)); | ||||||
|  |             openApi.setPaths(newPaths); | ||||||
|         }; |         }; | ||||||
|     } |     } | ||||||
|  |  | ||||||
|     /** |  | ||||||
|      * 创建API |  | ||||||
|      */ |  | ||||||
|     @PostConstruct |  | ||||||
|     public void createRestApi() { |  | ||||||
|         for (SwaggerProperties.Groups group : swaggerProperties.getGroups()) { |  | ||||||
|             String basePackage = group.getBasePackage(); |  | ||||||
|             Docket docket = new Docket(DocumentationType.OAS_30) |  | ||||||
|                 .enable(swaggerProperties.getEnabled()) |  | ||||||
|                 // 用来创建该API的基本信息,展示在文档的页面中(自定义展示的信息) |  | ||||||
|                 .apiInfo(apiInfo()) |  | ||||||
|                 // 设置哪些接口暴露给Swagger展示 |  | ||||||
|                 .select() |  | ||||||
|                 // 扫描所有有注解的api,用这种方式更灵活 |  | ||||||
|                 //.apis(RequestHandlerSelectors.withMethodAnnotation(ApiOperation.class)) |  | ||||||
|                 // 扫描指定包中的swagger注解 |  | ||||||
|                 .apis(RequestHandlerSelectors.basePackage(basePackage)) |  | ||||||
|                 // 扫描所有 .apis(RequestHandlerSelectors.any()) |  | ||||||
|                 .paths(PathSelectors.any()) |  | ||||||
|                 .build() |  | ||||||
|                 .groupName(group.getName()) |  | ||||||
|                 // 设置安全模式,swagger可以设置访问token |  | ||||||
|                 .securitySchemes(securitySchemes()) |  | ||||||
|                 .securityContexts(securityContexts()) |  | ||||||
|                 .extensions(openApiExtensionResolver.buildExtensions(group.getName())) |  | ||||||
|                 .pathMapping(swaggerProperties.getPathMapping()); |  | ||||||
|             String beanName = StringUtils.substringAfterLast(basePackage, ".") + "Docket"; |  | ||||||
|             SpringUtils.registerBean(beanName, docket); |  | ||||||
|         } |  | ||||||
|     } |  | ||||||
|  |  | ||||||
|     /** |  | ||||||
|      * 安全模式,这里指定token通过Authorization头请求头传递 |  | ||||||
|      */ |  | ||||||
|     private List<SecurityScheme> securitySchemes() { |  | ||||||
|         List<SecurityScheme> apiKeyList = new ArrayList<>(); |  | ||||||
|         String header = saTokenConfig.getTokenName(); |  | ||||||
|         apiKeyList.add(new ApiKey(header, header, In.HEADER.toValue())); |  | ||||||
|         return apiKeyList; |  | ||||||
|     } |  | ||||||
|  |  | ||||||
|     /** |  | ||||||
|      * 安全上下文 |  | ||||||
|      */ |  | ||||||
|     private List<SecurityContext> securityContexts() { |  | ||||||
|         List<SecurityContext> securityContexts = new ArrayList<>(); |  | ||||||
|         securityContexts.add( |  | ||||||
|             SecurityContext.builder() |  | ||||||
|                 .securityReferences(defaultAuth()) |  | ||||||
|                 .operationSelector(o -> o.requestMappingPattern().matches("/.*")) |  | ||||||
|                 .build()); |  | ||||||
|         return securityContexts; |  | ||||||
|     } |  | ||||||
|  |  | ||||||
|     /** |  | ||||||
|      * 默认的安全上引用 |  | ||||||
|      */ |  | ||||||
|     private List<SecurityReference> defaultAuth() { |  | ||||||
|         AuthorizationScope authorizationScope = new AuthorizationScope("global", "accessEverything"); |  | ||||||
|         AuthorizationScope[] authorizationScopes = new AuthorizationScope[1]; |  | ||||||
|         authorizationScopes[0] = authorizationScope; |  | ||||||
|         List<SecurityReference> securityReferences = new ArrayList<>(); |  | ||||||
|         securityReferences.add(new SecurityReference(saTokenConfig.getTokenName(), authorizationScopes)); |  | ||||||
|         return securityReferences; |  | ||||||
|     } |  | ||||||
|  |  | ||||||
|     /** |  | ||||||
|      * 添加摘要信息 |  | ||||||
|      */ |  | ||||||
|     private ApiInfo apiInfo() { |  | ||||||
|         // 用ApiInfoBuilder进行定制 |  | ||||||
|         SwaggerProperties.Contact contact = swaggerProperties.getContact(); |  | ||||||
|         return new ApiInfoBuilder() |  | ||||||
|             // 设置标题 |  | ||||||
|             .title(swaggerProperties.getTitle()) |  | ||||||
|             // 描述 |  | ||||||
|             .description(swaggerProperties.getDescription()) |  | ||||||
|             // 作者信息 |  | ||||||
|             .contact(new Contact(contact.getName(), contact.getUrl(), contact.getEmail())) |  | ||||||
|             // 版本 |  | ||||||
|             .version(swaggerProperties.getVersion()) |  | ||||||
|             .build(); |  | ||||||
|     } |  | ||||||
| } | } | ||||||
|   | |||||||
Some files were not shown because too many files have changed in this diff Show More
		Reference in New Issue
	
	Block a user