From c90ca8c2a63edcacab53a5f3156a561c01439936 Mon Sep 17 00:00:00 2001 From: 疯狂的狮子li <15040126243@163.com> Date: 星期二, 01 六月 2021 10:33:57 +0800 Subject: [PATCH] 发布 v2.3.0 --- ruoyi-system/src/main/java/com/ruoyi/system/mapper/SysDeptMapper.java | 8 ruoyi-ui/src/views/demo/demo/index.vue | 339 ++++ ruoyi-demo/src/main/java/com/ruoyi/demo/service/impl/TestTreeServiceImpl.java | 84 + ruoyi-demo/src/main/java/com/ruoyi/demo/service/IChkjTestService.java | 57 ruoyi-common/src/main/java/com/ruoyi/common/core/redis/RedisCache.java | 397 ++-- ruoyi-ui/src/views/demo/test/index.vue | 361 +++++ ruoyi-generator/src/main/resources/vm/java/addBo.java.vm | 1 ruoyi-ui/src/api/demo/demo.js | 53 ruoyi-demo/src/main/resources/mapper/demo/TestTreeMapper.xml | 22 ruoyi-ui/package.json | 2 ruoyi-common/src/main/java/com/ruoyi/common/annotation/DataScope.java | 7 ruoyi-system/src/main/java/com/ruoyi/system/service/impl/SysDictDataServiceImpl.java | 3 ruoyi-ui/src/views/demo/tree/index.vue | 282 +++ ruoyi-framework/src/main/java/com/ruoyi/framework/config/AsyncConfig.java | 41 ruoyi-system/src/main/java/com/ruoyi/system/service/impl/SysDictTypeServiceImpl.java | 6 ruoyi-system/src/main/resources/mapper/system/SysRoleMapper.xml | 8 ruoyi-system/src/main/java/com/ruoyi/system/service/impl/SysConfigServiceImpl.java | 6 ry.sh | 12 ruoyi-system/src/main/java/com/ruoyi/system/mapper/SysUserPostMapper.java | 10 ruoyi-demo/src/main/java/com/ruoyi/demo/bo/TestDemoAddBo.java | 43 ruoyi-demo/src/main/java/com/ruoyi/demo/bo/TestTreeQueryBo.java | 42 ruoyi-demo/src/main/java/com/ruoyi/demo/domain/TestTree.java | 67 ruoyi-generator/src/main/resources/vm/java/service.java.vm | 1 ry.bat | 67 ruoyi-demo/src/main/java/com/ruoyi/demo/controller/TestTreeController.java | 107 + ruoyi-system/src/main/resources/mapper/system/SysUserRoleMapper.xml | 9 README.md | 7 ruoyi-demo/src/main/java/com/ruoyi/demo/bo/TestTreeEditBo.java | 47 ruoyi-demo/src/main/java/com/ruoyi/demo/bo/TestTreeAddBo.java | 39 ruoyi-admin/src/main/resources/application-prod.yml | 45 ruoyi-demo/src/main/java/com/ruoyi/demo/controller/ChkjTestController.java | 108 + ruoyi-demo/src/main/java/com/ruoyi/demo/bo/ChkjTestAddBo.java | 50 ruoyi-ui/src/api/demo/test.js | 53 ruoyi-admin/src/main/resources/application-dev.yml | 45 ruoyi-demo/src/main/java/com/ruoyi/demo/bo/ChkjTestEditBo.java | 61 ruoyi-system/src/main/java/com/ruoyi/system/service/impl/SysDeptServiceImpl.java | 2 ruoyi-system/src/main/resources/mapper/system/SysUserMapper.xml | 8 ruoyi-ui/src/views/index.vue | 10 ruoyi-framework/src/main/java/com/ruoyi/framework/aspectj/DataScopeAspect.java | 248 +- pom.xml | 10 ruoyi-demo/src/main/java/com/ruoyi/demo/service/ITestTreeService.java | 52 ruoyi-demo/src/main/java/com/ruoyi/demo/mapper/TestDemoMapper.java | 14 ruoyi-system/src/main/resources/mapper/system/SysDeptMapper.xml | 17 ruoyi-demo/src/main/java/com/ruoyi/demo/controller/TestDemoController.java | 108 + ruoyi-demo/src/main/java/com/ruoyi/demo/domain/ChkjTest.java | 55 ruoyi-demo/src/main/java/com/ruoyi/demo/service/impl/TestDemoServiceImpl.java | 95 + ruoyi-ui/src/api/demo/tree.js | 53 ruoyi-demo/src/main/java/com/ruoyi/demo/service/impl/ChkjTestServiceImpl.java | 93 + ruoyi-system/src/main/resources/mapper/system/SysUserPostMapper.xml | 9 ruoyi-demo/src/main/resources/mapper/demo/ChkjTestMapper.xml | 19 ruoyi-demo/src/main/java/com/ruoyi/demo/service/ITestDemoService.java | 57 ruoyi-demo/src/main/java/com/ruoyi/demo/mapper/ChkjTestMapper.java | 14 ruoyi-system/src/main/java/com/ruoyi/system/mapper/SysRoleMenuMapper.java | 10 ruoyi-generator/src/main/resources/vm/java/domain.java.vm | 7 ruoyi-demo/src/main/java/com/ruoyi/demo/bo/TestDemoQueryBo.java | 42 ruoyi-demo/src/main/java/com/ruoyi/demo/vo/ChkjTestVo.java | 57 ruoyi-demo/src/main/java/com/ruoyi/demo/domain/TestDemo.java | 70 ruoyi-demo/src/main/java/com/ruoyi/demo/vo/TestDemoVo.java | 76 + ruoyi-system/src/main/java/com/ruoyi/system/mapper/SysUserRoleMapper.java | 10 ruoyi-system/src/main/java/com/ruoyi/system/mapper/SysRoleDeptMapper.java | 10 ruoyi-system/src/main/resources/mapper/system/SysRoleDeptMapper.xml | 9 ruoyi-common/pom.xml | 6 ruoyi-demo/src/main/resources/mapper/demo/TestDemoMapper.xml | 23 ruoyi-system/src/main/resources/mapper/system/SysRoleMenuMapper.xml | 9 ruoyi-system/src/main/java/com/ruoyi/system/service/impl/SysUserServiceImpl.java | 16 sql/test.sql | 171 ++ ruoyi-demo/src/main/java/com/ruoyi/demo/bo/ChkjTestQueryBo.java | 53 ruoyi-demo/src/main/java/com/ruoyi/demo/vo/TestTreeVo.java | 55 ruoyi-framework/src/main/java/com/ruoyi/framework/config/RedisConfig.java | 75 ruoyi-framework/src/main/java/com/ruoyi/framework/config/properties/RedissonProperties.java | 101 + ruoyi-demo/src/main/java/com/ruoyi/demo/bo/TestDemoEditBo.java | 52 ruoyi-demo/src/main/java/com/ruoyi/demo/mapper/TestTreeMapper.java | 14 ruoyi-generator/src/main/resources/vm/java/vo.java.vm | 4 ruoyi-system/src/main/java/com/ruoyi/system/service/impl/SysRoleServiceImpl.java | 8 74 files changed, 3,801 insertions(+), 431 deletions(-) diff --git a/README.md b/README.md index 4aab643..ce17def 100644 --- a/README.md +++ b/README.md @@ -28,6 +28,7 @@ * 闆嗘垚 Feign 鎺ュ彛鍖栫鐞� Http 璇锋眰(濡備笁鏂硅姹� 鏀粯,鐭俊,鎺ㄩ�佺瓑) * 绉婚櫎 鑷甫鏈嶅姟鐩戞帶 鏀逛负 spring-boot-admin 鍏ㄦ柟浣嶇洃鎺� * 澧炲姞 demo 妯″潡绀轰緥(缁欎笉浼氬鍔犳ā鍧楃殑灏忎紮浼村仛鍙傝��) +* 澧炲姞 redisson 鏀寔鍒嗗竷寮忛攣 鍔熻兘鏇村己澶� ### 浠g爜鏀瑰姩 @@ -38,6 +39,7 @@ * 浠g爜鐢熸垚妯℃澘 澧炲姞 鏂囨。娉ㄨВ 涓� 鏍¢獙娉ㄨВ 绠�鍖栭�氱敤鎿嶄綔 * 椤圭洰淇敼涓� maven澶氱幆澧冮厤缃� * 椤圭洰閰嶇疆淇敼涓� application.yml 缁熶竴绠$悊 +* 鏁版嵁鏉冮檺淇敼涓� 閫傞厤鏀寔鍗曡〃銆佸琛� ### 鍏朵粬 @@ -73,8 +75,9 @@ * 浠g爜鐢熸垚閫夋嫨鏍戣〃鐢熸垚鍗冲彲 鍏充簬鏁版嵁鏉冮檺 -* 鍙傝�冿紙鐢ㄦ埛锛岃鑹诧紝閮ㄩ棬锛夊垪琛ㄦ帴鍙g敤娉� -* 鐩墠浠呮敮鎸� XML 鏂瑰紡浣跨敤(鍚庣画淇敼涓烘敮鎸丮P) +* 鍒涘缓琛� 闇�棰勭暀 dept_id 瀛楁 濡傞渶鐢ㄦ埛鏉冮檺 杩橀渶棰勭暀 user_id 瀛楁 +* 鏀寔 Mybatis-Plus 鏂瑰紡娉ㄥ叆 鍙傝�� demo 妯″潡鐢ㄦ硶(闇�瀵煎叆 test.sql 鏂囦欢) +* 鏀寔 XML 鏂瑰紡娉ㄥ叆 鍙傝�� system 妯″潡鐢ㄦ硶 鍏充簬vue涓巄oot鏁村悎閮ㄧ讲 * [鍓嶇闈欐�佽祫婧愬浣曟暣鍚堝埌鍚庣璁块棶](https://doc.ruoyi.vip/ruoyi-vue/other/faq.html#鍓嶇闈欐�佽祫婧愬浣曟暣鍚堝埌鍚庣璁块棶) diff --git a/pom.xml b/pom.xml index 6d52bf6..a178974 100644 --- a/pom.xml +++ b/pom.xml @@ -13,7 +13,7 @@ <description>RuoYi-Vue-Plus鍚庡彴绠$悊绯荤粺</description> <properties> - <ruoyi-vue-plus.version>2.2.1</ruoyi-vue-plus.version> + <ruoyi-vue-plus.version>2.3.0</ruoyi-vue-plus.version> <spring-boot.version>2.3.11.RELEASE</spring-boot.version> <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding> <project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding> @@ -31,6 +31,7 @@ <feign.version>2.2.6.RELEASE</feign.version> <feign-okhttp.version>11.0</feign-okhttp.version> <spring-boot-admin.version>2.3.1</spring-boot-admin.version> + <redisson.version>3.15.2</redisson.version> </properties> <!-- 渚濊禆澹版槑 --> @@ -180,6 +181,13 @@ <version>${ruoyi-vue-plus.version}</version> </dependency> + <!--redisson--> + <dependency> + <groupId>org.redisson</groupId> + <artifactId>redisson-spring-boot-starter</artifactId> + <version>${redisson.version}</version> + </dependency> + </dependencies> </dependencyManagement> diff --git a/ruoyi-admin/src/main/resources/application-dev.yml b/ruoyi-admin/src/main/resources/application-dev.yml index 06456dd..71e5b6f 100644 --- a/ruoyi-admin/src/main/resources/application-dev.yml +++ b/ruoyi-admin/src/main/resources/application-dev.yml @@ -67,13 +67,38 @@ password: # 杩炴帴瓒呮椂鏃堕棿 timeout: 10s - lettuce: - pool: - # 杩炴帴姹犱腑鐨勬渶灏忕┖闂茶繛鎺� - min-idle: 0 - # 杩炴帴姹犱腑鐨勬渶澶х┖闂茶繛鎺� - max-idle: 8 - # 杩炴帴姹犵殑鏈�澶ф暟鎹簱杩炴帴鏁� - max-active: 8 - # #杩炴帴姹犳渶澶ч樆濉炵瓑寰呮椂闂达紙浣跨敤璐熷�艰〃绀烘病鏈夐檺鍒讹級 - max-wait: -1ms + # 鏄惁寮�鍚痵sl + ssl: false + +--- # redisson 瀹㈡埛绔厤缃� +redisson: + # 绾跨▼姹犳暟閲� + threads: 16 + # Netty绾跨▼姹犳暟閲� + nettyThreads: 32 + # 浼犺緭妯″紡 + transportMode: "NIO" + # 鍗曡妭鐐归厤缃� + singleServerConfig: + # 瀹㈡埛绔悕绉� + clientName: ${ruoyi-vue-plus.name} + # 鏈�灏忕┖闂茶繛鎺ユ暟 + connectionMinimumIdleSize: 32 + # 杩炴帴姹犲ぇ灏� + connectionPoolSize: 64 + # 杩炴帴绌洪棽瓒呮椂锛屽崟浣嶏細姣 + idleConnectionTimeout: 10000 + # 鍛戒护绛夊緟瓒呮椂锛屽崟浣嶏細姣 + timeout: 3000 + # 濡傛灉灏濊瘯鍦ㄦ闄愬埗涔嬪唴鍙戦�佹垚鍔燂紝鍒欏紑濮嬪惎鐢� timeout 璁℃椂銆� + retryAttempts: 3 + # 鍛戒护閲嶈瘯鍙戦�佹椂闂撮棿闅旓紝鍗曚綅锛氭绉� + retryInterval: 1500 + # 鍙戝竷鍜岃闃呰繛鎺ョ殑鏈�灏忕┖闂茶繛鎺ユ暟 + subscriptionConnectionMinimumIdleSize: 1 + # 鍙戝竷鍜岃闃呰繛鎺ユ睜澶у皬 + subscriptionConnectionPoolSize: 50 + # 鍗曚釜杩炴帴鏈�澶ц闃呮暟閲� + subscriptionsPerConnection: 5 + # DNS鐩戞祴鏃堕棿闂撮殧锛屽崟浣嶏細姣 + dnsMonitoringInterval: 5000 diff --git a/ruoyi-admin/src/main/resources/application-prod.yml b/ruoyi-admin/src/main/resources/application-prod.yml index fbd01b3..eba8a89 100644 --- a/ruoyi-admin/src/main/resources/application-prod.yml +++ b/ruoyi-admin/src/main/resources/application-prod.yml @@ -67,13 +67,38 @@ password: # 杩炴帴瓒呮椂鏃堕棿 timeout: 10s - lettuce: - pool: - # 杩炴帴姹犱腑鐨勬渶灏忕┖闂茶繛鎺� - min-idle: 0 - # 杩炴帴姹犱腑鐨勬渶澶х┖闂茶繛鎺� - max-idle: 8 - # 杩炴帴姹犵殑鏈�澶ф暟鎹簱杩炴帴鏁� - max-active: 8 - # #杩炴帴姹犳渶澶ч樆濉炵瓑寰呮椂闂达紙浣跨敤璐熷�艰〃绀烘病鏈夐檺鍒讹級 - max-wait: -1ms \ No newline at end of file + # 鏄惁寮�鍚痵sl + ssl: false + +--- # redisson 瀹㈡埛绔厤缃� +redisson: + # 绾跨▼姹犳暟閲� + threads: 16 + # Netty绾跨▼姹犳暟閲� + nettyThreads: 32 + # 浼犺緭妯″紡 + transportMode: "NIO" + # 鍗曡妭鐐归厤缃� + singleServerConfig: + # 瀹㈡埛绔悕绉� + clientName: ${ruoyi-vue-plus.name} + # 鏈�灏忕┖闂茶繛鎺ユ暟 + connectionMinimumIdleSize: 32 + # 杩炴帴姹犲ぇ灏� + connectionPoolSize: 64 + # 杩炴帴绌洪棽瓒呮椂锛屽崟浣嶏細姣 + idleConnectionTimeout: 10000 + # 鍛戒护绛夊緟瓒呮椂锛屽崟浣嶏細姣 + timeout: 3000 + # 濡傛灉灏濊瘯鍦ㄦ闄愬埗涔嬪唴鍙戦�佹垚鍔燂紝鍒欏紑濮嬪惎鐢� timeout 璁℃椂銆� + retryAttempts: 3 + # 鍛戒护閲嶈瘯鍙戦�佹椂闂撮棿闅旓紝鍗曚綅锛氭绉� + retryInterval: 1500 + # 鍙戝竷鍜岃闃呰繛鎺ョ殑鏈�灏忕┖闂茶繛鎺ユ暟 + subscriptionConnectionMinimumIdleSize: 1 + # 鍙戝竷鍜岃闃呰繛鎺ユ睜澶у皬 + subscriptionConnectionPoolSize: 50 + # 鍗曚釜杩炴帴鏈�澶ц闃呮暟閲� + subscriptionsPerConnection: 5 + # DNS鐩戞祴鏃堕棿闂撮殧锛屽崟浣嶏細姣 + dnsMonitoringInterval: 5000 diff --git a/ruoyi-common/pom.xml b/ruoyi-common/pom.xml index 5f1404e..2c75fcd 100644 --- a/ruoyi-common/pom.xml +++ b/ruoyi-common/pom.xml @@ -151,6 +151,12 @@ <artifactId>spring-boot-configuration-processor</artifactId> </dependency> + <!--redisson--> + <dependency> + <groupId>org.redisson</groupId> + <artifactId>redisson-spring-boot-starter</artifactId> + </dependency> + </dependencies> </project> diff --git a/ruoyi-common/src/main/java/com/ruoyi/common/annotation/DataScope.java b/ruoyi-common/src/main/java/com/ruoyi/common/annotation/DataScope.java index 176878e..155f7c3 100644 --- a/ruoyi-common/src/main/java/com/ruoyi/common/annotation/DataScope.java +++ b/ruoyi-common/src/main/java/com/ruoyi/common/annotation/DataScope.java @@ -8,7 +8,7 @@ /** * 鏁版嵁鏉冮檺杩囨护娉ㄨВ - * + * * @author ruoyi */ @Target(ElementType.METHOD) @@ -25,4 +25,9 @@ * 鐢ㄦ埛琛ㄧ殑鍒悕 */ public String userAlias() default ""; + + /** + * 鏄惁杩囨护鐢ㄦ埛鏉冮檺 + */ + public boolean isUser() default false; } diff --git a/ruoyi-common/src/main/java/com/ruoyi/common/core/redis/RedisCache.java b/ruoyi-common/src/main/java/com/ruoyi/common/core/redis/RedisCache.java index 22a610d..6c4c239 100644 --- a/ruoyi-common/src/main/java/com/ruoyi/common/core/redis/RedisCache.java +++ b/ruoyi-common/src/main/java/com/ruoyi/common/core/redis/RedisCache.java @@ -1,234 +1,219 @@ package com.ruoyi.common.core.redis; -import java.util.Collection; -import java.util.Iterator; -import java.util.List; -import java.util.Map; -import java.util.Set; -import java.util.concurrent.TimeUnit; +import com.google.common.collect.Lists; +import org.redisson.api.*; import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.data.redis.core.BoundSetOperations; -import org.springframework.data.redis.core.HashOperations; -import org.springframework.data.redis.core.RedisTemplate; -import org.springframework.data.redis.core.ValueOperations; import org.springframework.stereotype.Component; + +import java.util.*; +import java.util.concurrent.TimeUnit; /** * spring redis 宸ュ叿绫� * - * @author ruoyi + * @author shenxinquan **/ -@SuppressWarnings(value = { "unchecked", "rawtypes" }) +@SuppressWarnings(value = {"unchecked", "rawtypes"}) @Component -public class RedisCache -{ - @Autowired - public RedisTemplate redisTemplate; +public class RedisCache { - /** - * 缂撳瓨鍩烘湰鐨勫璞★紝Integer銆丼tring銆佸疄浣撶被绛� - * - * @param key 缂撳瓨鐨勯敭鍊� - * @param value 缂撳瓨鐨勫�� - */ - public <T> void setCacheObject(final String key, final T value) - { - redisTemplate.opsForValue().set(key, value); - } + @Autowired + private RedissonClient redissonClient; - /** - * 缂撳瓨鍩烘湰鐨勫璞★紝Integer銆丼tring銆佸疄浣撶被绛� - * - * @param key 缂撳瓨鐨勯敭鍊� - * @param value 缂撳瓨鐨勫�� - * @param timeout 鏃堕棿 - * @param timeUnit 鏃堕棿棰楃矑搴� - */ - public <T> void setCacheObject(final String key, final T value, final Integer timeout, final TimeUnit timeUnit) - { - redisTemplate.opsForValue().set(key, value, timeout, timeUnit); - } + /** + * 缂撳瓨鍩烘湰鐨勫璞★紝Integer銆丼tring銆佸疄浣撶被绛� + * + * @param key 缂撳瓨鐨勯敭鍊� + * @param value 缂撳瓨鐨勫�� + */ + public <T> void setCacheObject(final String key, final T value) { + redissonClient.getBucket(key).set(value); + } - /** - * 璁剧疆鏈夋晥鏃堕棿 - * - * @param key Redis閿� - * @param timeout 瓒呮椂鏃堕棿 - * @return true=璁剧疆鎴愬姛锛沠alse=璁剧疆澶辫触 - */ - public boolean expire(final String key, final long timeout) - { - return expire(key, timeout, TimeUnit.SECONDS); - } + /** + * 缂撳瓨鍩烘湰鐨勫璞★紝Integer銆丼tring銆佸疄浣撶被绛� + * + * @param key 缂撳瓨鐨勯敭鍊� + * @param value 缂撳瓨鐨勫�� + * @param timeout 鏃堕棿 + * @param timeUnit 鏃堕棿棰楃矑搴� + */ + public <T> void setCacheObject(final String key, final T value, final Integer timeout, final TimeUnit timeUnit) { + RBucket<T> result = redissonClient.getBucket(key); + result.set(value); + result.expire(timeout, timeUnit); + } - /** - * 璁剧疆鏈夋晥鏃堕棿 - * - * @param key Redis閿� - * @param timeout 瓒呮椂鏃堕棿 - * @param unit 鏃堕棿鍗曚綅 - * @return true=璁剧疆鎴愬姛锛沠alse=璁剧疆澶辫触 - */ - public boolean expire(final String key, final long timeout, final TimeUnit unit) - { - return redisTemplate.expire(key, timeout, unit); - } + /** + * 璁剧疆鏈夋晥鏃堕棿 + * + * @param key Redis閿� + * @param timeout 瓒呮椂鏃堕棿 + * @return true=璁剧疆鎴愬姛锛沠alse=璁剧疆澶辫触 + */ + public boolean expire(final String key, final long timeout) { + return expire(key, timeout, TimeUnit.SECONDS); + } - /** - * 鑾峰緱缂撳瓨鐨勫熀鏈璞°�� - * - * @param key 缂撳瓨閿�� - * @return 缂撳瓨閿�煎搴旂殑鏁版嵁 - */ - public <T> T getCacheObject(final String key) - { - ValueOperations<String, T> operation = redisTemplate.opsForValue(); - return operation.get(key); - } + /** + * 璁剧疆鏈夋晥鏃堕棿 + * + * @param key Redis閿� + * @param timeout 瓒呮椂鏃堕棿 + * @param unit 鏃堕棿鍗曚綅 + * @return true=璁剧疆鎴愬姛锛沠alse=璁剧疆澶辫触 + */ + public boolean expire(final String key, final long timeout, final TimeUnit unit) { + RBucket rBucket = redissonClient.getBucket(key); + return rBucket.expire(timeout, unit); + } - /** - * 鍒犻櫎鍗曚釜瀵硅薄 - * - * @param key - */ - public boolean deleteObject(final String key) - { - return redisTemplate.delete(key); - } + /** + * 鑾峰緱缂撳瓨鐨勫熀鏈璞°�� + * + * @param key 缂撳瓨閿�� + * @return 缂撳瓨閿�煎搴旂殑鏁版嵁 + */ + public <T> T getCacheObject(final String key) { + RBucket<T> rBucket = redissonClient.getBucket(key); + return rBucket.get(); + } - /** - * 鍒犻櫎闆嗗悎瀵硅薄 - * - * @param collection 澶氫釜瀵硅薄 - * @return - */ - public long deleteObject(final Collection collection) - { - return redisTemplate.delete(collection); - } + /** + * 鍒犻櫎鍗曚釜瀵硅薄 + * + * @param key + */ + public boolean deleteObject(final String key) { + return redissonClient.getBucket(key).delete(); + } - /** - * 缂撳瓨List鏁版嵁 - * - * @param key 缂撳瓨鐨勯敭鍊� - * @param dataList 寰呯紦瀛樼殑List鏁版嵁 - * @return 缂撳瓨鐨勫璞� - */ - public <T> long setCacheList(final String key, final List<T> dataList) - { - Long count = redisTemplate.opsForList().rightPushAll(key, dataList); - return count == null ? 0 : count; - } + /* */ - /** - * 鑾峰緱缂撳瓨鐨刲ist瀵硅薄 - * - * @param key 缂撳瓨鐨勯敭鍊� - * @return 缂撳瓨閿�煎搴旂殑鏁版嵁 - */ - public <T> List<T> getCacheList(final String key) - { - return redisTemplate.opsForList().range(key, 0, -1); - } + /** + * 鍒犻櫎闆嗗悎瀵硅薄 + * + * @param collection 澶氫釜瀵硅薄 + * @return + */ + public long deleteObject(final Collection collection) { + return redissonClient.getKeys().delete(Arrays.toString(collection.toArray())); + } - /** - * 缂撳瓨Set - * - * @param key 缂撳瓨閿�� - * @param dataSet 缂撳瓨鐨勬暟鎹� - * @return 缂撳瓨鏁版嵁鐨勫璞� - */ - public <T> BoundSetOperations<String, T> setCacheSet(final String key, final Set<T> dataSet) - { - BoundSetOperations<String, T> setOperation = redisTemplate.boundSetOps(key); - Iterator<T> it = dataSet.iterator(); - while (it.hasNext()) - { - setOperation.add(it.next()); - } - return setOperation; - } + /** + * 缂撳瓨List鏁版嵁 + * + * @param key 缂撳瓨鐨勯敭鍊� + * @param dataList 寰呯紦瀛樼殑List鏁版嵁 + * @return 缂撳瓨鐨勫璞� + */ + public <T> boolean setCacheList(final String key, final List<T> dataList) { + RList<T> rList = redissonClient.getList(key); + return rList.addAll(dataList); + } - /** - * 鑾峰緱缂撳瓨鐨剆et - * - * @param key - * @return - */ - public <T> Set<T> getCacheSet(final String key) - { - return redisTemplate.opsForSet().members(key); - } + /** + * 鑾峰緱缂撳瓨鐨刲ist瀵硅薄 + * + * @param key 缂撳瓨鐨勯敭鍊� + * @return 缂撳瓨閿�煎搴旂殑鏁版嵁 + */ + public <T> List<T> getCacheList(final String key) { + RList<T> rList = redissonClient.getList(key); + return rList.readAll(); + } - /** - * 缂撳瓨Map - * - * @param key - * @param dataMap - */ - public <T> void setCacheMap(final String key, final Map<String, T> dataMap) - { - if (dataMap != null) { - redisTemplate.opsForHash().putAll(key, dataMap); - } - } + /** + * 缂撳瓨Set + * + * @param key 缂撳瓨閿�� + * @param dataSet 缂撳瓨鐨勬暟鎹� + * @return 缂撳瓨鏁版嵁鐨勫璞� + */ + public <T> boolean setCacheSet(final String key, final Set<T> dataSet) { + RSet<T> rSet = redissonClient.getSet(key); + return rSet.addAll(dataSet); + } - /** - * 鑾峰緱缂撳瓨鐨凪ap - * - * @param key - * @return - */ - public <T> Map<String, T> getCacheMap(final String key) - { - return redisTemplate.opsForHash().entries(key); - } + /** + * 鑾峰緱缂撳瓨鐨剆et + * + * @param key + * @return + */ + public <T> Set<T> getCacheSet(final String key) { + RSet<T> rSet = redissonClient.getSet(key); + return rSet.readAll(); + } - /** - * 寰�Hash涓瓨鍏ユ暟鎹� - * - * @param key Redis閿� - * @param hKey Hash閿� - * @param value 鍊� - */ - public <T> void setCacheMapValue(final String key, final String hKey, final T value) - { - redisTemplate.opsForHash().put(key, hKey, value); - } + /** + * 缂撳瓨Map + * + * @param key + * @param dataMap + */ + public <T> void setCacheMap(final String key, final Map<String, T> dataMap) { + if (dataMap != null) { + RMap<String, T> rMap = redissonClient.getMap(key); + rMap.putAll(dataMap); + } + } - /** - * 鑾峰彇Hash涓殑鏁版嵁 - * - * @param key Redis閿� - * @param hKey Hash閿� - * @return Hash涓殑瀵硅薄 - */ - public <T> T getCacheMapValue(final String key, final String hKey) - { - HashOperations<String, String, T> opsForHash = redisTemplate.opsForHash(); - return opsForHash.get(key, hKey); - } + /** + * 鑾峰緱缂撳瓨鐨凪ap + * + * @param key + * @return + */ + public <T> Map<String, T> getCacheMap(final String key) { + RMap<String, T> rMap = redissonClient.getMap(key); + return rMap.getAll(rMap.keySet()); + } - /** - * 鑾峰彇澶氫釜Hash涓殑鏁版嵁 - * - * @param key Redis閿� - * @param hKeys Hash閿泦鍚� - * @return Hash瀵硅薄闆嗗悎 - */ - public <T> List<T> getMultiCacheMapValue(final String key, final Collection<Object> hKeys) - { - return redisTemplate.opsForHash().multiGet(key, hKeys); - } + /** + * 寰�Hash涓瓨鍏ユ暟鎹� + * + * @param key Redis閿� + * @param hKey Hash閿� + * @param value 鍊� + */ + public <T> void setCacheMapValue(final String key, final String hKey, final T value) { + RMap<String, T> rMap = redissonClient.getMap(key); + rMap.put(hKey, value); + } - /** - * 鑾峰緱缂撳瓨鐨勫熀鏈璞″垪琛� - * - * @param pattern 瀛楃涓插墠缂� - * @return 瀵硅薄鍒楄〃 - */ - public Collection<String> keys(final String pattern) - { - return redisTemplate.keys(pattern); - } + /** + * 鑾峰彇Hash涓殑鏁版嵁 + * + * @param key Redis閿� + * @param hKey Hash閿� + * @return Hash涓殑瀵硅薄 + */ + public <T> T getCacheMapValue(final String key, final String hKey) { + RMap<String, T> rMap = redissonClient.getMap(key); + return rMap.get(hKey); + } + + /** + * 鑾峰彇澶氫釜Hash涓殑鏁版嵁 + * + * @param key Redis閿� + * @param hKeys Hash閿泦鍚� + * @return Hash瀵硅薄闆嗗悎 + */ + public <T> List<T> getMultiCacheMapValue(final String key, final Collection<Object> hKeys) { + RListMultimap rListMultimap = redissonClient.getListMultimap(key); + return rListMultimap.getAll(hKeys); + } + + /** + * 鑾峰緱缂撳瓨鐨勫熀鏈璞″垪琛� + * + * @param pattern 瀛楃涓插墠缂� + * @return 瀵硅薄鍒楄〃 + */ + public Collection<String> keys(final String pattern) { + Iterable<String> iterable = redissonClient.getKeys().getKeysByPattern(pattern); + return Lists.newArrayList(iterable); + } } diff --git a/ruoyi-demo/src/main/java/com/ruoyi/demo/bo/ChkjTestAddBo.java b/ruoyi-demo/src/main/java/com/ruoyi/demo/bo/ChkjTestAddBo.java new file mode 100644 index 0000000..d8c406f --- /dev/null +++ b/ruoyi-demo/src/main/java/com/ruoyi/demo/bo/ChkjTestAddBo.java @@ -0,0 +1,50 @@ +package com.ruoyi.demo.bo; + +import com.fasterxml.jackson.annotation.JsonFormat; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +import javax.validation.constraints.NotBlank; +import javax.validation.constraints.NotNull; +import java.util.Date; + + + +/** + * 娴嬭瘯娣诲姞瀵硅薄 chkj_test + * + * @author Lion Li + * @date 2021-05-14 + */ +@Data +@ApiModel("娴嬭瘯娣诲姞瀵硅薄") +public class ChkjTestAddBo { + + /** key閿� */ + @ApiModelProperty("key閿�") + @NotBlank(message = "key閿笉鑳戒负绌�") + private String testKey; + /** 鍊� */ + @ApiModelProperty("鍊�") + @NotBlank(message = "鍊间笉鑳戒负绌�") + private String value; + /** 鐗堟湰 */ + @ApiModelProperty("鐗堟湰") + private Long version; + /** 鍒涘缓鏃堕棿 */ + @ApiModelProperty("鍒涘缓鏃堕棿") + @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") + private Date createTime; + /** 鍒犻櫎鏍囧織 */ + @ApiModelProperty("鍒犻櫎鏍囧織") + private Long deleted; + /** 鐖秈d */ + @ApiModelProperty("鐖秈d") + @NotNull(message = "鐖秈d涓嶈兘涓虹┖") + private Long parentId; + /** 鎺掑簭鍙� */ + @ApiModelProperty("鎺掑簭鍙�") + @NotNull(message = "鎺掑簭鍙蜂笉鑳戒负绌�") + private Long orderNum; +} diff --git a/ruoyi-demo/src/main/java/com/ruoyi/demo/bo/ChkjTestEditBo.java b/ruoyi-demo/src/main/java/com/ruoyi/demo/bo/ChkjTestEditBo.java new file mode 100644 index 0000000..acabd9f --- /dev/null +++ b/ruoyi-demo/src/main/java/com/ruoyi/demo/bo/ChkjTestEditBo.java @@ -0,0 +1,61 @@ +package com.ruoyi.demo.bo; + +import com.fasterxml.jackson.annotation.JsonFormat; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +import javax.validation.constraints.NotBlank; +import javax.validation.constraints.NotNull; +import java.util.Date; + + +/** + * 娴嬭瘯缂栬緫瀵硅薄 chkj_test + * + * @author Lion Li + * @date 2021-05-14 + */ +@Data +@ApiModel("娴嬭瘯缂栬緫瀵硅薄") +public class ChkjTestEditBo { + + + /** 涓婚敭 */ + @ApiModelProperty("涓婚敭") + @NotNull(message = "涓婚敭涓嶈兘涓虹┖") + private Long id; + + /** key閿� */ + @ApiModelProperty("key閿�") + @NotBlank(message = "key閿笉鑳戒负绌�") + private String testKey; + + /** 鍊� */ + @ApiModelProperty("鍊�") + @NotBlank(message = "鍊间笉鑳戒负绌�") + private String value; + + /** 鐗堟湰 */ + @ApiModelProperty("鐗堟湰") + private Long version; + + /** 鍒涘缓鏃堕棿 */ + @ApiModelProperty("鍒涘缓鏃堕棿") + @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") + private Date createTime; + + /** 鍒犻櫎鏍囧織 */ + @ApiModelProperty("鍒犻櫎鏍囧織") + private Long deleted; + + /** 鐖秈d */ + @ApiModelProperty("鐖秈d") + @NotNull(message = "鐖秈d涓嶈兘涓虹┖") + private Long parentId; + + /** 鎺掑簭鍙� */ + @ApiModelProperty("鎺掑簭鍙�") + @NotNull(message = "鎺掑簭鍙蜂笉鑳戒负绌�") + private Long orderNum; +} diff --git a/ruoyi-demo/src/main/java/com/ruoyi/demo/bo/ChkjTestQueryBo.java b/ruoyi-demo/src/main/java/com/ruoyi/demo/bo/ChkjTestQueryBo.java new file mode 100644 index 0000000..bc71509 --- /dev/null +++ b/ruoyi-demo/src/main/java/com/ruoyi/demo/bo/ChkjTestQueryBo.java @@ -0,0 +1,53 @@ +package com.ruoyi.demo.bo; + +import com.ruoyi.common.core.domain.BaseEntity; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; +import lombok.EqualsAndHashCode; + +/** + * 娴嬭瘯鍒嗛〉鏌ヨ瀵硅薄 chkj_test + * + * @author Lion Li + * @date 2021-05-14 + */ +@Data +@EqualsAndHashCode(callSuper = true) +@ApiModel("娴嬭瘯鍒嗛〉鏌ヨ瀵硅薄") +public class ChkjTestQueryBo extends BaseEntity { + + /** 鍒嗛〉澶у皬 */ + @ApiModelProperty("鍒嗛〉澶у皬") + private Integer pageSize; + /** 褰撳墠椤垫暟 */ + @ApiModelProperty("褰撳墠椤垫暟") + private Integer pageNum; + /** 鎺掑簭鍒� */ + @ApiModelProperty("鎺掑簭鍒�") + private String orderByColumn; + /** 鎺掑簭鐨勬柟鍚慸esc鎴栬�卆sc */ + @ApiModelProperty(value = "鎺掑簭鐨勬柟鍚�", example = "asc,desc") + private String isAsc; + + + /** key閿� */ + @ApiModelProperty("key閿�") + private String testKey; + /** 鍊� */ + @ApiModelProperty("鍊�") + private String value; + /** 鐗堟湰 */ + @ApiModelProperty("鐗堟湰") + private Long version; + /** 鍒犻櫎鏍囧織 */ + @ApiModelProperty("鍒犻櫎鏍囧織") + private Long deleted; + /** 鐖秈d */ + @ApiModelProperty("鐖秈d") + private Long parentId; + /** 鎺掑簭鍙� */ + @ApiModelProperty("鎺掑簭鍙�") + private Long orderNum; + +} diff --git a/ruoyi-demo/src/main/java/com/ruoyi/demo/bo/TestDemoAddBo.java b/ruoyi-demo/src/main/java/com/ruoyi/demo/bo/TestDemoAddBo.java new file mode 100644 index 0000000..a7e79f8 --- /dev/null +++ b/ruoyi-demo/src/main/java/com/ruoyi/demo/bo/TestDemoAddBo.java @@ -0,0 +1,43 @@ +package com.ruoyi.demo.bo; + +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +import javax.validation.constraints.NotBlank; + + + +/** + * 娴嬭瘯鍗曡〃娣诲姞瀵硅薄 test_demo + * + * @author Lion Li + * @date 2021-05-30 + */ +@Data +@ApiModel("娴嬭瘯鍗曡〃娣诲姞瀵硅薄") +public class TestDemoAddBo { + + /** 閮ㄩ棬id */ + @ApiModelProperty("閮ㄩ棬id") + private Long deptId; + + /** 鐢ㄦ埛id */ + @ApiModelProperty("鐢ㄦ埛id") + private Long userId; + + /** 鎺掑簭鍙� */ + @ApiModelProperty("鎺掑簭鍙�") + private Long orderNum; + + /** key閿� */ + @ApiModelProperty("key閿�") + @NotBlank(message = "key閿笉鑳戒负绌�") + private String testKey; + + /** 鍊� */ + @ApiModelProperty("鍊�") + @NotBlank(message = "鍊间笉鑳戒负绌�") + private String value; + +} diff --git a/ruoyi-demo/src/main/java/com/ruoyi/demo/bo/TestDemoEditBo.java b/ruoyi-demo/src/main/java/com/ruoyi/demo/bo/TestDemoEditBo.java new file mode 100644 index 0000000..639443b --- /dev/null +++ b/ruoyi-demo/src/main/java/com/ruoyi/demo/bo/TestDemoEditBo.java @@ -0,0 +1,52 @@ +package com.ruoyi.demo.bo; + +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +import javax.validation.constraints.NotBlank; + + +/** + * 娴嬭瘯鍗曡〃缂栬緫瀵硅薄 test_demo + * + * @author Lion Li + * @date 2021-05-30 + */ +@Data +@ApiModel("娴嬭瘯鍗曡〃缂栬緫瀵硅薄") +public class TestDemoEditBo { + + + /** 涓婚敭 */ + @ApiModelProperty("涓婚敭") + private Long id; + + + /** 閮ㄩ棬id */ + @ApiModelProperty("閮ㄩ棬id") + private Long deptId; + + + /** 鐢ㄦ埛id */ + @ApiModelProperty("鐢ㄦ埛id") + private Long userId; + + + /** 鎺掑簭鍙� */ + @ApiModelProperty("鎺掑簭鍙�") + private Long orderNum; + + + /** key閿� */ + @ApiModelProperty("key閿�") + @NotBlank(message = "key閿笉鑳戒负绌�") + private String testKey; + + + /** 鍊� */ + @ApiModelProperty("鍊�") + @NotBlank(message = "鍊间笉鑳戒负绌�") + private String value; + +} diff --git a/ruoyi-demo/src/main/java/com/ruoyi/demo/bo/TestDemoQueryBo.java b/ruoyi-demo/src/main/java/com/ruoyi/demo/bo/TestDemoQueryBo.java new file mode 100644 index 0000000..ca2bb5a --- /dev/null +++ b/ruoyi-demo/src/main/java/com/ruoyi/demo/bo/TestDemoQueryBo.java @@ -0,0 +1,42 @@ +package com.ruoyi.demo.bo; + +import com.ruoyi.common.core.domain.BaseEntity; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; +import lombok.EqualsAndHashCode; + +/** + * 娴嬭瘯鍗曡〃鍒嗛〉鏌ヨ瀵硅薄 test_demo + * + * @author Lion Li + * @date 2021-05-30 + */ + +@Data +@EqualsAndHashCode(callSuper = true) +@ApiModel("娴嬭瘯鍗曡〃鍒嗛〉鏌ヨ瀵硅薄") +public class TestDemoQueryBo extends BaseEntity { + + /** 鍒嗛〉澶у皬 */ + @ApiModelProperty("鍒嗛〉澶у皬") + private Integer pageSize; + /** 褰撳墠椤垫暟 */ + @ApiModelProperty("褰撳墠椤垫暟") + private Integer pageNum; + /** 鎺掑簭鍒� */ + @ApiModelProperty("鎺掑簭鍒�") + private String orderByColumn; + /** 鎺掑簭鐨勬柟鍚慸esc鎴栬�卆sc */ + @ApiModelProperty(value = "鎺掑簭鐨勬柟鍚�", example = "asc,desc") + private String isAsc; + + + /** key閿� */ + @ApiModelProperty("key閿�") + private String testKey; + /** 鍊� */ + @ApiModelProperty("鍊�") + private String value; + +} diff --git a/ruoyi-demo/src/main/java/com/ruoyi/demo/bo/TestTreeAddBo.java b/ruoyi-demo/src/main/java/com/ruoyi/demo/bo/TestTreeAddBo.java new file mode 100644 index 0000000..a9a4b5e --- /dev/null +++ b/ruoyi-demo/src/main/java/com/ruoyi/demo/bo/TestTreeAddBo.java @@ -0,0 +1,39 @@ +package com.ruoyi.demo.bo; + +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import com.fasterxml.jackson.annotation.JsonFormat; +import lombok.Data; +import java.util.Date; +import javax.validation.constraints.*; + + + +/** + * 娴嬭瘯鏍戣〃娣诲姞瀵硅薄 test_tree + * + * @author Lion Li + * @date 2021-05-30 + */ +@Data +@ApiModel("娴嬭瘯鏍戣〃娣诲姞瀵硅薄") +public class TestTreeAddBo { + + /** 鐖秈d */ + @ApiModelProperty("鐖秈d") + private Long parentId; + + /** 閮ㄩ棬id */ + @ApiModelProperty("閮ㄩ棬id") + private Long deptId; + + /** 鐢ㄦ埛id */ + @ApiModelProperty("鐢ㄦ埛id") + private Long userId; + + /** 鏍戣妭鐐瑰悕 */ + @ApiModelProperty("鏍戣妭鐐瑰悕") + @NotBlank(message = "鏍戣妭鐐瑰悕涓嶈兘涓虹┖") + private String treeName; + +} diff --git a/ruoyi-demo/src/main/java/com/ruoyi/demo/bo/TestTreeEditBo.java b/ruoyi-demo/src/main/java/com/ruoyi/demo/bo/TestTreeEditBo.java new file mode 100644 index 0000000..e3d359d --- /dev/null +++ b/ruoyi-demo/src/main/java/com/ruoyi/demo/bo/TestTreeEditBo.java @@ -0,0 +1,47 @@ +package com.ruoyi.demo.bo; + +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import com.fasterxml.jackson.annotation.JsonFormat; +import lombok.Data; +import java.util.Date; +import javax.validation.constraints.*; + + +/** + * 娴嬭瘯鏍戣〃缂栬緫瀵硅薄 test_tree + * + * @author Lion Li + * @date 2021-05-30 + */ +@Data +@ApiModel("娴嬭瘯鏍戣〃缂栬緫瀵硅薄") +public class TestTreeEditBo { + + + /** 涓婚敭 */ + @ApiModelProperty("涓婚敭") + private Long id; + + + /** 鐖秈d */ + @ApiModelProperty("鐖秈d") + private Long parentId; + + + /** 閮ㄩ棬id */ + @ApiModelProperty("閮ㄩ棬id") + private Long deptId; + + + /** 鐢ㄦ埛id */ + @ApiModelProperty("鐢ㄦ埛id") + private Long userId; + + + /** 鏍戣妭鐐瑰悕 */ + @ApiModelProperty("鏍戣妭鐐瑰悕") + @NotBlank(message = "鏍戣妭鐐瑰悕涓嶈兘涓虹┖") + private String treeName; + +} diff --git a/ruoyi-demo/src/main/java/com/ruoyi/demo/bo/TestTreeQueryBo.java b/ruoyi-demo/src/main/java/com/ruoyi/demo/bo/TestTreeQueryBo.java new file mode 100644 index 0000000..3ed482b --- /dev/null +++ b/ruoyi-demo/src/main/java/com/ruoyi/demo/bo/TestTreeQueryBo.java @@ -0,0 +1,42 @@ +package com.ruoyi.demo.bo; + +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; +import lombok.EqualsAndHashCode; + +import java.util.Date; + +import com.ruoyi.common.core.domain.BaseEntity; + +/** + * 娴嬭瘯鏍戣〃鍒嗛〉鏌ヨ瀵硅薄 test_tree + * + * @author Lion Li + * @date 2021-05-30 + */ + +@Data +@EqualsAndHashCode(callSuper = true) +@ApiModel("娴嬭瘯鏍戣〃鍒嗛〉鏌ヨ瀵硅薄") +public class TestTreeQueryBo extends BaseEntity { + + /** 鍒嗛〉澶у皬 */ + @ApiModelProperty("鍒嗛〉澶у皬") + private Integer pageSize; + /** 褰撳墠椤垫暟 */ + @ApiModelProperty("褰撳墠椤垫暟") + private Integer pageNum; + /** 鎺掑簭鍒� */ + @ApiModelProperty("鎺掑簭鍒�") + private String orderByColumn; + /** 鎺掑簭鐨勬柟鍚慸esc鎴栬�卆sc */ + @ApiModelProperty(value = "鎺掑簭鐨勬柟鍚�", example = "asc,desc") + private String isAsc; + + + /** 鏍戣妭鐐瑰悕 */ + @ApiModelProperty("鏍戣妭鐐瑰悕") + private String treeName; + +} diff --git a/ruoyi-demo/src/main/java/com/ruoyi/demo/controller/ChkjTestController.java b/ruoyi-demo/src/main/java/com/ruoyi/demo/controller/ChkjTestController.java new file mode 100644 index 0000000..429db8f --- /dev/null +++ b/ruoyi-demo/src/main/java/com/ruoyi/demo/controller/ChkjTestController.java @@ -0,0 +1,108 @@ +package com.ruoyi.demo.controller; + +import com.ruoyi.common.annotation.Log; +import com.ruoyi.common.core.controller.BaseController; +import com.ruoyi.common.core.domain.AjaxResult; +import com.ruoyi.common.core.page.TableDataInfo; +import com.ruoyi.common.enums.BusinessType; +import com.ruoyi.common.utils.poi.ExcelUtil; +import com.ruoyi.demo.bo.ChkjTestAddBo; +import com.ruoyi.demo.bo.ChkjTestEditBo; +import com.ruoyi.demo.bo.ChkjTestQueryBo; +import com.ruoyi.demo.service.IChkjTestService; +import com.ruoyi.demo.vo.ChkjTestVo; +import io.swagger.annotations.Api; +import io.swagger.annotations.ApiOperation; +import lombok.RequiredArgsConstructor; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.security.access.prepost.PreAuthorize; +import org.springframework.validation.annotation.Validated; +import org.springframework.web.bind.annotation.*; + +import javax.validation.constraints.NotEmpty; +import javax.validation.constraints.NotNull; +import java.util.Arrays; +import java.util.List; + +/** + * 娴嬭瘯Controller + * + * @author Lion Li + * @date 2021-05-14 + */ +@Api(value = "娴嬭瘯鎺у埗鍣�", tags = {"娴嬭瘯绠$悊"}) +@RequiredArgsConstructor(onConstructor_ = @Autowired) +@RestController +@RequestMapping("/demo/test") +public class ChkjTestController extends BaseController { + + private final IChkjTestService iChkjTestService; + + /** + * 鏌ヨ娴嬭瘯鍒楄〃 + */ + @ApiOperation("鏌ヨ娴嬭瘯鍒楄〃") + @PreAuthorize("@ss.hasPermi('demo:test:list')") + @GetMapping("/list") + public TableDataInfo<ChkjTestVo> list(@Validated ChkjTestQueryBo bo) { + return iChkjTestService.queryPageList(bo); + } + + /** + * 瀵煎嚭娴嬭瘯鍒楄〃 + */ + @ApiOperation("瀵煎嚭娴嬭瘯鍒楄〃") + @PreAuthorize("@ss.hasPermi('demo:test:export')") + @Log(title = "娴嬭瘯", businessType = BusinessType.EXPORT) + @GetMapping("/export") + public AjaxResult<ChkjTestVo> export(@Validated ChkjTestQueryBo bo) { + List<ChkjTestVo> list = iChkjTestService.queryList(bo); + ExcelUtil<ChkjTestVo> util = new ExcelUtil<ChkjTestVo>(ChkjTestVo.class); + return util.exportExcel(list, "娴嬭瘯"); + } + + /** + * 鑾峰彇娴嬭瘯璇︾粏淇℃伅 + */ + @ApiOperation("鑾峰彇娴嬭瘯璇︾粏淇℃伅") + @PreAuthorize("@ss.hasPermi('demo:test:query')") + @GetMapping("/{id}") + public AjaxResult<ChkjTestVo> getInfo(@NotNull(message = "涓婚敭涓嶈兘涓虹┖") + @PathVariable("id") Long id) { + return AjaxResult.success(iChkjTestService.queryById(id)); + } + + /** + * 鏂板娴嬭瘯 + */ + @ApiOperation("鏂板娴嬭瘯") + @PreAuthorize("@ss.hasPermi('demo:test:add')") + @Log(title = "娴嬭瘯", businessType = BusinessType.INSERT) + @PostMapping() + public AjaxResult<Void> add(@Validated @RequestBody ChkjTestAddBo bo) { + return toAjax(iChkjTestService.insertByAddBo(bo) ? 1 : 0); + } + + /** + * 淇敼娴嬭瘯 + */ + @ApiOperation("淇敼娴嬭瘯") + @PreAuthorize("@ss.hasPermi('demo:test:edit')") + @Log(title = "娴嬭瘯", businessType = BusinessType.UPDATE) + @PutMapping() + public AjaxResult<Void> edit(@Validated @RequestBody ChkjTestEditBo bo) { + return toAjax(iChkjTestService.updateByEditBo(bo) ? 1 : 0); + } + + /** + * 鍒犻櫎娴嬭瘯 + */ + @ApiOperation("鍒犻櫎娴嬭瘯") + @PreAuthorize("@ss.hasPermi('demo:test:remove')") + @Log(title = "娴嬭瘯" , businessType = BusinessType.DELETE) + @DeleteMapping("/{ids}") + public AjaxResult<Void> remove(@NotEmpty(message = "涓婚敭涓嶈兘涓虹┖") + @PathVariable Long[] ids) { + return toAjax(iChkjTestService.deleteWithValidByIds(Arrays.asList(ids), true) ? 1 : 0); + } +} diff --git a/ruoyi-demo/src/main/java/com/ruoyi/demo/controller/TestDemoController.java b/ruoyi-demo/src/main/java/com/ruoyi/demo/controller/TestDemoController.java new file mode 100644 index 0000000..2ac99d6 --- /dev/null +++ b/ruoyi-demo/src/main/java/com/ruoyi/demo/controller/TestDemoController.java @@ -0,0 +1,108 @@ +package com.ruoyi.demo.controller; + +import com.ruoyi.common.annotation.Log; +import com.ruoyi.common.core.controller.BaseController; +import com.ruoyi.common.core.domain.AjaxResult; +import com.ruoyi.common.core.page.TableDataInfo; +import com.ruoyi.common.enums.BusinessType; +import com.ruoyi.common.utils.poi.ExcelUtil; +import com.ruoyi.demo.bo.TestDemoAddBo; +import com.ruoyi.demo.bo.TestDemoEditBo; +import com.ruoyi.demo.bo.TestDemoQueryBo; +import com.ruoyi.demo.service.ITestDemoService; +import com.ruoyi.demo.vo.TestDemoVo; +import io.swagger.annotations.Api; +import io.swagger.annotations.ApiOperation; +import lombok.RequiredArgsConstructor; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.security.access.prepost.PreAuthorize; +import org.springframework.validation.annotation.Validated; +import org.springframework.web.bind.annotation.*; + +import javax.validation.constraints.NotEmpty; +import javax.validation.constraints.NotNull; +import java.util.Arrays; +import java.util.List; + +/** + * 娴嬭瘯鍗曡〃Controller + * + * @author Lion Li + * @date 2021-05-30 + */ +@Api(value = "娴嬭瘯鍗曡〃鎺у埗鍣�", tags = {"娴嬭瘯鍗曡〃绠$悊"}) +@RequiredArgsConstructor(onConstructor_ = @Autowired) +@RestController +@RequestMapping("/demo/demo") +public class TestDemoController extends BaseController { + + private final ITestDemoService iTestDemoService; + + /** + * 鏌ヨ娴嬭瘯鍗曡〃鍒楄〃 + */ + @ApiOperation("鏌ヨ娴嬭瘯鍗曡〃鍒楄〃") + @PreAuthorize("@ss.hasPermi('demo:demo:list')") + @GetMapping("/list") + public TableDataInfo<TestDemoVo> list(@Validated TestDemoQueryBo bo) { + return iTestDemoService.queryPageList(bo); + } + + /** + * 瀵煎嚭娴嬭瘯鍗曡〃鍒楄〃 + */ + @ApiOperation("瀵煎嚭娴嬭瘯鍗曡〃鍒楄〃") + @PreAuthorize("@ss.hasPermi('demo:demo:export')") + @Log(title = "娴嬭瘯鍗曡〃", businessType = BusinessType.EXPORT) + @GetMapping("/export") + public AjaxResult<TestDemoVo> export(@Validated TestDemoQueryBo bo) { + List<TestDemoVo> list = iTestDemoService.queryList(bo); + ExcelUtil<TestDemoVo> util = new ExcelUtil<TestDemoVo>(TestDemoVo.class); + return util.exportExcel(list, "娴嬭瘯鍗曡〃"); + } + + /** + * 鑾峰彇娴嬭瘯鍗曡〃璇︾粏淇℃伅 + */ + @ApiOperation("鑾峰彇娴嬭瘯鍗曡〃璇︾粏淇℃伅") + @PreAuthorize("@ss.hasPermi('demo:demo:query')") + @GetMapping("/{id}") + public AjaxResult<TestDemoVo> getInfo(@NotNull(message = "涓婚敭涓嶈兘涓虹┖") + @PathVariable("id") Long id) { + return AjaxResult.success(iTestDemoService.queryById(id)); + } + + /** + * 鏂板娴嬭瘯鍗曡〃 + */ + @ApiOperation("鏂板娴嬭瘯鍗曡〃") + @PreAuthorize("@ss.hasPermi('demo:demo:add')") + @Log(title = "娴嬭瘯鍗曡〃", businessType = BusinessType.INSERT) + @PostMapping() + public AjaxResult<Void> add(@Validated @RequestBody TestDemoAddBo bo) { + return toAjax(iTestDemoService.insertByAddBo(bo) ? 1 : 0); + } + + /** + * 淇敼娴嬭瘯鍗曡〃 + */ + @ApiOperation("淇敼娴嬭瘯鍗曡〃") + @PreAuthorize("@ss.hasPermi('demo:demo:edit')") + @Log(title = "娴嬭瘯鍗曡〃", businessType = BusinessType.UPDATE) + @PutMapping() + public AjaxResult<Void> edit(@Validated @RequestBody TestDemoEditBo bo) { + return toAjax(iTestDemoService.updateByEditBo(bo) ? 1 : 0); + } + + /** + * 鍒犻櫎娴嬭瘯鍗曡〃 + */ + @ApiOperation("鍒犻櫎娴嬭瘯鍗曡〃") + @PreAuthorize("@ss.hasPermi('demo:demo:remove')") + @Log(title = "娴嬭瘯鍗曡〃" , businessType = BusinessType.DELETE) + @DeleteMapping("/{ids}") + public AjaxResult<Void> remove(@NotEmpty(message = "涓婚敭涓嶈兘涓虹┖") + @PathVariable Long[] ids) { + return toAjax(iTestDemoService.deleteWithValidByIds(Arrays.asList(ids), true) ? 1 : 0); + } +} diff --git a/ruoyi-demo/src/main/java/com/ruoyi/demo/controller/TestTreeController.java b/ruoyi-demo/src/main/java/com/ruoyi/demo/controller/TestTreeController.java new file mode 100644 index 0000000..54f1027 --- /dev/null +++ b/ruoyi-demo/src/main/java/com/ruoyi/demo/controller/TestTreeController.java @@ -0,0 +1,107 @@ +package com.ruoyi.demo.controller; + +import com.ruoyi.common.annotation.Log; +import com.ruoyi.common.core.controller.BaseController; +import com.ruoyi.common.core.domain.AjaxResult; +import com.ruoyi.common.enums.BusinessType; +import com.ruoyi.common.utils.poi.ExcelUtil; +import com.ruoyi.demo.bo.TestTreeAddBo; +import com.ruoyi.demo.bo.TestTreeEditBo; +import com.ruoyi.demo.bo.TestTreeQueryBo; +import com.ruoyi.demo.service.ITestTreeService; +import com.ruoyi.demo.vo.TestTreeVo; +import io.swagger.annotations.Api; +import io.swagger.annotations.ApiOperation; +import lombok.RequiredArgsConstructor; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.security.access.prepost.PreAuthorize; +import org.springframework.validation.annotation.Validated; +import org.springframework.web.bind.annotation.*; + +import javax.validation.constraints.NotEmpty; +import javax.validation.constraints.NotNull; +import java.util.Arrays; +import java.util.List; + +/** + * 娴嬭瘯鏍戣〃Controller + * + * @author Lion Li + * @date 2021-05-30 + */ +@Api(value = "娴嬭瘯鏍戣〃鎺у埗鍣�", tags = {"娴嬭瘯鏍戣〃绠$悊"}) +@RequiredArgsConstructor(onConstructor_ = @Autowired) +@RestController +@RequestMapping("/demo/tree") +public class TestTreeController extends BaseController { + + private final ITestTreeService iTestTreeService; + + /** + * 鏌ヨ娴嬭瘯鏍戣〃鍒楄〃 + */ + @ApiOperation("鏌ヨ娴嬭瘯鏍戣〃鍒楄〃") + @PreAuthorize("@ss.hasPermi('demo:tree:list')") + @GetMapping("/list") + public AjaxResult<List<TestTreeVo>> list(@Validated TestTreeQueryBo bo) { + return AjaxResult.success(iTestTreeService.queryList(bo)); + } + + /** + * 瀵煎嚭娴嬭瘯鏍戣〃鍒楄〃 + */ + @ApiOperation("瀵煎嚭娴嬭瘯鏍戣〃鍒楄〃") + @PreAuthorize("@ss.hasPermi('demo:tree:export')") + @Log(title = "娴嬭瘯鏍戣〃", businessType = BusinessType.EXPORT) + @GetMapping("/export") + public AjaxResult<TestTreeVo> export(@Validated TestTreeQueryBo bo) { + List<TestTreeVo> list = iTestTreeService.queryList(bo); + ExcelUtil<TestTreeVo> util = new ExcelUtil<TestTreeVo>(TestTreeVo.class); + return util.exportExcel(list, "娴嬭瘯鏍戣〃"); + } + + /** + * 鑾峰彇娴嬭瘯鏍戣〃璇︾粏淇℃伅 + */ + @ApiOperation("鑾峰彇娴嬭瘯鏍戣〃璇︾粏淇℃伅") + @PreAuthorize("@ss.hasPermi('demo:tree:query')") + @GetMapping("/{id}") + public AjaxResult<TestTreeVo> getInfo(@NotNull(message = "涓婚敭涓嶈兘涓虹┖") + @PathVariable("id") Long id) { + return AjaxResult.success(iTestTreeService.queryById(id)); + } + + /** + * 鏂板娴嬭瘯鏍戣〃 + */ + @ApiOperation("鏂板娴嬭瘯鏍戣〃") + @PreAuthorize("@ss.hasPermi('demo:tree:add')") + @Log(title = "娴嬭瘯鏍戣〃", businessType = BusinessType.INSERT) + @PostMapping() + public AjaxResult<Void> add(@Validated @RequestBody TestTreeAddBo bo) { + return toAjax(iTestTreeService.insertByAddBo(bo) ? 1 : 0); + } + + /** + * 淇敼娴嬭瘯鏍戣〃 + */ + @ApiOperation("淇敼娴嬭瘯鏍戣〃") + @PreAuthorize("@ss.hasPermi('demo:tree:edit')") + @Log(title = "娴嬭瘯鏍戣〃", businessType = BusinessType.UPDATE) + @PutMapping() + public AjaxResult<Void> edit(@Validated @RequestBody TestTreeEditBo bo) { + return toAjax(iTestTreeService.updateByEditBo(bo) ? 1 : 0); + } + + /** + * 鍒犻櫎娴嬭瘯鏍戣〃 + */ + @ApiOperation("鍒犻櫎娴嬭瘯鏍戣〃") + @PreAuthorize("@ss.hasPermi('demo:tree:remove')") + @Log(title = "娴嬭瘯鏍戣〃" , businessType = BusinessType.DELETE) + @DeleteMapping("/{ids}") + public AjaxResult<Void> remove(@NotEmpty(message = "涓婚敭涓嶈兘涓虹┖") + @PathVariable Long[] ids) { + return toAjax(iTestTreeService.deleteWithValidByIds(Arrays.asList(ids), true) ? 1 : 0); + } +} diff --git a/ruoyi-demo/src/main/java/com/ruoyi/demo/domain/ChkjTest.java b/ruoyi-demo/src/main/java/com/ruoyi/demo/domain/ChkjTest.java new file mode 100644 index 0000000..ca46d5b --- /dev/null +++ b/ruoyi-demo/src/main/java/com/ruoyi/demo/domain/ChkjTest.java @@ -0,0 +1,55 @@ +package com.ruoyi.demo.domain; + +import com.baomidou.mybatisplus.annotation.FieldFill; +import com.baomidou.mybatisplus.annotation.TableField; +import com.baomidou.mybatisplus.annotation.TableId; +import com.baomidou.mybatisplus.annotation.TableName; +import lombok.Data; +import lombok.NoArgsConstructor; +import lombok.experimental.Accessors; + +import java.io.Serializable; +import java.util.Date; + +/** + * 娴嬭瘯瀵硅薄 chkj_test + * + * @author Lion Li + * @date 2021-05-14 + */ +@Data +@NoArgsConstructor +@Accessors(chain = true) +@TableName("chkj_test") +public class ChkjTest implements Serializable { + +private static final long serialVersionUID=1L; + + + /** 涓婚敭 */ + @TableId(value = "id") + private Long id; + + /** key閿� */ + private String testKey; + + /** 鍊� */ + private String value; + + /** 鐗堟湰 */ + private Long version; + + /** 鍒涘缓鏃堕棿 */ + @TableField(fill = FieldFill.INSERT) + private Date createTime; + + /** 鍒犻櫎鏍囧織 */ + private Long deleted; + + /** 鐖秈d */ + private Long parentId; + + /** 鎺掑簭鍙� */ + private Long orderNum; + +} diff --git a/ruoyi-demo/src/main/java/com/ruoyi/demo/domain/TestDemo.java b/ruoyi-demo/src/main/java/com/ruoyi/demo/domain/TestDemo.java new file mode 100644 index 0000000..f038706 --- /dev/null +++ b/ruoyi-demo/src/main/java/com/ruoyi/demo/domain/TestDemo.java @@ -0,0 +1,70 @@ +package com.ruoyi.demo.domain; + +import com.baomidou.mybatisplus.annotation.*; +import lombok.Data; +import lombok.NoArgsConstructor; +import lombok.experimental.Accessors; + +import java.io.Serializable; +import java.util.Date; + +/** + * 娴嬭瘯鍗曡〃瀵硅薄 test_demo + * + * @author Lion Li + * @date 2021-05-30 + */ +@Data +@NoArgsConstructor +@Accessors(chain = true) +@TableName("test_demo") +public class TestDemo implements Serializable { + + private static final long serialVersionUID=1L; + + + /** 涓婚敭 */ + @TableId(value = "id") + private Long id; + + /** 閮ㄩ棬id */ + private Long deptId; + + /** 鐢ㄦ埛id */ + private Long userId; + + /** 鎺掑簭鍙� */ + @OrderBy(isDesc = false, sort = 1) + private Long orderNum; + + /** key閿� */ + private String testKey; + + /** 鍊� */ + private String value; + + /** 鐗堟湰 */ + @Version + private Long version; + + /** 鍒涘缓鏃堕棿 */ + @TableField(fill = FieldFill.INSERT) + private Date createTime; + + /** 鍒涘缓浜� */ + @TableField(fill = FieldFill.INSERT) + private String createBy; + + /** 鏇存柊鏃堕棿 */ + @TableField(fill = FieldFill.INSERT_UPDATE) + private Date updateTime; + + /** 鏇存柊浜� */ + @TableField(fill = FieldFill.INSERT_UPDATE) + private String updateBy; + + /** 鍒犻櫎鏍囧織 */ + @TableLogic + private Long delFlag; + +} diff --git a/ruoyi-demo/src/main/java/com/ruoyi/demo/domain/TestTree.java b/ruoyi-demo/src/main/java/com/ruoyi/demo/domain/TestTree.java new file mode 100644 index 0000000..43d1efe --- /dev/null +++ b/ruoyi-demo/src/main/java/com/ruoyi/demo/domain/TestTree.java @@ -0,0 +1,67 @@ +package com.ruoyi.demo.domain; + +import com.baomidou.mybatisplus.annotation.*; +import lombok.Data; +import lombok.NoArgsConstructor; +import lombok.experimental.Accessors; +import java.io.Serializable; +import java.util.Date; +import java.math.BigDecimal; +import com.ruoyi.common.annotation.Excel; + +/** + * 娴嬭瘯鏍戣〃瀵硅薄 test_tree + * + * @author Lion Li + * @date 2021-05-30 + */ +@Data +@NoArgsConstructor +@Accessors(chain = true) +@TableName("test_tree") +public class TestTree implements Serializable { + + private static final long serialVersionUID=1L; + + + /** 涓婚敭 */ + @TableId(value = "id") + private Long id; + + /** 鐖秈d */ + private Long parentId; + + /** 閮ㄩ棬id */ + private Long deptId; + + /** 鐢ㄦ埛id */ + private Long userId; + + /** 鏍戣妭鐐瑰悕 */ + private String treeName; + + /** 鐗堟湰 */ + @Version + private Long version; + + /** 鍒涘缓鏃堕棿 */ + @TableField(fill = FieldFill.INSERT) + private Date createTime; + + /** 鍒涘缓浜� */ + @TableField(fill = FieldFill.INSERT) + private String createBy; + + /** 鏇存柊鏃堕棿 */ + @TableField(fill = FieldFill.INSERT_UPDATE) + private Date updateTime; + + /** 鏇存柊浜� */ + @TableField(fill = FieldFill.INSERT_UPDATE) + private String updateBy; + + /** 鍒犻櫎鏍囧織 */ + @TableLogic + private Long delFlag; + +} diff --git a/ruoyi-demo/src/main/java/com/ruoyi/demo/mapper/ChkjTestMapper.java b/ruoyi-demo/src/main/java/com/ruoyi/demo/mapper/ChkjTestMapper.java new file mode 100644 index 0000000..8742297 --- /dev/null +++ b/ruoyi-demo/src/main/java/com/ruoyi/demo/mapper/ChkjTestMapper.java @@ -0,0 +1,14 @@ +package com.ruoyi.demo.mapper; + +import com.ruoyi.demo.domain.ChkjTest; +import com.ruoyi.common.core.page.BaseMapperPlus; + +/** + * 娴嬭瘯Mapper鎺ュ彛 + * + * @author Lion Li + * @date 2021-05-14 + */ +public interface ChkjTestMapper extends BaseMapperPlus<ChkjTest> { + +} diff --git a/ruoyi-demo/src/main/java/com/ruoyi/demo/mapper/TestDemoMapper.java b/ruoyi-demo/src/main/java/com/ruoyi/demo/mapper/TestDemoMapper.java new file mode 100644 index 0000000..2416f0e --- /dev/null +++ b/ruoyi-demo/src/main/java/com/ruoyi/demo/mapper/TestDemoMapper.java @@ -0,0 +1,14 @@ +package com.ruoyi.demo.mapper; + +import com.ruoyi.demo.domain.TestDemo; +import com.ruoyi.common.core.page.BaseMapperPlus; + +/** + * 娴嬭瘯鍗曡〃Mapper鎺ュ彛 + * + * @author Lion Li + * @date 2021-05-30 + */ +public interface TestDemoMapper extends BaseMapperPlus<TestDemo> { + +} diff --git a/ruoyi-demo/src/main/java/com/ruoyi/demo/mapper/TestTreeMapper.java b/ruoyi-demo/src/main/java/com/ruoyi/demo/mapper/TestTreeMapper.java new file mode 100644 index 0000000..6dd75c5 --- /dev/null +++ b/ruoyi-demo/src/main/java/com/ruoyi/demo/mapper/TestTreeMapper.java @@ -0,0 +1,14 @@ +package com.ruoyi.demo.mapper; + +import com.ruoyi.demo.domain.TestTree; +import com.ruoyi.common.core.page.BaseMapperPlus; + +/** + * 娴嬭瘯鏍戣〃Mapper鎺ュ彛 + * + * @author Lion Li + * @date 2021-05-30 + */ +public interface TestTreeMapper extends BaseMapperPlus<TestTree> { + +} diff --git a/ruoyi-demo/src/main/java/com/ruoyi/demo/service/IChkjTestService.java b/ruoyi-demo/src/main/java/com/ruoyi/demo/service/IChkjTestService.java new file mode 100644 index 0000000..8896714 --- /dev/null +++ b/ruoyi-demo/src/main/java/com/ruoyi/demo/service/IChkjTestService.java @@ -0,0 +1,57 @@ +package com.ruoyi.demo.service; + +import com.ruoyi.demo.domain.ChkjTest; +import com.ruoyi.demo.vo.ChkjTestVo; +import com.ruoyi.demo.bo.ChkjTestQueryBo; +import com.ruoyi.demo.bo.ChkjTestAddBo; +import com.ruoyi.demo.bo.ChkjTestEditBo; +import com.ruoyi.common.core.page.IServicePlus; +import com.ruoyi.common.core.page.TableDataInfo; + +import java.util.Collection; +import java.util.List; + +/** + * 娴嬭瘯Service鎺ュ彛 + * + * @author Lion Li + * @date 2021-05-14 + */ +public interface IChkjTestService extends IServicePlus<ChkjTest> { + /** + * 鏌ヨ鍗曚釜 + * @return + */ + ChkjTestVo queryById(Long id); + + /** + * 鏌ヨ鍒楄〃 + */ + TableDataInfo<ChkjTestVo> queryPageList(ChkjTestQueryBo bo); + /** + * 鏌ヨ鍒楄〃 + */ + List<ChkjTestVo> queryList(ChkjTestQueryBo bo); + + /** + * 鏍规嵁鏂板涓氬姟瀵硅薄鎻掑叆娴嬭瘯 + * @param bo 娴嬭瘯鏂板涓氬姟瀵硅薄 + * @return + */ + Boolean insertByAddBo(ChkjTestAddBo bo); + + /** + * 鏍规嵁缂栬緫涓氬姟瀵硅薄淇敼娴嬭瘯 + * @param bo 娴嬭瘯缂栬緫涓氬姟瀵硅薄 + * @return + */ + Boolean updateByEditBo(ChkjTestEditBo bo); + + /** + * 鏍¢獙骞跺垹闄ゆ暟鎹� + * @param ids 涓婚敭闆嗗悎 + * @param isValid 鏄惁鏍¢獙,true-鍒犻櫎鍓嶆牎楠�,false-涓嶆牎楠� + * @return + */ + Boolean deleteWithValidByIds(Collection<Long> ids, Boolean isValid); +} diff --git a/ruoyi-demo/src/main/java/com/ruoyi/demo/service/ITestDemoService.java b/ruoyi-demo/src/main/java/com/ruoyi/demo/service/ITestDemoService.java new file mode 100644 index 0000000..7f08668 --- /dev/null +++ b/ruoyi-demo/src/main/java/com/ruoyi/demo/service/ITestDemoService.java @@ -0,0 +1,57 @@ +package com.ruoyi.demo.service; + +import com.ruoyi.demo.domain.TestDemo; +import com.ruoyi.demo.vo.TestDemoVo; +import com.ruoyi.demo.bo.TestDemoQueryBo; +import com.ruoyi.demo.bo.TestDemoAddBo; +import com.ruoyi.demo.bo.TestDemoEditBo; +import com.ruoyi.common.core.page.IServicePlus; +import com.ruoyi.common.core.page.TableDataInfo; + +import java.util.Collection; +import java.util.List; + +/** + * 娴嬭瘯鍗曡〃Service鎺ュ彛 + * + * @author Lion Li + * @date 2021-05-30 + */ +public interface ITestDemoService extends IServicePlus<TestDemo> { + /** + * 鏌ヨ鍗曚釜 + * @return + */ + TestDemoVo queryById(Long id); + + /** + * 鏌ヨ鍒楄〃 + */ + TableDataInfo<TestDemoVo> queryPageList(TestDemoQueryBo bo); + /** + * 鏌ヨ鍒楄〃 + */ + List<TestDemoVo> queryList(TestDemoQueryBo bo); + + /** + * 鏍规嵁鏂板涓氬姟瀵硅薄鎻掑叆娴嬭瘯鍗曡〃 + * @param bo 娴嬭瘯鍗曡〃鏂板涓氬姟瀵硅薄 + * @return + */ + Boolean insertByAddBo(TestDemoAddBo bo); + + /** + * 鏍规嵁缂栬緫涓氬姟瀵硅薄淇敼娴嬭瘯鍗曡〃 + * @param bo 娴嬭瘯鍗曡〃缂栬緫涓氬姟瀵硅薄 + * @return + */ + Boolean updateByEditBo(TestDemoEditBo bo); + + /** + * 鏍¢獙骞跺垹闄ゆ暟鎹� + * @param ids 涓婚敭闆嗗悎 + * @param isValid 鏄惁鏍¢獙,true-鍒犻櫎鍓嶆牎楠�,false-涓嶆牎楠� + * @return + */ + Boolean deleteWithValidByIds(Collection<Long> ids, Boolean isValid); +} diff --git a/ruoyi-demo/src/main/java/com/ruoyi/demo/service/ITestTreeService.java b/ruoyi-demo/src/main/java/com/ruoyi/demo/service/ITestTreeService.java new file mode 100644 index 0000000..605b3df --- /dev/null +++ b/ruoyi-demo/src/main/java/com/ruoyi/demo/service/ITestTreeService.java @@ -0,0 +1,52 @@ +package com.ruoyi.demo.service; + +import com.ruoyi.common.core.page.IServicePlus; +import com.ruoyi.demo.bo.TestTreeAddBo; +import com.ruoyi.demo.bo.TestTreeEditBo; +import com.ruoyi.demo.bo.TestTreeQueryBo; +import com.ruoyi.demo.domain.TestTree; +import com.ruoyi.demo.vo.TestTreeVo; + +import java.util.Collection; +import java.util.List; + +/** + * 娴嬭瘯鏍戣〃Service鎺ュ彛 + * + * @author Lion Li + * @date 2021-05-30 + */ +public interface ITestTreeService extends IServicePlus<TestTree> { + /** + * 鏌ヨ鍗曚釜 + * @return + */ + TestTreeVo queryById(Long id); + + /** + * 鏌ヨ鍒楄〃 + */ + List<TestTreeVo> queryList(TestTreeQueryBo bo); + + /** + * 鏍规嵁鏂板涓氬姟瀵硅薄鎻掑叆娴嬭瘯鏍戣〃 + * @param bo 娴嬭瘯鏍戣〃鏂板涓氬姟瀵硅薄 + * @return + */ + Boolean insertByAddBo(TestTreeAddBo bo); + + /** + * 鏍规嵁缂栬緫涓氬姟瀵硅薄淇敼娴嬭瘯鏍戣〃 + * @param bo 娴嬭瘯鏍戣〃缂栬緫涓氬姟瀵硅薄 + * @return + */ + Boolean updateByEditBo(TestTreeEditBo bo); + + /** + * 鏍¢獙骞跺垹闄ゆ暟鎹� + * @param ids 涓婚敭闆嗗悎 + * @param isValid 鏄惁鏍¢獙,true-鍒犻櫎鍓嶆牎楠�,false-涓嶆牎楠� + * @return + */ + Boolean deleteWithValidByIds(Collection<Long> ids, Boolean isValid); +} diff --git a/ruoyi-demo/src/main/java/com/ruoyi/demo/service/impl/ChkjTestServiceImpl.java b/ruoyi-demo/src/main/java/com/ruoyi/demo/service/impl/ChkjTestServiceImpl.java new file mode 100644 index 0000000..9808d27 --- /dev/null +++ b/ruoyi-demo/src/main/java/com/ruoyi/demo/service/impl/ChkjTestServiceImpl.java @@ -0,0 +1,93 @@ +package com.ruoyi.demo.service.impl; + +import cn.hutool.core.bean.BeanUtil; +import cn.hutool.core.util.StrUtil; +import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; +import com.baomidou.mybatisplus.core.toolkit.Wrappers; +import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; +import com.ruoyi.common.core.page.PagePlus; +import com.ruoyi.common.core.page.TableDataInfo; +import com.ruoyi.common.utils.PageUtils; +import com.ruoyi.demo.bo.ChkjTestAddBo; +import com.ruoyi.demo.bo.ChkjTestEditBo; +import com.ruoyi.demo.bo.ChkjTestQueryBo; +import com.ruoyi.demo.domain.ChkjTest; +import com.ruoyi.demo.mapper.ChkjTestMapper; +import com.ruoyi.demo.service.IChkjTestService; +import com.ruoyi.demo.vo.ChkjTestVo; +import org.springframework.stereotype.Service; + +import java.util.Collection; +import java.util.List; +import java.util.Map; + +/** + * 娴嬭瘯Service涓氬姟灞傚鐞� + * + * @author Lion Li + * @date 2021-05-14 + */ +@Service +public class ChkjTestServiceImpl extends ServiceImpl<ChkjTestMapper, ChkjTest> implements IChkjTestService { + + @Override + public ChkjTestVo queryById(Long id){ + return getVoById(id, obj -> BeanUtil.toBean(obj, ChkjTestVo.class)); + } + + @Override + public TableDataInfo<ChkjTestVo> queryPageList(ChkjTestQueryBo bo) { + PagePlus<ChkjTest, ChkjTestVo> result = pageVo(PageUtils.buildPagePlus(), buildQueryWrapper(bo), ChkjTestVo.class); + return PageUtils.buildDataInfo(result); + } + + @Override + public List<ChkjTestVo> queryList(ChkjTestQueryBo bo) { + return listVo(buildQueryWrapper(bo), ChkjTestVo.class); + } + + private LambdaQueryWrapper<ChkjTest> buildQueryWrapper(ChkjTestQueryBo bo) { + Map<String, Object> params = bo.getParams(); + LambdaQueryWrapper<ChkjTest> lqw = Wrappers.lambdaQuery(); + lqw.like(StrUtil.isNotBlank(bo.getTestKey()), ChkjTest::getTestKey, bo.getTestKey()); + lqw.eq(StrUtil.isNotBlank(bo.getValue()), ChkjTest::getValue, bo.getValue()); + lqw.eq(bo.getVersion() != null, ChkjTest::getVersion, bo.getVersion()); + lqw.between(params.get("beginCreateTime") != null && params.get("endCreateTime") != null, + ChkjTest::getCreateTime ,params.get("beginCreateTime"), params.get("endCreateTime")); + lqw.eq(bo.getDeleted() != null, ChkjTest::getDeleted, bo.getDeleted()); + lqw.eq(bo.getParentId() != null, ChkjTest::getParentId, bo.getParentId()); + lqw.eq(bo.getOrderNum() != null, ChkjTest::getOrderNum, bo.getOrderNum()); + return lqw; + } + + @Override + public Boolean insertByAddBo(ChkjTestAddBo bo) { + ChkjTest add = BeanUtil.toBean(bo, ChkjTest.class); + validEntityBeforeSave(add); + return save(add); + } + + @Override + public Boolean updateByEditBo(ChkjTestEditBo bo) { + ChkjTest update = BeanUtil.toBean(bo, ChkjTest.class); + validEntityBeforeSave(update); + return updateById(update); + } + + /** + * 淇濆瓨鍓嶇殑鏁版嵁鏍¢獙 + * + * @param entity 瀹炰綋绫绘暟鎹� + */ + private void validEntityBeforeSave(ChkjTest entity){ + //TODO 鍋氫竴浜涙暟鎹牎楠�,濡傚敮涓�绾︽潫 + } + + @Override + public Boolean deleteWithValidByIds(Collection<Long> ids, Boolean isValid) { + if(isValid){ + //TODO 鍋氫竴浜涗笟鍔′笂鐨勬牎楠�,鍒ゆ柇鏄惁闇�瑕佹牎楠� + } + return removeByIds(ids); + } +} diff --git a/ruoyi-demo/src/main/java/com/ruoyi/demo/service/impl/TestDemoServiceImpl.java b/ruoyi-demo/src/main/java/com/ruoyi/demo/service/impl/TestDemoServiceImpl.java new file mode 100644 index 0000000..d974762 --- /dev/null +++ b/ruoyi-demo/src/main/java/com/ruoyi/demo/service/impl/TestDemoServiceImpl.java @@ -0,0 +1,95 @@ +package com.ruoyi.demo.service.impl; + +import cn.hutool.core.bean.BeanUtil; +import cn.hutool.core.util.StrUtil; +import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; +import com.baomidou.mybatisplus.core.toolkit.Wrappers; +import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; +import com.ruoyi.common.annotation.DataScope; +import com.ruoyi.common.core.page.PagePlus; +import com.ruoyi.common.core.page.TableDataInfo; +import com.ruoyi.common.utils.PageUtils; +import com.ruoyi.demo.bo.TestDemoAddBo; +import com.ruoyi.demo.bo.TestDemoEditBo; +import com.ruoyi.demo.bo.TestDemoQueryBo; +import com.ruoyi.demo.domain.TestDemo; +import com.ruoyi.demo.mapper.TestDemoMapper; +import com.ruoyi.demo.service.ITestDemoService; +import com.ruoyi.demo.vo.TestDemoVo; +import org.springframework.stereotype.Service; + +import java.util.Collection; +import java.util.List; +import java.util.Map; + +/** + * 娴嬭瘯鍗曡〃Service涓氬姟灞傚鐞� + * + * @author Lion Li + * @date 2021-05-30 + */ +@Service +public class TestDemoServiceImpl extends ServiceImpl<TestDemoMapper, TestDemo> implements ITestDemoService { + + @Override + public TestDemoVo queryById(Long id) { + return getVoById(id, TestDemoVo.class); + } + + @DataScope(isUser = true) + @Override + public TableDataInfo<TestDemoVo> queryPageList(TestDemoQueryBo bo) { + PagePlus<TestDemo, TestDemoVo> result = pageVo(PageUtils.buildPagePlus(), buildQueryWrapper(bo), TestDemoVo.class); + return PageUtils.buildDataInfo(result); + } + + @DataScope(isUser = true) + @Override + public List<TestDemoVo> queryList(TestDemoQueryBo bo) { + return listVo(buildQueryWrapper(bo), TestDemoVo.class); + } + + private LambdaQueryWrapper<TestDemo> buildQueryWrapper(TestDemoQueryBo bo) { + Map<String, Object> params = bo.getParams(); + Object dataScope = params.get("dataScope"); + LambdaQueryWrapper<TestDemo> lqw = Wrappers.lambdaQuery(); + lqw.like(StrUtil.isNotBlank(bo.getTestKey()), TestDemo::getTestKey, bo.getTestKey()); + lqw.eq(StrUtil.isNotBlank(bo.getValue()), TestDemo::getValue, bo.getValue()); + lqw.between(params.get("beginCreateTime") != null && params.get("endCreateTime") != null, + TestDemo::getCreateTime, params.get("beginCreateTime"), params.get("endCreateTime")); + lqw.apply(dataScope != null && StrUtil.isNotBlank(dataScope.toString()), + dataScope != null ? dataScope.toString() : null); + return lqw; + } + + @Override + public Boolean insertByAddBo(TestDemoAddBo bo) { + TestDemo add = BeanUtil.toBean(bo, TestDemo.class); + validEntityBeforeSave(add); + return save(add); + } + + @Override + public Boolean updateByEditBo(TestDemoEditBo bo) { + TestDemo update = BeanUtil.toBean(bo, TestDemo.class); + validEntityBeforeSave(update); + return updateById(update); + } + + /** + * 淇濆瓨鍓嶇殑鏁版嵁鏍¢獙 + * + * @param entity 瀹炰綋绫绘暟鎹� + */ + private void validEntityBeforeSave(TestDemo entity) { + //TODO 鍋氫竴浜涙暟鎹牎楠�,濡傚敮涓�绾︽潫 + } + + @Override + public Boolean deleteWithValidByIds(Collection<Long> ids, Boolean isValid) { + if (isValid) { + //TODO 鍋氫竴浜涗笟鍔′笂鐨勬牎楠�,鍒ゆ柇鏄惁闇�瑕佹牎楠� + } + return removeByIds(ids); + } +} diff --git a/ruoyi-demo/src/main/java/com/ruoyi/demo/service/impl/TestTreeServiceImpl.java b/ruoyi-demo/src/main/java/com/ruoyi/demo/service/impl/TestTreeServiceImpl.java new file mode 100644 index 0000000..ae93ef3 --- /dev/null +++ b/ruoyi-demo/src/main/java/com/ruoyi/demo/service/impl/TestTreeServiceImpl.java @@ -0,0 +1,84 @@ +package com.ruoyi.demo.service.impl; + +import cn.hutool.core.bean.BeanUtil; +import cn.hutool.core.util.StrUtil; +import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; +import com.baomidou.mybatisplus.core.toolkit.Wrappers; +import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; +import com.ruoyi.common.annotation.DataScope; +import com.ruoyi.demo.bo.TestTreeAddBo; +import com.ruoyi.demo.bo.TestTreeEditBo; +import com.ruoyi.demo.bo.TestTreeQueryBo; +import com.ruoyi.demo.domain.TestTree; +import com.ruoyi.demo.mapper.TestTreeMapper; +import com.ruoyi.demo.service.ITestTreeService; +import com.ruoyi.demo.vo.TestTreeVo; +import org.springframework.stereotype.Service; + +import java.util.Collection; +import java.util.List; +import java.util.Map; + +/** + * 娴嬭瘯鏍戣〃Service涓氬姟灞傚鐞� + * + * @author Lion Li + * @date 2021-05-30 + */ +@Service +public class TestTreeServiceImpl extends ServiceImpl<TestTreeMapper, TestTree> implements ITestTreeService { + + @Override + public TestTreeVo queryById(Long id) { + return getVoById(id, TestTreeVo.class); + } + + @DataScope(isUser = true) + @Override + public List<TestTreeVo> queryList(TestTreeQueryBo bo) { + return listVo(buildQueryWrapper(bo), TestTreeVo.class); + } + + private LambdaQueryWrapper<TestTree> buildQueryWrapper(TestTreeQueryBo bo) { + Map<String, Object> params = bo.getParams(); + Object dataScope = params.get("dataScope"); + LambdaQueryWrapper<TestTree> lqw = Wrappers.lambdaQuery(); + lqw.like(StrUtil.isNotBlank(bo.getTreeName()), TestTree::getTreeName, bo.getTreeName()); + lqw.between(params.get("beginCreateTime") != null && params.get("endCreateTime") != null, + TestTree::getCreateTime, params.get("beginCreateTime"), params.get("endCreateTime")); + lqw.apply(dataScope != null && StrUtil.isNotBlank(dataScope.toString()), + dataScope != null ? dataScope.toString() : null); + return lqw; + } + + @Override + public Boolean insertByAddBo(TestTreeAddBo bo) { + TestTree add = BeanUtil.toBean(bo, TestTree.class); + validEntityBeforeSave(add); + return save(add); + } + + @Override + public Boolean updateByEditBo(TestTreeEditBo bo) { + TestTree update = BeanUtil.toBean(bo, TestTree.class); + validEntityBeforeSave(update); + return updateById(update); + } + + /** + * 淇濆瓨鍓嶇殑鏁版嵁鏍¢獙 + * + * @param entity 瀹炰綋绫绘暟鎹� + */ + private void validEntityBeforeSave(TestTree entity) { + //TODO 鍋氫竴浜涙暟鎹牎楠�,濡傚敮涓�绾︽潫 + } + + @Override + public Boolean deleteWithValidByIds(Collection<Long> ids, Boolean isValid) { + if (isValid) { + //TODO 鍋氫竴浜涗笟鍔′笂鐨勬牎楠�,鍒ゆ柇鏄惁闇�瑕佹牎楠� + } + return removeByIds(ids); + } +} diff --git a/ruoyi-demo/src/main/java/com/ruoyi/demo/vo/ChkjTestVo.java b/ruoyi-demo/src/main/java/com/ruoyi/demo/vo/ChkjTestVo.java new file mode 100644 index 0000000..e283a81 --- /dev/null +++ b/ruoyi-demo/src/main/java/com/ruoyi/demo/vo/ChkjTestVo.java @@ -0,0 +1,57 @@ +package com.ruoyi.demo.vo; + +import com.ruoyi.common.annotation.Excel; +import com.fasterxml.jackson.annotation.JsonFormat; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; +import java.util.Date; + + + +/** + * 娴嬭瘯瑙嗗浘瀵硅薄 mall_package + * + * @author Lion Li + * @date 2021-05-14 + */ +@Data +@ApiModel("娴嬭瘯瑙嗗浘瀵硅薄") +public class ChkjTestVo { + private static final long serialVersionUID = 1L; + + /** 涓婚敭 */ + @ApiModelProperty("涓婚敭") + private Long id; + + /** key閿� */ + @Excel(name = "key閿�") + @ApiModelProperty("key閿�") + private String testKey; + /** 鍊� */ + @Excel(name = "鍊�") + @ApiModelProperty("鍊�") + private String value; + /** 鐗堟湰 */ + @Excel(name = "鐗堟湰") + @ApiModelProperty("鐗堟湰") + private Long version; + /** 鍒涘缓鏃堕棿 */ + @Excel(name = "鍒涘缓鏃堕棿" , width = 30, dateFormat = "yyyy-MM-dd") + @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") + @ApiModelProperty("鍒涘缓鏃堕棿") + private Date createTime; + /** 鍒犻櫎鏍囧織 */ + @Excel(name = "鍒犻櫎鏍囧織") + @ApiModelProperty("鍒犻櫎鏍囧織") + private Long deleted; + /** 鐖秈d */ + @Excel(name = "鐖秈d") + @ApiModelProperty("鐖秈d") + private Long parentId; + /** 鎺掑簭鍙� */ + @Excel(name = "鎺掑簭鍙�") + @ApiModelProperty("鎺掑簭鍙�") + private Long orderNum; + +} diff --git a/ruoyi-demo/src/main/java/com/ruoyi/demo/vo/TestDemoVo.java b/ruoyi-demo/src/main/java/com/ruoyi/demo/vo/TestDemoVo.java new file mode 100644 index 0000000..c51ed43 --- /dev/null +++ b/ruoyi-demo/src/main/java/com/ruoyi/demo/vo/TestDemoVo.java @@ -0,0 +1,76 @@ +package com.ruoyi.demo.vo; + +import com.ruoyi.common.annotation.Excel; +import com.fasterxml.jackson.annotation.JsonFormat; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; +import java.util.Date; + + + +/** + * 娴嬭瘯鍗曡〃瑙嗗浘瀵硅薄 test_demo + * + * @author Lion Li + * @date 2021-05-30 + */ +@Data +@ApiModel("娴嬭瘯鍗曡〃瑙嗗浘瀵硅薄") +public class TestDemoVo { + + private static final long serialVersionUID = 1L; + + /** 涓婚敭 */ + @ApiModelProperty("涓婚敭") + private Long id; + + /** 閮ㄩ棬id */ + @Excel(name = "閮ㄩ棬id") + @ApiModelProperty("閮ㄩ棬id") + private Long deptId; + + /** 鐢ㄦ埛id */ + @Excel(name = "鐢ㄦ埛id") + @ApiModelProperty("鐢ㄦ埛id") + private Long userId; + + /** 鎺掑簭鍙� */ + @Excel(name = "鎺掑簭鍙�") + @ApiModelProperty("鎺掑簭鍙�") + private Long orderNum; + + /** key閿� */ + @Excel(name = "key閿�") + @ApiModelProperty("key閿�") + private String testKey; + + /** 鍊� */ + @Excel(name = "鍊�") + @ApiModelProperty("鍊�") + private String value; + + /** 鍒涘缓鏃堕棿 */ + @Excel(name = "鍒涘缓鏃堕棿" , width = 30, dateFormat = "yyyy-MM-dd") + @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") + @ApiModelProperty("鍒涘缓鏃堕棿") + private Date createTime; + + /** 鍒涘缓浜� */ + @Excel(name = "鍒涘缓浜�") + @ApiModelProperty("鍒涘缓浜�") + private String createBy; + + /** 鏇存柊鏃堕棿 */ + @Excel(name = "鏇存柊鏃堕棿" , width = 30, dateFormat = "yyyy-MM-dd") + @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") + @ApiModelProperty("鏇存柊鏃堕棿") + private Date updateTime; + + /** 鏇存柊浜� */ + @Excel(name = "鏇存柊浜�") + @ApiModelProperty("鏇存柊浜�") + private String updateBy; + + +} diff --git a/ruoyi-demo/src/main/java/com/ruoyi/demo/vo/TestTreeVo.java b/ruoyi-demo/src/main/java/com/ruoyi/demo/vo/TestTreeVo.java new file mode 100644 index 0000000..44413b1 --- /dev/null +++ b/ruoyi-demo/src/main/java/com/ruoyi/demo/vo/TestTreeVo.java @@ -0,0 +1,55 @@ +package com.ruoyi.demo.vo; + +import com.ruoyi.common.annotation.Excel; +import com.fasterxml.jackson.annotation.JsonFormat; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; +import java.util.Date; + + + +/** + * 娴嬭瘯鏍戣〃瑙嗗浘瀵硅薄 test_tree + * + * @author Lion Li + * @date 2021-05-30 + */ +@Data +@ApiModel("娴嬭瘯鏍戣〃瑙嗗浘瀵硅薄") +public class TestTreeVo { + + private static final long serialVersionUID = 1L; + + /** 涓婚敭 */ + @ApiModelProperty("涓婚敭") + private Long id; + + /** 鐖秈d */ + @Excel(name = "鐖秈d") + @ApiModelProperty("鐖秈d") + private Long parentId; + + /** 閮ㄩ棬id */ + @Excel(name = "閮ㄩ棬id") + @ApiModelProperty("閮ㄩ棬id") + private Long deptId; + + /** 鐢ㄦ埛id */ + @Excel(name = "鐢ㄦ埛id") + @ApiModelProperty("鐢ㄦ埛id") + private Long userId; + + /** 鏍戣妭鐐瑰悕 */ + @Excel(name = "鏍戣妭鐐瑰悕") + @ApiModelProperty("鏍戣妭鐐瑰悕") + private String treeName; + + /** 鍒涘缓鏃堕棿 */ + @Excel(name = "鍒涘缓鏃堕棿" , width = 30, dateFormat = "yyyy-MM-dd") + @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") + @ApiModelProperty("鍒涘缓鏃堕棿") + private Date createTime; + + +} diff --git a/ruoyi-demo/src/main/resources/mapper/demo/ChkjTestMapper.xml b/ruoyi-demo/src/main/resources/mapper/demo/ChkjTestMapper.xml new file mode 100644 index 0000000..2b59b3f --- /dev/null +++ b/ruoyi-demo/src/main/resources/mapper/demo/ChkjTestMapper.xml @@ -0,0 +1,19 @@ +<?xml version="1.0" encoding="UTF-8" ?> +<!DOCTYPE mapper +PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" +"http://mybatis.org/dtd/mybatis-3-mapper.dtd"> +<mapper namespace="com.ruoyi.demo.mapper.ChkjTestMapper"> + + <resultMap type="com.ruoyi.demo.domain.ChkjTest" id="ChkjTestResult"> + <result property="id" column="id"/> + <result property="testKey" column="test_key"/> + <result property="value" column="value"/> + <result property="version" column="version"/> + <result property="createTime" column="create_time"/> + <result property="deleted" column="deleted"/> + <result property="parentId" column="parent_id"/> + <result property="orderNum" column="order_num"/> + </resultMap> + + +</mapper> \ No newline at end of file diff --git a/ruoyi-demo/src/main/resources/mapper/demo/TestDemoMapper.xml b/ruoyi-demo/src/main/resources/mapper/demo/TestDemoMapper.xml new file mode 100644 index 0000000..ec433d6 --- /dev/null +++ b/ruoyi-demo/src/main/resources/mapper/demo/TestDemoMapper.xml @@ -0,0 +1,23 @@ +<?xml version="1.0" encoding="UTF-8" ?> +<!DOCTYPE mapper +PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" +"http://mybatis.org/dtd/mybatis-3-mapper.dtd"> +<mapper namespace="com.ruoyi.demo.mapper.TestDemoMapper"> + + <resultMap type="com.ruoyi.demo.domain.TestDemo" id="TestDemoResult"> + <result property="id" column="id"/> + <result property="deptId" column="dept_id"/> + <result property="userId" column="user_id"/> + <result property="orderNum" column="order_num"/> + <result property="testKey" column="test_key"/> + <result property="value" column="value"/> + <result property="version" column="version"/> + <result property="createTime" column="create_time"/> + <result property="createBy" column="create_by"/> + <result property="updateTime" column="update_time"/> + <result property="updateBy" column="update_by"/> + <result property="delFlag" column="del_flag"/> + </resultMap> + + +</mapper> \ No newline at end of file diff --git a/ruoyi-demo/src/main/resources/mapper/demo/TestTreeMapper.xml b/ruoyi-demo/src/main/resources/mapper/demo/TestTreeMapper.xml new file mode 100644 index 0000000..0943d5b --- /dev/null +++ b/ruoyi-demo/src/main/resources/mapper/demo/TestTreeMapper.xml @@ -0,0 +1,22 @@ +<?xml version="1.0" encoding="UTF-8" ?> +<!DOCTYPE mapper +PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" +"http://mybatis.org/dtd/mybatis-3-mapper.dtd"> +<mapper namespace="com.ruoyi.demo.mapper.TestTreeMapper"> + + <resultMap type="com.ruoyi.demo.domain.TestTree" id="TestTreeResult"> + <result property="id" column="id"/> + <result property="parentId" column="parent_id"/> + <result property="deptId" column="dept_id"/> + <result property="userId" column="user_id"/> + <result property="treeName" column="tree_name"/> + <result property="version" column="version"/> + <result property="createTime" column="create_time"/> + <result property="createBy" column="create_by"/> + <result property="updateTime" column="update_time"/> + <result property="updateBy" column="update_by"/> + <result property="delFlag" column="del_flag"/> + </resultMap> + + +</mapper> \ No newline at end of file diff --git a/ruoyi-framework/src/main/java/com/ruoyi/framework/aspectj/DataScopeAspect.java b/ruoyi-framework/src/main/java/com/ruoyi/framework/aspectj/DataScopeAspect.java index 6eec956..e8ef101 100644 --- a/ruoyi-framework/src/main/java/com/ruoyi/framework/aspectj/DataScopeAspect.java +++ b/ruoyi-framework/src/main/java/com/ruoyi/framework/aspectj/DataScopeAspect.java @@ -24,167 +24,147 @@ /** * 鏁版嵁杩囨护澶勭悊 * - * @author ruoyi + * @author Lion Li */ @Aspect @Component -public class DataScopeAspect -{ - /** - * 鍏ㄩ儴鏁版嵁鏉冮檺 - */ - public static final String DATA_SCOPE_ALL = "1"; +public class DataScopeAspect { - /** - * 鑷畾鏁版嵁鏉冮檺 - */ - public static final String DATA_SCOPE_CUSTOM = "2"; + /** + * 鍏ㄩ儴鏁版嵁鏉冮檺 + */ + public static final String DATA_SCOPE_ALL = "1"; - /** - * 閮ㄩ棬鏁版嵁鏉冮檺 - */ - public static final String DATA_SCOPE_DEPT = "3"; + /** + * 鑷畾鏁版嵁鏉冮檺 + */ + public static final String DATA_SCOPE_CUSTOM = "2"; - /** - * 閮ㄩ棬鍙婁互涓嬫暟鎹潈闄� - */ - public static final String DATA_SCOPE_DEPT_AND_CHILD = "4"; + /** + * 閮ㄩ棬鏁版嵁鏉冮檺 + */ + public static final String DATA_SCOPE_DEPT = "3"; - /** - * 浠呮湰浜烘暟鎹潈闄� - */ - public static final String DATA_SCOPE_SELF = "5"; + /** + * 閮ㄩ棬鍙婁互涓嬫暟鎹潈闄� + */ + public static final String DATA_SCOPE_DEPT_AND_CHILD = "4"; - /** - * 鏁版嵁鏉冮檺杩囨护鍏抽敭瀛� - */ - public static final String DATA_SCOPE = "dataScope"; + /** + * 浠呮湰浜烘暟鎹潈闄� + */ + public static final String DATA_SCOPE_SELF = "5"; - // 閰嶇疆缁囧叆鐐� - @Pointcut("@annotation(com.ruoyi.common.annotation.DataScope)") - public void dataScopePointCut() - { - } + /** + * 鏁版嵁鏉冮檺杩囨护鍏抽敭瀛� + */ + public static final String DATA_SCOPE = "dataScope"; - @Before("dataScopePointCut()") - public void doBefore(JoinPoint point) throws Throwable - { + // 閰嶇疆缁囧叆鐐� + @Pointcut("@annotation(com.ruoyi.common.annotation.DataScope)") + public void dataScopePointCut() { + } + + @Before("dataScopePointCut()") + public void doBefore(JoinPoint point) throws Throwable { clearDataScope(point); - handleDataScope(point); - } + handleDataScope(point); + } - protected void handleDataScope(final JoinPoint joinPoint) - { - // 鑾峰緱娉ㄨВ - DataScope controllerDataScope = getAnnotationLog(joinPoint); - if (controllerDataScope == null) - { - return; - } - // 鑾峰彇褰撳墠鐨勭敤鎴� - LoginUser loginUser = SpringUtils.getBean(TokenService.class).getLoginUser(ServletUtils.getRequest()); - if (Validator.isNotNull(loginUser)) - { - SysUser currentUser = loginUser.getUser(); - // 濡傛灉鏄秴绾х鐞嗗憳锛屽垯涓嶈繃婊ゆ暟鎹� - if (Validator.isNotNull(currentUser) && !currentUser.isAdmin()) - { - dataScopeFilter(joinPoint, currentUser, controllerDataScope.deptAlias(), - controllerDataScope.userAlias()); - } - } - } - - /** - * 鏁版嵁鑼冨洿杩囨护 - * - * @param joinPoint 鍒囩偣 - * @param user 鐢ㄦ埛 - * @param userAlias 鍒悕 - */ - public static void dataScopeFilter(JoinPoint joinPoint, SysUser user, String deptAlias, String userAlias) - { - StringBuilder sqlString = new StringBuilder(); - - for (SysRole role : user.getRoles()) - { - String dataScope = role.getDataScope(); - if (DATA_SCOPE_ALL.equals(dataScope)) - { - sqlString = new StringBuilder(); - break; - } - else if (DATA_SCOPE_CUSTOM.equals(dataScope)) - { - sqlString.append(StrUtil.format( - " OR {}.dept_id IN ( SELECT dept_id FROM sys_role_dept WHERE role_id = {} ) ", deptAlias, - role.getRoleId())); - } - else if (DATA_SCOPE_DEPT.equals(dataScope)) - { - sqlString.append(StrUtil.format(" OR {}.dept_id = {} ", deptAlias, user.getDeptId())); - } - else if (DATA_SCOPE_DEPT_AND_CHILD.equals(dataScope)) - { - sqlString.append(StrUtil.format( - " OR {}.dept_id IN ( SELECT dept_id FROM sys_dept WHERE dept_id = {} or find_in_set( {} , ancestors ) )", - deptAlias, user.getDeptId(), user.getDeptId())); - } - else if (DATA_SCOPE_SELF.equals(dataScope)) - { - if (StrUtil.isNotBlank(userAlias)) - { - sqlString.append(StrUtil.format(" OR {}.user_id = {} ", userAlias, user.getUserId())); - } - else - { - // 鏁版嵁鏉冮檺涓轰粎鏈汉涓旀病鏈塽serAlias鍒悕涓嶆煡璇换浣曟暟鎹� - sqlString.append(" OR 1=0 "); - } - } - } - - if (StrUtil.isNotBlank(sqlString.toString())) - { - putDataScope(joinPoint, "AND (" + sqlString.substring(4) + ")"); + protected void handleDataScope(final JoinPoint joinPoint) { + // 鑾峰緱娉ㄨВ + DataScope controllerDataScope = getAnnotationLog(joinPoint); + if (controllerDataScope == null) { + return; } - } + // 鑾峰彇褰撳墠鐨勭敤鎴� + LoginUser loginUser = SpringUtils.getBean(TokenService.class).getLoginUser(ServletUtils.getRequest()); + if (Validator.isNotNull(loginUser)) { + SysUser currentUser = loginUser.getUser(); + // 濡傛灉鏄秴绾х鐞嗗憳锛屽垯涓嶈繃婊ゆ暟鎹� + if (Validator.isNotNull(currentUser) && !currentUser.isAdmin()) { + dataScopeFilter(joinPoint, currentUser, controllerDataScope.deptAlias(), + controllerDataScope.userAlias(), controllerDataScope.isUser()); + } + } + } - /** - * 鏄惁瀛樺湪娉ㄨВ锛屽鏋滃瓨鍦ㄥ氨鑾峰彇 - */ - private DataScope getAnnotationLog(JoinPoint joinPoint) - { - Signature signature = joinPoint.getSignature(); - MethodSignature methodSignature = (MethodSignature) signature; - Method method = methodSignature.getMethod(); + /** + * 鏁版嵁鑼冨洿杩囨护 + * + * @param joinPoint 鍒囩偣 + * @param user 鐢ㄦ埛 + * @param userAlias 鍒悕 + */ + public static void dataScopeFilter(JoinPoint joinPoint, SysUser user, String deptAlias, String userAlias, boolean isUser) { + StringBuilder sqlString = new StringBuilder(); - if (method != null) - { - return method.getAnnotation(DataScope.class); - } - return null; - } + // 灏� "." 鎻愬彇鍑�,涓嶅啓鍒悕涓哄崟琛ㄦ煡璇�,鍐欏埆鍚嶄负澶氳〃鏌ヨ + deptAlias = StrUtil.isNotBlank(deptAlias) ? deptAlias + "." : ""; + userAlias = StrUtil.isNotBlank(userAlias) ? userAlias + "." : ""; + + for (SysRole role : user.getRoles()) { + String dataScope = role.getDataScope(); + if (DATA_SCOPE_ALL.equals(dataScope)) { + sqlString = new StringBuilder(); + break; + } else if (DATA_SCOPE_CUSTOM.equals(dataScope)) { + sqlString.append(StrUtil.format( + " OR {}dept_id IN ( SELECT dept_id FROM sys_role_dept WHERE role_id = {} ) ", + deptAlias, role.getRoleId())); + } else if (DATA_SCOPE_DEPT.equals(dataScope)) { + sqlString.append(StrUtil.format(" OR {}dept_id = {} ", + deptAlias, user.getDeptId())); + } else if (DATA_SCOPE_DEPT_AND_CHILD.equals(dataScope)) { + sqlString.append(StrUtil.format( + " OR {}dept_id IN ( SELECT dept_id FROM sys_dept WHERE dept_id = {} or find_in_set( {} , ancestors ) )", + deptAlias, user.getDeptId(), user.getDeptId())); + } else if (DATA_SCOPE_SELF.equals(dataScope)) { + if (isUser) { + sqlString.append(StrUtil.format(" OR {}user_id = {} ", + userAlias, user.getUserId())); + } else { + // 鏁版嵁鏉冮檺涓轰粎鏈汉涓旀病鏈塽serAlias鍒悕涓嶆煡璇换浣曟暟鎹� + sqlString.append(" OR 1=0 "); + } + } + } + + if (StrUtil.isNotBlank(sqlString.toString())) { + putDataScope(joinPoint, sqlString.substring(4)); + } + } + + /** + * 鏄惁瀛樺湪娉ㄨВ锛屽鏋滃瓨鍦ㄥ氨鑾峰彇 + */ + private DataScope getAnnotationLog(JoinPoint joinPoint) { + Signature signature = joinPoint.getSignature(); + MethodSignature methodSignature = (MethodSignature) signature; + Method method = methodSignature.getMethod(); + + if (method != null) { + return method.getAnnotation(DataScope.class); + } + return null; + } /** * 鎷兼帴鏉冮檺sql鍓嶅厛娓呯┖params.dataScope鍙傛暟闃叉娉ㄥ叆 */ - private void clearDataScope(final JoinPoint joinPoint) - { + private void clearDataScope(final JoinPoint joinPoint) { Object params = joinPoint.getArgs()[0]; - if (Validator.isNotNull(params)) - { + if (Validator.isNotNull(params)) { putDataScope(joinPoint, ""); } } private static void putDataScope(JoinPoint joinPoint, String sql) { Object params = joinPoint.getArgs()[0]; - if (Validator.isNotNull(params)) - { - if(params instanceof BaseEntity) { + if (Validator.isNotNull(params)) { + if (params instanceof BaseEntity) { BaseEntity baseEntity = (BaseEntity) params; - baseEntity.getParams().put(DATA_SCOPE, ""); + baseEntity.getParams().put(DATA_SCOPE, sql); } else { try { Method getParams = params.getClass().getDeclaredMethod("getParams", null); diff --git a/ruoyi-framework/src/main/java/com/ruoyi/framework/config/AsyncConfig.java b/ruoyi-framework/src/main/java/com/ruoyi/framework/config/AsyncConfig.java new file mode 100644 index 0000000..5682602 --- /dev/null +++ b/ruoyi-framework/src/main/java/com/ruoyi/framework/config/AsyncConfig.java @@ -0,0 +1,41 @@ +package com.ruoyi.framework.config; + +import com.ruoyi.common.exception.CustomException; +import org.springframework.aop.interceptor.AsyncUncaughtExceptionHandler; +import org.springframework.context.annotation.Configuration; +import org.springframework.scheduling.annotation.AsyncConfigurerSupport; +import org.springframework.scheduling.annotation.EnableAsync; +import org.springframework.security.concurrent.DelegatingSecurityContextExecutorService; + +import java.util.Arrays; +import java.util.concurrent.Executor; +import java.util.concurrent.Executors; + +@EnableAsync +@Configuration +public class AsyncConfig extends AsyncConfigurerSupport { + + /** + * 寮傛鎵ц闇�瑕佷娇鐢ㄦ潈闄愭鏋惰嚜甯︾殑鍖呰绾跨▼姹� 淇濊瘉鏉冮檺淇℃伅鐨勪紶閫� + */ + @Override + public Executor getAsyncExecutor() { + return new DelegatingSecurityContextExecutorService( + Executors.newFixedThreadPool(Runtime.getRuntime().availableProcessors())); + } + + /** + * 寮傛鎵ц寮傚父澶勭悊 + */ + @Override + public AsyncUncaughtExceptionHandler getAsyncUncaughtExceptionHandler() { + return (throwable, method, objects) -> { + throwable.printStackTrace(); + throw new CustomException( + "Exception message - " + throwable.getMessage() + + ", Method name - " + method.getName() + + ", Parameter value - " + Arrays.toString(objects)); + }; + } + +} diff --git a/ruoyi-framework/src/main/java/com/ruoyi/framework/config/RedisConfig.java b/ruoyi-framework/src/main/java/com/ruoyi/framework/config/RedisConfig.java index af471f4..b868729 100644 --- a/ruoyi-framework/src/main/java/com/ruoyi/framework/config/RedisConfig.java +++ b/ruoyi-framework/src/main/java/com/ruoyi/framework/config/RedisConfig.java @@ -1,42 +1,69 @@ package com.ruoyi.framework.config; -import com.alibaba.fastjson.support.spring.GenericFastJsonRedisSerializer; +import com.ruoyi.framework.config.properties.RedissonProperties; +import org.redisson.Redisson; +import org.redisson.api.RedissonClient; +import org.redisson.codec.JsonJacksonCodec; +import org.redisson.config.Config; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean; +import org.springframework.boot.autoconfigure.data.redis.RedisProperties; import org.springframework.cache.annotation.CachingConfigurerSupport; import org.springframework.cache.annotation.EnableCaching; import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Configuration; -import org.springframework.data.redis.connection.RedisConnectionFactory; -import org.springframework.data.redis.core.RedisTemplate; -import org.springframework.data.redis.serializer.StringRedisSerializer; + +import java.io.IOException; /** * redis閰嶇疆 * - * @author ruoyi + * @author Lion Li */ @Configuration @EnableCaching -public class RedisConfig extends CachingConfigurerSupport -{ - @Bean - @SuppressWarnings(value = { "unchecked", "rawtypes" }) - public RedisTemplate<Object, Object> redisTemplate(RedisConnectionFactory connectionFactory) - { - RedisTemplate<Object, Object> template = new RedisTemplate<>(); - template.setConnectionFactory(connectionFactory); +public class RedisConfig extends CachingConfigurerSupport { - GenericFastJsonRedisSerializer serializer = new GenericFastJsonRedisSerializer(); - StringRedisSerializer keySerializer = new StringRedisSerializer(); + private static final String REDIS_PROTOCOL_PREFIX = "redis://"; + private static final String REDISS_PROTOCOL_PREFIX = "rediss://"; - // 浣跨敤StringRedisSerializer鏉ュ簭鍒楀寲鍜屽弽搴忓垪鍖杛edis鐨刱ey鍊� - template.setKeySerializer(keySerializer); - template.setValueSerializer(serializer); + @Autowired + private RedisProperties redisProperties; - // Hash鐨刱ey涔熼噰鐢⊿tringRedisSerializer鐨勫簭鍒楀寲鏂瑰紡 - template.setHashKeySerializer(keySerializer); - template.setHashValueSerializer(serializer); + @Autowired + private RedissonProperties redissonProperties; - template.afterPropertiesSet(); - return template; - } + @Bean(destroyMethod = "shutdown") + @ConditionalOnMissingBean(RedissonClient.class) + public RedissonClient redisson() throws IOException { + String prefix = REDIS_PROTOCOL_PREFIX; + if (redisProperties.isSsl()) { + prefix = REDISS_PROTOCOL_PREFIX; + } + Config config = new Config(); + config.setThreads(redissonProperties.getThreads()) + .setNettyThreads(redissonProperties.getNettyThreads()) + .setCodec(JsonJacksonCodec.INSTANCE) + .setTransportMode(redissonProperties.getTransportMode()); + + RedissonProperties.SingleServerConfig singleServerConfig = redissonProperties.getSingleServerConfig(); + // 浣跨敤鍗曟満妯″紡 + config.useSingleServer() + .setAddress(prefix + redisProperties.getHost() + ":" + redisProperties.getPort()) + .setConnectTimeout(((Long) redisProperties.getTimeout().toMillis()).intValue()) + .setDatabase(redisProperties.getDatabase()) + .setPassword(redisProperties.getPassword()) + .setTimeout(singleServerConfig.getTimeout()) + .setRetryAttempts(singleServerConfig.getRetryAttempts()) + .setRetryInterval(singleServerConfig.getRetryInterval()) + .setSubscriptionsPerConnection(singleServerConfig.getSubscriptionsPerConnection()) + .setClientName(singleServerConfig.getClientName()) + .setIdleConnectionTimeout(singleServerConfig.getIdleConnectionTimeout()) + .setSubscriptionConnectionMinimumIdleSize(singleServerConfig.getSubscriptionConnectionMinimumIdleSize()) + .setSubscriptionConnectionPoolSize(singleServerConfig.getSubscriptionConnectionPoolSize()) + .setConnectionMinimumIdleSize(singleServerConfig.getConnectionMinimumIdleSize()) + .setConnectionPoolSize(singleServerConfig.getConnectionPoolSize()) + .setDnsMonitoringInterval(singleServerConfig.getDnsMonitoringInterval()); + return Redisson.create(config); + } } diff --git a/ruoyi-framework/src/main/java/com/ruoyi/framework/config/properties/RedissonProperties.java b/ruoyi-framework/src/main/java/com/ruoyi/framework/config/properties/RedissonProperties.java new file mode 100644 index 0000000..99db89e --- /dev/null +++ b/ruoyi-framework/src/main/java/com/ruoyi/framework/config/properties/RedissonProperties.java @@ -0,0 +1,101 @@ +package com.ruoyi.framework.config.properties; + +import lombok.Data; +import lombok.NoArgsConstructor; +import org.redisson.client.codec.Codec; +import org.redisson.config.TransportMode; +import org.springframework.boot.context.properties.ConfigurationProperties; +import org.springframework.stereotype.Component; + +/** + * Redisson 閰嶇疆灞炴�� + * + * @author Lion Li + */ +@Data +@Component +@ConfigurationProperties(prefix = "redisson") +public class RedissonProperties { + + /** + * 绾跨▼姹犳暟閲�,榛樿鍊� = 褰撳墠澶勭悊鏍告暟閲� * 2 + */ + private int threads; + + /** + * Netty绾跨▼姹犳暟閲�,榛樿鍊� = 褰撳墠澶勭悊鏍告暟閲� * 2 + */ + private int nettyThreads; + + /** + * 浼犺緭妯″紡 + */ + private TransportMode transportMode; + + /** + * 鍗曟満鏈嶅姟閰嶇疆 + */ + private SingleServerConfig singleServerConfig; + + @Data + @NoArgsConstructor + public static class SingleServerConfig { + + /** + * 瀹㈡埛绔悕绉� + */ + private String clientName; + + /** + * 鏈�灏忕┖闂茶繛鎺ユ暟 + */ + private int connectionMinimumIdleSize; + + /** + * 杩炴帴姹犲ぇ灏� + */ + private int connectionPoolSize; + + /** + * 杩炴帴绌洪棽瓒呮椂锛屽崟浣嶏細姣 + */ + private int idleConnectionTimeout; + + /** + * 鍛戒护绛夊緟瓒呮椂锛屽崟浣嶏細姣 + */ + private int timeout; + + /** + * 濡傛灉灏濊瘯鍦ㄦ闄愬埗涔嬪唴鍙戦�佹垚鍔燂紝鍒欏紑濮嬪惎鐢� timeout 璁℃椂銆� + */ + private int retryAttempts; + + /** + * 鍛戒护閲嶈瘯鍙戦�佹椂闂撮棿闅旓紝鍗曚綅锛氭绉� + */ + private int retryInterval; + + /** + * 鍙戝竷鍜岃闃呰繛鎺ョ殑鏈�灏忕┖闂茶繛鎺ユ暟 + */ + private int subscriptionConnectionMinimumIdleSize; + + /** + * 鍙戝竷鍜岃闃呰繛鎺ユ睜澶у皬 + */ + private int subscriptionConnectionPoolSize; + + /** + * 鍗曚釜杩炴帴鏈�澶ц闃呮暟閲� + */ + private int subscriptionsPerConnection; + + /** + * DNS鐩戞祴鏃堕棿闂撮殧锛屽崟浣嶏細姣 + */ + private int dnsMonitoringInterval; + + } + +} diff --git a/ruoyi-generator/src/main/resources/vm/java/addBo.java.vm b/ruoyi-generator/src/main/resources/vm/java/addBo.java.vm index 98a1497..e010d20 100644 --- a/ruoyi-generator/src/main/resources/vm/java/addBo.java.vm +++ b/ruoyi-generator/src/main/resources/vm/java/addBo.java.vm @@ -24,6 +24,7 @@ #foreach ($column in $columns) #if($column.isInsert && $column.isPk!=1) + /** $column.columnComment */ @ApiModelProperty("$column.columnComment") #if($column.javaType == 'Date') diff --git a/ruoyi-generator/src/main/resources/vm/java/domain.java.vm b/ruoyi-generator/src/main/resources/vm/java/domain.java.vm index b06144c..b6eca82 100644 --- a/ruoyi-generator/src/main/resources/vm/java/domain.java.vm +++ b/ruoyi-generator/src/main/resources/vm/java/domain.java.vm @@ -11,7 +11,7 @@ /** * ${functionName}瀵硅薄 ${tableName} - * + * * @author ${author} * @date ${datetime} */ @@ -21,7 +21,7 @@ @TableName("${tableName}") public class ${ClassName} implements Serializable { -private static final long serialVersionUID=1L; + private static final long serialVersionUID=1L; #foreach ($column in $columns) @@ -35,6 +35,9 @@ #if($column.javaField=='delFlag') @TableLogic #end +#if($column.javaField=='version') + @Version +#end #if($column.isPk==1) @TableId(value = "$column.columnName") #end diff --git a/ruoyi-generator/src/main/resources/vm/java/service.java.vm b/ruoyi-generator/src/main/resources/vm/java/service.java.vm index 0561660..d5016d4 100644 --- a/ruoyi-generator/src/main/resources/vm/java/service.java.vm +++ b/ruoyi-generator/src/main/resources/vm/java/service.java.vm @@ -32,6 +32,7 @@ */ TableDataInfo<${ClassName}Vo> queryPageList(${ClassName}QueryBo bo); #end + /** * 鏌ヨ鍒楄〃 */ diff --git a/ruoyi-generator/src/main/resources/vm/java/vo.java.vm b/ruoyi-generator/src/main/resources/vm/java/vo.java.vm index 0746f0c..87f7209 100644 --- a/ruoyi-generator/src/main/resources/vm/java/vo.java.vm +++ b/ruoyi-generator/src/main/resources/vm/java/vo.java.vm @@ -13,7 +13,7 @@ /** - * ${functionName}瑙嗗浘瀵硅薄 mall_package + * ${functionName}瑙嗗浘瀵硅薄 ${tableName} * * @author ${author} * @date ${datetime} @@ -21,6 +21,7 @@ @Data @ApiModel("${functionName}瑙嗗浘瀵硅薄") public class ${ClassName}Vo { + private static final long serialVersionUID = 1L; /** $pkColumn.columnComment */ @@ -46,6 +47,7 @@ #end @ApiModelProperty("$column.columnComment") private $column.javaType $column.javaField; + #end #end diff --git a/ruoyi-system/src/main/java/com/ruoyi/system/mapper/SysDeptMapper.java b/ruoyi-system/src/main/java/com/ruoyi/system/mapper/SysDeptMapper.java index 12824e7..54fe261 100644 --- a/ruoyi-system/src/main/java/com/ruoyi/system/mapper/SysDeptMapper.java +++ b/ruoyi-system/src/main/java/com/ruoyi/system/mapper/SysDeptMapper.java @@ -30,4 +30,12 @@ */ public List<Integer> selectDeptListByRoleId(@Param("roleId") Long roleId, @Param("deptCheckStrictly") boolean deptCheckStrictly); + /** + * 淇敼瀛愬厓绱犲叧绯� + * + * @param depts 瀛愬厓绱� + * @return 缁撴灉 + */ + public int updateDeptChildren(@Param("depts") List<SysDept> depts); + } diff --git a/ruoyi-system/src/main/java/com/ruoyi/system/mapper/SysRoleDeptMapper.java b/ruoyi-system/src/main/java/com/ruoyi/system/mapper/SysRoleDeptMapper.java index 6121490..331ecb9 100644 --- a/ruoyi-system/src/main/java/com/ruoyi/system/mapper/SysRoleDeptMapper.java +++ b/ruoyi-system/src/main/java/com/ruoyi/system/mapper/SysRoleDeptMapper.java @@ -3,6 +3,8 @@ import com.ruoyi.common.core.page.BaseMapperPlus; import com.ruoyi.system.domain.SysRoleDept; +import java.util.List; + /** * 瑙掕壊涓庨儴闂ㄥ叧鑱旇〃 鏁版嵁灞� * @@ -10,4 +12,12 @@ */ public interface SysRoleDeptMapper extends BaseMapperPlus<SysRoleDept> { + /** + * 鎵归噺鏂板瑙掕壊閮ㄩ棬淇℃伅 + * + * @param roleDeptList 瑙掕壊閮ㄩ棬鍒楄〃 + * @return 缁撴灉 + */ + public int batchRoleDept(List<SysRoleDept> roleDeptList); + } diff --git a/ruoyi-system/src/main/java/com/ruoyi/system/mapper/SysRoleMenuMapper.java b/ruoyi-system/src/main/java/com/ruoyi/system/mapper/SysRoleMenuMapper.java index fa8c5a3..4f08cea 100644 --- a/ruoyi-system/src/main/java/com/ruoyi/system/mapper/SysRoleMenuMapper.java +++ b/ruoyi-system/src/main/java/com/ruoyi/system/mapper/SysRoleMenuMapper.java @@ -3,6 +3,8 @@ import com.ruoyi.common.core.page.BaseMapperPlus; import com.ruoyi.system.domain.SysRoleMenu; +import java.util.List; + /** * 瑙掕壊涓庤彍鍗曞叧鑱旇〃 鏁版嵁灞� * @@ -10,4 +12,12 @@ */ public interface SysRoleMenuMapper extends BaseMapperPlus<SysRoleMenu> { + /** + * 鎵归噺鏂板瑙掕壊鑿滃崟淇℃伅 + * + * @param roleMenuList 瑙掕壊鑿滃崟鍒楄〃 + * @return 缁撴灉 + */ + public int batchRoleMenu(List<SysRoleMenu> roleMenuList); + } diff --git a/ruoyi-system/src/main/java/com/ruoyi/system/mapper/SysUserPostMapper.java b/ruoyi-system/src/main/java/com/ruoyi/system/mapper/SysUserPostMapper.java index c17dfd5..7839bbe 100644 --- a/ruoyi-system/src/main/java/com/ruoyi/system/mapper/SysUserPostMapper.java +++ b/ruoyi-system/src/main/java/com/ruoyi/system/mapper/SysUserPostMapper.java @@ -3,6 +3,8 @@ import com.ruoyi.common.core.page.BaseMapperPlus; import com.ruoyi.system.domain.SysUserPost; +import java.util.List; + /** * 鐢ㄦ埛涓庡矖浣嶅叧鑱旇〃 鏁版嵁灞� * @@ -10,4 +12,12 @@ */ public interface SysUserPostMapper extends BaseMapperPlus<SysUserPost> { + /** + * 鎵归噺鏂板鐢ㄦ埛宀椾綅淇℃伅 + * + * @param userPostList 鐢ㄦ埛瑙掕壊鍒楄〃 + * @return 缁撴灉 + */ + public int batchUserPost(List<SysUserPost> userPostList); + } diff --git a/ruoyi-system/src/main/java/com/ruoyi/system/mapper/SysUserRoleMapper.java b/ruoyi-system/src/main/java/com/ruoyi/system/mapper/SysUserRoleMapper.java index ddebd38..365bbf4 100644 --- a/ruoyi-system/src/main/java/com/ruoyi/system/mapper/SysUserRoleMapper.java +++ b/ruoyi-system/src/main/java/com/ruoyi/system/mapper/SysUserRoleMapper.java @@ -3,6 +3,8 @@ import com.ruoyi.common.core.page.BaseMapperPlus; import com.ruoyi.system.domain.SysUserRole; +import java.util.List; + /** * 鐢ㄦ埛涓庤鑹插叧鑱旇〃 鏁版嵁灞� * @@ -10,4 +12,12 @@ */ public interface SysUserRoleMapper extends BaseMapperPlus<SysUserRole> { + /** + * 鎵归噺鏂板鐢ㄦ埛瑙掕壊淇℃伅 + * + * @param userRoleList 鐢ㄦ埛瑙掕壊鍒楄〃 + * @return 缁撴灉 + */ + public int batchUserRole(List<SysUserRole> userRoleList); + } diff --git a/ruoyi-system/src/main/java/com/ruoyi/system/service/impl/SysConfigServiceImpl.java b/ruoyi-system/src/main/java/com/ruoyi/system/service/impl/SysConfigServiceImpl.java index 2376d8b..d0b37c5 100644 --- a/ruoyi-system/src/main/java/com/ruoyi/system/service/impl/SysConfigServiceImpl.java +++ b/ruoyi-system/src/main/java/com/ruoyi/system/service/impl/SysConfigServiceImpl.java @@ -20,6 +20,7 @@ import org.springframework.stereotype.Service; import javax.annotation.PostConstruct; +import java.util.Arrays; import java.util.Collection; import java.util.List; import java.util.Map; @@ -31,9 +32,6 @@ */ @Service public class SysConfigServiceImpl extends ServiceImpl<SysConfigMapper, SysConfig> implements ISysConfigService { - - @Autowired - private SysConfigMapper configMapper; @Autowired private RedisCache redisCache; @@ -160,9 +158,9 @@ if (StrUtil.equals(UserConstants.YES, config.getConfigType())) { throw new CustomException(String.format("鍐呯疆鍙傛暟銆�%1$s銆戜笉鑳藉垹闄� ", config.getConfigKey())); } - configMapper.deleteById(configId); redisCache.deleteObject(getCacheKey(config.getConfigKey())); } + baseMapper.deleteBatchIds(Arrays.asList(configIds)); } /** diff --git a/ruoyi-system/src/main/java/com/ruoyi/system/service/impl/SysDeptServiceImpl.java b/ruoyi-system/src/main/java/com/ruoyi/system/service/impl/SysDeptServiceImpl.java index 65f8601..7cdda23 100644 --- a/ruoyi-system/src/main/java/com/ruoyi/system/service/impl/SysDeptServiceImpl.java +++ b/ruoyi-system/src/main/java/com/ruoyi/system/service/impl/SysDeptServiceImpl.java @@ -244,7 +244,7 @@ child.setAncestors(child.getAncestors().replaceFirst(oldAncestors, newAncestors)); } if (children.size() > 0) { - updateBatchById(children); + baseMapper.updateDeptChildren(children); } } diff --git a/ruoyi-system/src/main/java/com/ruoyi/system/service/impl/SysDictDataServiceImpl.java b/ruoyi-system/src/main/java/com/ruoyi/system/service/impl/SysDictDataServiceImpl.java index 7038565..4b08a14 100644 --- a/ruoyi-system/src/main/java/com/ruoyi/system/service/impl/SysDictDataServiceImpl.java +++ b/ruoyi-system/src/main/java/com/ruoyi/system/service/impl/SysDictDataServiceImpl.java @@ -11,6 +11,7 @@ import com.ruoyi.system.service.ISysDictDataService; import org.springframework.stereotype.Service; +import java.util.Arrays; import java.util.List; /** @@ -83,10 +84,10 @@ public void deleteDictDataByIds(Long[] dictCodes) { for (Long dictCode : dictCodes) { SysDictData data = selectDictDataById(dictCode); - baseMapper.deleteById(dictCode); List<SysDictData> dictDatas = baseMapper.selectDictDataByType(data.getDictType()); DictUtils.setDictCache(data.getDictType(), dictDatas); } + baseMapper.deleteBatchIds(Arrays.asList(dictCodes)); } /** diff --git a/ruoyi-system/src/main/java/com/ruoyi/system/service/impl/SysDictTypeServiceImpl.java b/ruoyi-system/src/main/java/com/ruoyi/system/service/impl/SysDictTypeServiceImpl.java index 79a4036..c4f9d95 100644 --- a/ruoyi-system/src/main/java/com/ruoyi/system/service/impl/SysDictTypeServiceImpl.java +++ b/ruoyi-system/src/main/java/com/ruoyi/system/service/impl/SysDictTypeServiceImpl.java @@ -21,6 +21,7 @@ import org.springframework.transaction.annotation.Transactional; import javax.annotation.PostConstruct; +import java.util.Arrays; import java.util.List; import java.util.Map; @@ -31,9 +32,6 @@ */ @Service public class SysDictTypeServiceImpl extends ServiceImpl<SysDictTypeMapper, SysDictType> implements ISysDictTypeService { - - @Autowired - private SysDictTypeMapper dictTypeMapper; @Autowired private SysDictDataMapper dictDataMapper; @@ -149,9 +147,9 @@ .eq(SysDictData::getDictType, dictType.getDictType())) > 0) { throw new CustomException(String.format("%1$s宸插垎閰�,涓嶈兘鍒犻櫎", dictType.getDictName())); } - dictTypeMapper.deleteById(dictId); DictUtils.removeDictCache(dictType.getDictType()); } + baseMapper.deleteBatchIds(Arrays.asList(dictIds)); } /** diff --git a/ruoyi-system/src/main/java/com/ruoyi/system/service/impl/SysRoleServiceImpl.java b/ruoyi-system/src/main/java/com/ruoyi/system/service/impl/SysRoleServiceImpl.java index 9d4b10a..c46c45f 100644 --- a/ruoyi-system/src/main/java/com/ruoyi/system/service/impl/SysRoleServiceImpl.java +++ b/ruoyi-system/src/main/java/com/ruoyi/system/service/impl/SysRoleServiceImpl.java @@ -240,9 +240,7 @@ list.add(rm); } if (list.size() > 0) { - for (SysRoleMenu sysRoleMenu : list) { - rows += roleMenuMapper.insert(sysRoleMenu); - } + rows = roleMenuMapper.batchRoleMenu(list); } return rows; } @@ -263,9 +261,7 @@ list.add(rd); } if (list.size() > 0) { - for (SysRoleDept sysRoleDept : list) { - rows += roleDeptMapper.insert(sysRoleDept); - } + rows = roleDeptMapper.batchRoleDept(list); } return rows; } diff --git a/ruoyi-system/src/main/java/com/ruoyi/system/service/impl/SysUserServiceImpl.java b/ruoyi-system/src/main/java/com/ruoyi/system/service/impl/SysUserServiceImpl.java index 466714b..dd12f10 100644 --- a/ruoyi-system/src/main/java/com/ruoyi/system/service/impl/SysUserServiceImpl.java +++ b/ruoyi-system/src/main/java/com/ruoyi/system/service/impl/SysUserServiceImpl.java @@ -52,7 +52,7 @@ private ISysConfigService configService; @Override - @DataScope(deptAlias = "d", userAlias = "u") + @DataScope(deptAlias = "d", userAlias = "u", isUser = true) public TableDataInfo<SysUser> selectPageUserList(SysUser user) { return PageUtils.buildDataInfo(baseMapper.selectPageUserList(PageUtils.buildPage(), user)); } @@ -64,7 +64,7 @@ * @return 鐢ㄦ埛淇℃伅闆嗗悎淇℃伅 */ @Override - @DataScope(deptAlias = "d", userAlias = "u") + @DataScope(deptAlias = "d", userAlias = "u", isUser = true) public List<SysUser> selectUserList(SysUser user) { return baseMapper.selectUserList(user); } @@ -100,7 +100,7 @@ @Override public String selectUserRoleGroup(String userName) { List<SysRole> list = roleMapper.selectRolesByUserName(userName); - StringBuffer idsStr = new StringBuffer(); + StringBuilder idsStr = new StringBuilder(); for (SysRole role : list) { idsStr.append(role.getRoleName()).append(","); } @@ -119,7 +119,7 @@ @Override public String selectUserPostGroup(String userName) { List<SysPost> list = postMapper.selectPostsByUserName(userName); - StringBuffer idsStr = new StringBuffer(); + StringBuilder idsStr = new StringBuilder(); for (SysPost post : list) { idsStr.append(post.getPostName()).append(","); } @@ -311,9 +311,7 @@ list.add(ur); } if (list.size() > 0) { - for (SysUserRole sysUserRole : list) { - userRoleMapper.insert(sysUserRole); - } + userRoleMapper.batchUserRole(list); } } } @@ -335,9 +333,7 @@ list.add(up); } if (list.size() > 0) { - for (SysUserPost sysUserPost : list) { - userPostMapper.insert(sysUserPost); - } + userPostMapper.batchUserPost(list); } } } diff --git a/ruoyi-system/src/main/resources/mapper/system/SysDeptMapper.xml b/ruoyi-system/src/main/resources/mapper/system/SysDeptMapper.xml index 7db8616..2f56544 100644 --- a/ruoyi-system/src/main/resources/mapper/system/SysDeptMapper.xml +++ b/ruoyi-system/src/main/resources/mapper/system/SysDeptMapper.xml @@ -40,7 +40,9 @@ AND status = #{status} </if> <!-- 鏁版嵁鑼冨洿杩囨护 --> - ${params.dataScope} + <if test="params.dataScope != null and params.dataScope != ''"> + AND ( ${params.dataScope} ) + </if> order by d.parent_id, d.order_num </select> @@ -55,4 +57,17 @@ order by d.parent_id, d.order_num </select> + <update id="updateDeptChildren" parameterType="java.util.List"> + update sys_dept set ancestors = + <foreach collection="depts" item="item" index="index" + separator=" " open="case dept_id" close="end"> + when #{item.deptId} then #{item.ancestors} + </foreach> + where dept_id in + <foreach collection="depts" item="item" index="index" + separator="," open="(" close=")"> + #{item.deptId} + </foreach> + </update> + </mapper> diff --git a/ruoyi-system/src/main/resources/mapper/system/SysRoleDeptMapper.xml b/ruoyi-system/src/main/resources/mapper/system/SysRoleDeptMapper.xml index 0fda682..cace1f5 100644 --- a/ruoyi-system/src/main/resources/mapper/system/SysRoleDeptMapper.xml +++ b/ruoyi-system/src/main/resources/mapper/system/SysRoleDeptMapper.xml @@ -9,4 +9,11 @@ <result property="deptId" column="dept_id"/> </resultMap> -</mapper> \ No newline at end of file + <insert id="batchRoleDept"> + insert into sys_role_dept(role_id, dept_id) values + <foreach item="item" index="index" collection="list" separator=","> + (#{item.roleId},#{item.deptId}) + </foreach> + </insert> + +</mapper> diff --git a/ruoyi-system/src/main/resources/mapper/system/SysRoleMapper.xml b/ruoyi-system/src/main/resources/mapper/system/SysRoleMapper.xml index 5440f4f..1a542f8 100644 --- a/ruoyi-system/src/main/resources/mapper/system/SysRoleMapper.xml +++ b/ruoyi-system/src/main/resources/mapper/system/SysRoleMapper.xml @@ -58,7 +58,9 @@ and date_format(r.create_time,'%y%m%d') <= date_format(#{role.params.endTime},'%y%m%d') </if> <!-- 鏁版嵁鑼冨洿杩囨护 --> - ${role.params.dataScope} + <if test="role.params.dataScope != null and role.params.dataScope != ''"> + AND ( ${role.params.dataScope} ) + </if> order by r.role_sort </select> @@ -81,7 +83,9 @@ and date_format(r.create_time,'%y%m%d') <= date_format(#{params.endTime},'%y%m%d') </if> <!-- 鏁版嵁鑼冨洿杩囨护 --> - ${params.dataScope} + <if test="params.dataScope != null and params.dataScope != ''"> + AND ( ${params.dataScope} ) + </if> order by r.role_sort </select> diff --git a/ruoyi-system/src/main/resources/mapper/system/SysRoleMenuMapper.xml b/ruoyi-system/src/main/resources/mapper/system/SysRoleMenuMapper.xml index 2529a72..356b612 100644 --- a/ruoyi-system/src/main/resources/mapper/system/SysRoleMenuMapper.xml +++ b/ruoyi-system/src/main/resources/mapper/system/SysRoleMenuMapper.xml @@ -9,4 +9,11 @@ <result property="menuId" column="menu_id"/> </resultMap> -</mapper> \ No newline at end of file + <insert id="batchRoleMenu"> + insert into sys_role_menu(role_id, menu_id) values + <foreach item="item" index="index" collection="list" separator=","> + (#{item.roleId},#{item.menuId}) + </foreach> + </insert> + +</mapper> diff --git a/ruoyi-system/src/main/resources/mapper/system/SysUserMapper.xml b/ruoyi-system/src/main/resources/mapper/system/SysUserMapper.xml index 741600f..df59332 100644 --- a/ruoyi-system/src/main/resources/mapper/system/SysUserMapper.xml +++ b/ruoyi-system/src/main/resources/mapper/system/SysUserMapper.xml @@ -106,7 +106,9 @@ ancestors) )) </if> <!-- 鏁版嵁鑼冨洿杩囨护 --> - ${user.params.dataScope} + <if test="user.params.dataScope != null and user.params.dataScope != ''"> + AND ( ${user.params.dataScope} ) + </if> </select> <select id="selectUserList" parameterType="SysUser" resultMap="SysUserResult"> @@ -135,7 +137,9 @@ ancestors) )) </if> <!-- 鏁版嵁鑼冨洿杩囨护 --> - ${params.dataScope} + <if test="params.dataScope != null and params.dataScope != ''"> + AND ( ${params.dataScope} ) + </if> </select> <select id="selectUserByUserName" parameterType="String" resultMap="SysUserResult"> diff --git a/ruoyi-system/src/main/resources/mapper/system/SysUserPostMapper.xml b/ruoyi-system/src/main/resources/mapper/system/SysUserPostMapper.xml index bd13ed4..8d70825 100644 --- a/ruoyi-system/src/main/resources/mapper/system/SysUserPostMapper.xml +++ b/ruoyi-system/src/main/resources/mapper/system/SysUserPostMapper.xml @@ -9,4 +9,11 @@ <result property="postId" column="post_id"/> </resultMap> -</mapper> \ No newline at end of file + <insert id="batchUserPost"> + insert into sys_user_post(user_id, post_id) values + <foreach item="item" index="index" collection="list" separator=","> + (#{item.userId},#{item.postId}) + </foreach> + </insert> + +</mapper> diff --git a/ruoyi-system/src/main/resources/mapper/system/SysUserRoleMapper.xml b/ruoyi-system/src/main/resources/mapper/system/SysUserRoleMapper.xml index 3d41141..1db2f0f 100644 --- a/ruoyi-system/src/main/resources/mapper/system/SysUserRoleMapper.xml +++ b/ruoyi-system/src/main/resources/mapper/system/SysUserRoleMapper.xml @@ -9,4 +9,11 @@ <result property="roleId" column="role_id"/> </resultMap> -</mapper> \ No newline at end of file + <insert id="batchUserRole"> + insert into sys_user_role(user_id, role_id) values + <foreach item="item" index="index" collection="list" separator=","> + (#{item.userId},#{item.roleId}) + </foreach> + </insert> + +</mapper> diff --git a/ruoyi-ui/package.json b/ruoyi-ui/package.json index e951b8d..2fc1921 100644 --- a/ruoyi-ui/package.json +++ b/ruoyi-ui/package.json @@ -1,6 +1,6 @@ { "name": "ruoyi-vue-plus", - "version": "2.2.1", + "version": "2.3.0", "description": "RuoYi-Vue-Plus鍚庡彴绠$悊绯荤粺", "author": "LionLi", "license": "MIT", diff --git a/ruoyi-ui/src/api/demo/demo.js b/ruoyi-ui/src/api/demo/demo.js new file mode 100644 index 0000000..fc9937d --- /dev/null +++ b/ruoyi-ui/src/api/demo/demo.js @@ -0,0 +1,53 @@ +import request from '@/utils/request' + +// 鏌ヨ娴嬭瘯鍗曡〃鍒楄〃 +export function listDemo(query) { + return request({ + url: '/demo/demo/list', + method: 'get', + params: query + }) +} + +// 鏌ヨ娴嬭瘯鍗曡〃璇︾粏 +export function getDemo(id) { + return request({ + url: '/demo/demo/' + id, + method: 'get' + }) +} + +// 鏂板娴嬭瘯鍗曡〃 +export function addDemo(data) { + return request({ + url: '/demo/demo', + method: 'post', + data: data + }) +} + +// 淇敼娴嬭瘯鍗曡〃 +export function updateDemo(data) { + return request({ + url: '/demo/demo', + method: 'put', + data: data + }) +} + +// 鍒犻櫎娴嬭瘯鍗曡〃 +export function delDemo(id) { + return request({ + url: '/demo/demo/' + id, + method: 'delete' + }) +} + +// 瀵煎嚭娴嬭瘯鍗曡〃 +export function exportDemo(query) { + return request({ + url: '/demo/demo/export', + method: 'get', + params: query + }) +} \ No newline at end of file diff --git a/ruoyi-ui/src/api/demo/test.js b/ruoyi-ui/src/api/demo/test.js new file mode 100644 index 0000000..f4c6421 --- /dev/null +++ b/ruoyi-ui/src/api/demo/test.js @@ -0,0 +1,53 @@ +import request from '@/utils/request' + +// 鏌ヨ娴嬭瘯鍒楄〃 +export function listTest(query) { + return request({ + url: '/demo/test/list', + method: 'get', + params: query + }) +} + +// 鏌ヨ娴嬭瘯璇︾粏 +export function getTest(id) { + return request({ + url: '/demo/test/' + id, + method: 'get' + }) +} + +// 鏂板娴嬭瘯 +export function addTest(data) { + return request({ + url: '/demo/test', + method: 'post', + data: data + }) +} + +// 淇敼娴嬭瘯 +export function updateTest(data) { + return request({ + url: '/demo/test', + method: 'put', + data: data + }) +} + +// 鍒犻櫎娴嬭瘯 +export function delTest(id) { + return request({ + url: '/demo/test/' + id, + method: 'delete' + }) +} + +// 瀵煎嚭娴嬭瘯 +export function exportTest(query) { + return request({ + url: '/demo/test/export', + method: 'get', + params: query + }) +} \ No newline at end of file diff --git a/ruoyi-ui/src/api/demo/tree.js b/ruoyi-ui/src/api/demo/tree.js new file mode 100644 index 0000000..d597e72 --- /dev/null +++ b/ruoyi-ui/src/api/demo/tree.js @@ -0,0 +1,53 @@ +import request from '@/utils/request' + +// 鏌ヨ娴嬭瘯鏍戣〃鍒楄〃 +export function listTree(query) { + return request({ + url: '/demo/tree/list', + method: 'get', + params: query + }) +} + +// 鏌ヨ娴嬭瘯鏍戣〃璇︾粏 +export function getTree(id) { + return request({ + url: '/demo/tree/' + id, + method: 'get' + }) +} + +// 鏂板娴嬭瘯鏍戣〃 +export function addTree(data) { + return request({ + url: '/demo/tree', + method: 'post', + data: data + }) +} + +// 淇敼娴嬭瘯鏍戣〃 +export function updateTree(data) { + return request({ + url: '/demo/tree', + method: 'put', + data: data + }) +} + +// 鍒犻櫎娴嬭瘯鏍戣〃 +export function delTree(id) { + return request({ + url: '/demo/tree/' + id, + method: 'delete' + }) +} + +// 瀵煎嚭娴嬭瘯鏍戣〃 +export function exportTree(query) { + return request({ + url: '/demo/tree/export', + method: 'get', + params: query + }) +} \ No newline at end of file diff --git a/ruoyi-ui/src/views/demo/demo/index.vue b/ruoyi-ui/src/views/demo/demo/index.vue new file mode 100644 index 0000000..b831ad9 --- /dev/null +++ b/ruoyi-ui/src/views/demo/demo/index.vue @@ -0,0 +1,339 @@ +<template> + <div class="app-container"> + <el-form :model="queryParams" ref="queryForm" :inline="true" v-show="showSearch" label-width="68px"> + <el-form-item label="key閿�" prop="testKey"> + <el-input + v-model="queryParams.testKey" + placeholder="璇疯緭鍏ey閿�" + clearable + size="small" + @keyup.enter.native="handleQuery" + /> + </el-form-item> + <el-form-item label="鍊�" prop="value"> + <el-input + v-model="queryParams.value" + placeholder="璇疯緭鍏ュ��" + clearable + size="small" + @keyup.enter.native="handleQuery" + /> + </el-form-item> + <el-form-item label="鍒涘缓鏃堕棿"> + <el-date-picker + v-model="daterangeCreateTime" + size="small" + style="width: 240px" + value-format="yyyy-MM-dd" + type="daterange" + range-separator="-" + start-placeholder="寮�濮嬫棩鏈�" + end-placeholder="缁撴潫鏃ユ湡" + ></el-date-picker> + </el-form-item> + <el-form-item> + <el-button type="primary" icon="el-icon-search" size="mini" @click="handleQuery">鎼滅储</el-button> + <el-button icon="el-icon-refresh" size="mini" @click="resetQuery">閲嶇疆</el-button> + </el-form-item> + </el-form> + + <el-row :gutter="10" class="mb8"> + <el-col :span="1.5"> + <el-button + type="primary" + plain + icon="el-icon-plus" + size="mini" + @click="handleAdd" + v-hasPermi="['demo:demo:add']" + >鏂板</el-button> + </el-col> + <el-col :span="1.5"> + <el-button + type="success" + plain + icon="el-icon-edit" + size="mini" + :disabled="single" + @click="handleUpdate" + v-hasPermi="['demo:demo:edit']" + >淇敼</el-button> + </el-col> + <el-col :span="1.5"> + <el-button + type="danger" + plain + icon="el-icon-delete" + size="mini" + :disabled="multiple" + @click="handleDelete" + v-hasPermi="['demo:demo:remove']" + >鍒犻櫎</el-button> + </el-col> + <el-col :span="1.5"> + <el-button + type="warning" + plain + icon="el-icon-download" + size="mini" + :loading="exportLoading" + @click="handleExport" + v-hasPermi="['demo:demo:export']" + >瀵煎嚭</el-button> + </el-col> + <right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar> + </el-row> + + <el-table v-loading="loading" :data="demoList" @selection-change="handleSelectionChange"> + <el-table-column type="selection" width="55" align="center" /> + <el-table-column label="涓婚敭" align="center" prop="id" v-if="false"/> + <el-table-column label="閮ㄩ棬id" align="center" prop="deptId" /> + <el-table-column label="鐢ㄦ埛id" align="center" prop="userId" /> + <el-table-column label="鎺掑簭鍙�" align="center" prop="orderNum" /> + <el-table-column label="key閿�" align="center" prop="testKey" /> + <el-table-column label="鍊�" align="center" prop="value" /> + <el-table-column label="鍒涘缓鏃堕棿" align="center" prop="createTime" width="180"> + <template slot-scope="scope"> + <span>{{ parseTime(scope.row.createTime, '{y}-{m}-{d}') }}</span> + </template> + </el-table-column> + <el-table-column label="鍒涘缓浜�" align="center" prop="createBy" /> + <el-table-column label="鏇存柊鏃堕棿" align="center" prop="updateTime" width="180"> + <template slot-scope="scope"> + <span>{{ parseTime(scope.row.updateTime, '{y}-{m}-{d}') }}</span> + </template> + </el-table-column> + <el-table-column label="鏇存柊浜�" align="center" prop="updateBy" /> + <el-table-column label="鎿嶄綔" align="center" class-name="small-padding fixed-width"> + <template slot-scope="scope"> + <el-button + size="mini" + type="text" + icon="el-icon-edit" + @click="handleUpdate(scope.row)" + v-hasPermi="['demo:demo:edit']" + >淇敼</el-button> + <el-button + size="mini" + type="text" + icon="el-icon-delete" + @click="handleDelete(scope.row)" + v-hasPermi="['demo:demo:remove']" + >鍒犻櫎</el-button> + </template> + </el-table-column> + </el-table> + + <pagination + v-show="total>0" + :total="total" + :page.sync="queryParams.pageNum" + :limit.sync="queryParams.pageSize" + @pagination="getList" + /> + + <!-- 娣诲姞鎴栦慨鏀规祴璇曞崟琛ㄥ璇濇 --> + <el-dialog :title="title" :visible.sync="open" width="500px" append-to-body> + <el-form ref="form" :model="form" :rules="rules" label-width="80px"> + <el-form-item label="閮ㄩ棬id" prop="deptId"> + <el-input v-model="form.deptId" placeholder="璇疯緭鍏ラ儴闂╥d" /> + </el-form-item> + <el-form-item label="鐢ㄦ埛id" prop="userId"> + <el-input v-model="form.userId" placeholder="璇疯緭鍏ョ敤鎴穒d" /> + </el-form-item> + <el-form-item label="鎺掑簭鍙�" prop="orderNum"> + <el-input v-model="form.orderNum" placeholder="璇疯緭鍏ユ帓搴忓彿" /> + </el-form-item> + <el-form-item label="key閿�" prop="testKey"> + <el-input v-model="form.testKey" placeholder="璇疯緭鍏ey閿�" /> + </el-form-item> + <el-form-item label="鍊�" prop="value"> + <el-input v-model="form.value" placeholder="璇疯緭鍏ュ��" /> + </el-form-item> + </el-form> + <div slot="footer" class="dialog-footer"> + <el-button type="primary" @click="submitForm">纭� 瀹�</el-button> + <el-button @click="cancel">鍙� 娑�</el-button> + </div> + </el-dialog> + </div> +</template> + +<script> +import { listDemo, getDemo, delDemo, addDemo, updateDemo, exportDemo } from "@/api/demo/demo"; + +export default { + name: "Demo", + components: { + }, + data() { + return { + // 閬僵灞� + loading: true, + // 瀵煎嚭閬僵灞� + exportLoading: false, + // 閫変腑鏁扮粍 + ids: [], + // 闈炲崟涓鐢� + single: true, + // 闈炲涓鐢� + multiple: true, + // 鏄剧ず鎼滅储鏉′欢 + showSearch: true, + // 鎬绘潯鏁� + total: 0, + // 娴嬭瘯鍗曡〃琛ㄦ牸鏁版嵁 + demoList: [], + // 寮瑰嚭灞傛爣棰� + title: "", + // 鏄惁鏄剧ず寮瑰嚭灞� + open: false, + // 鍒涘缓鏃堕棿鏃堕棿鑼冨洿 + daterangeCreateTime: [], + // 鏌ヨ鍙傛暟 + queryParams: { + pageNum: 1, + pageSize: 10, + testKey: undefined, + value: undefined, + createTime: undefined, + }, + // 琛ㄥ崟鍙傛暟 + form: {}, + // 琛ㄥ崟鏍¢獙 + rules: { + testKey: [ + { required: true, message: "key閿笉鑳戒负绌�", trigger: "blur" } + ], + value: [ + { required: true, message: "鍊间笉鑳戒负绌�", trigger: "blur" } + ], + } + }; + }, + created() { + this.getList(); + }, + methods: { + /** 鏌ヨ娴嬭瘯鍗曡〃鍒楄〃 */ + getList() { + this.loading = true; + this.queryParams.params = {}; + if (null != this.daterangeCreateTime && '' != this.daterangeCreateTime) { + this.queryParams.params["beginCreateTime"] = this.daterangeCreateTime[0]; + this.queryParams.params["endCreateTime"] = this.daterangeCreateTime[1]; + } + listDemo(this.queryParams).then(response => { + this.demoList = response.rows; + this.total = response.total; + this.loading = false; + }); + }, + // 鍙栨秷鎸夐挳 + cancel() { + this.open = false; + this.reset(); + }, + // 琛ㄥ崟閲嶇疆 + reset() { + this.form = { + id: undefined, + deptId: undefined, + userId: undefined, + orderNum: undefined, + testKey: undefined, + value: undefined, + version: undefined, + createTime: undefined, + createBy: undefined, + updateTime: undefined, + updateBy: undefined, + delFlag: undefined + }; + this.resetForm("form"); + }, + /** 鎼滅储鎸夐挳鎿嶄綔 */ + handleQuery() { + this.queryParams.pageNum = 1; + this.getList(); + }, + /** 閲嶇疆鎸夐挳鎿嶄綔 */ + resetQuery() { + this.daterangeCreateTime = []; + this.resetForm("queryForm"); + this.handleQuery(); + }, + // 澶氶�夋閫変腑鏁版嵁 + handleSelectionChange(selection) { + this.ids = selection.map(item => item.id) + this.single = selection.length!==1 + this.multiple = !selection.length + }, + /** 鏂板鎸夐挳鎿嶄綔 */ + handleAdd() { + this.reset(); + this.open = true; + this.title = "娣诲姞娴嬭瘯鍗曡〃"; + }, + /** 淇敼鎸夐挳鎿嶄綔 */ + handleUpdate(row) { + this.reset(); + const id = row.id || this.ids + getDemo(id).then(response => { + this.form = response.data; + this.open = true; + this.title = "淇敼娴嬭瘯鍗曡〃"; + }); + }, + /** 鎻愪氦鎸夐挳 */ + submitForm() { + this.$refs["form"].validate(valid => { + if (valid) { + if (this.form.id != null) { + updateDemo(this.form).then(response => { + this.msgSuccess("淇敼鎴愬姛"); + this.open = false; + this.getList(); + }); + } else { + addDemo(this.form).then(response => { + this.msgSuccess("鏂板鎴愬姛"); + this.open = false; + this.getList(); + }); + } + } + }); + }, + /** 鍒犻櫎鎸夐挳鎿嶄綔 */ + handleDelete(row) { + const ids = row.id || this.ids; + this.$confirm('鏄惁纭鍒犻櫎娴嬭瘯鍗曡〃缂栧彿涓�"' + ids + '"鐨勬暟鎹」?', "璀﹀憡", { + confirmButtonText: "纭畾", + cancelButtonText: "鍙栨秷", + type: "warning" + }).then(function() { + return delDemo(ids); + }).then(() => { + this.getList(); + this.msgSuccess("鍒犻櫎鎴愬姛"); + }) + }, + /** 瀵煎嚭鎸夐挳鎿嶄綔 */ + handleExport() { + const queryParams = this.queryParams; + this.$confirm('鏄惁纭瀵煎嚭鎵�鏈夋祴璇曞崟琛ㄦ暟鎹」?', "璀﹀憡", { + confirmButtonText: "纭畾", + cancelButtonText: "鍙栨秷", + type: "warning" + }).then(() => { + this.exportLoading = true; + return exportDemo(queryParams); + }).then(response => { + this.download(response.msg); + this.exportLoading = false; + }) + } + } +}; +</script> diff --git a/ruoyi-ui/src/views/demo/test/index.vue b/ruoyi-ui/src/views/demo/test/index.vue new file mode 100644 index 0000000..897e54e --- /dev/null +++ b/ruoyi-ui/src/views/demo/test/index.vue @@ -0,0 +1,361 @@ +<template> + <div class="app-container"> + <el-form :model="queryParams" ref="queryForm" :inline="true" v-show="showSearch" label-width="68px"> + <el-form-item label="key閿�" prop="testKey"> + <el-input + v-model="queryParams.testKey" + placeholder="璇疯緭鍏ey閿�" + clearable + size="small" + @keyup.enter.native="handleQuery" + /> + </el-form-item> + <el-form-item label="鍊�" prop="value"> + <el-input + v-model="queryParams.value" + placeholder="璇疯緭鍏ュ��" + clearable + size="small" + @keyup.enter.native="handleQuery" + /> + </el-form-item> + <el-form-item label="鐗堟湰" prop="version"> + <el-input + v-model="queryParams.version" + placeholder="璇疯緭鍏ョ増鏈�" + clearable + size="small" + @keyup.enter.native="handleQuery" + /> + </el-form-item> + <el-form-item label="鍒涘缓鏃堕棿"> + <el-date-picker + v-model="daterangeCreateTime" + size="small" + style="width: 240px" + value-format="yyyy-MM-dd" + type="daterange" + range-separator="-" + start-placeholder="寮�濮嬫棩鏈�" + end-placeholder="缁撴潫鏃ユ湡" + ></el-date-picker> + </el-form-item> + <el-form-item label="鍒犻櫎鏍囧織" prop="deleted"> + <el-input + v-model="queryParams.deleted" + placeholder="璇疯緭鍏ュ垹闄ゆ爣蹇�" + clearable + size="small" + @keyup.enter.native="handleQuery" + /> + </el-form-item> + <el-form-item label="鐖秈d" prop="parentId"> + <el-input + v-model="queryParams.parentId" + placeholder="璇疯緭鍏ョ埗id" + clearable + size="small" + @keyup.enter.native="handleQuery" + /> + </el-form-item> + <el-form-item label="鎺掑簭鍙�" prop="orderNum"> + <el-input + v-model="queryParams.orderNum" + placeholder="璇疯緭鍏ユ帓搴忓彿" + clearable + size="small" + @keyup.enter.native="handleQuery" + /> + </el-form-item> + <el-form-item> + <el-button type="primary" icon="el-icon-search" size="mini" @click="handleQuery">鎼滅储</el-button> + <el-button icon="el-icon-refresh" size="mini" @click="resetQuery">閲嶇疆</el-button> + </el-form-item> + </el-form> + + <el-row :gutter="10" class="mb8"> + <el-col :span="1.5"> + <el-button + type="primary" + plain + icon="el-icon-plus" + size="mini" + @click="handleAdd" + v-hasPermi="['demo:test:add']" + >鏂板</el-button> + </el-col> + <el-col :span="1.5"> + <el-button + type="success" + plain + icon="el-icon-edit" + size="mini" + :disabled="single" + @click="handleUpdate" + v-hasPermi="['demo:test:edit']" + >淇敼</el-button> + </el-col> + <el-col :span="1.5"> + <el-button + type="danger" + plain + icon="el-icon-delete" + size="mini" + :disabled="multiple" + @click="handleDelete" + v-hasPermi="['demo:test:remove']" + >鍒犻櫎</el-button> + </el-col> + <el-col :span="1.5"> + <el-button + type="warning" + plain + icon="el-icon-download" + size="mini" + @click="handleExport" + v-hasPermi="['demo:test:export']" + >瀵煎嚭</el-button> + </el-col> + <right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar> + </el-row> + + <el-table v-loading="loading" :data="testList" @selection-change="handleSelectionChange"> + <el-table-column type="selection" width="55" align="center" /> + <el-table-column label="涓婚敭" align="center" prop="id" v-if="false"/> + <el-table-column label="key閿�" align="center" prop="testKey" /> + <el-table-column label="鍊�" align="center" prop="value" /> + <el-table-column label="鐗堟湰" align="center" prop="version" /> + <el-table-column label="鍒涘缓鏃堕棿" align="center" prop="createTime" width="180"> + <template slot-scope="scope"> + <span>{{ parseTime(scope.row.createTime, '{y}-{m}-{d}') }}</span> + </template> + </el-table-column> + <el-table-column label="鍒犻櫎鏍囧織" align="center" prop="deleted" /> + <el-table-column label="鐖秈d" align="center" prop="parentId" /> + <el-table-column label="鎺掑簭鍙�" align="center" prop="orderNum" /> + <el-table-column label="鎿嶄綔" align="center" class-name="small-padding fixed-width"> + <template slot-scope="scope"> + <el-button + size="mini" + type="text" + icon="el-icon-edit" + @click="handleUpdate(scope.row)" + v-hasPermi="['demo:test:edit']" + >淇敼</el-button> + <el-button + size="mini" + type="text" + icon="el-icon-delete" + @click="handleDelete(scope.row)" + v-hasPermi="['demo:test:remove']" + >鍒犻櫎</el-button> + </template> + </el-table-column> + </el-table> + + <pagination + v-show="total>0" + :total="total" + :page.sync="queryParams.pageNum" + :limit.sync="queryParams.pageSize" + @pagination="getList" + /> + + <!-- 娣诲姞鎴栦慨鏀规祴璇曞璇濇 --> + <el-dialog :title="title" :visible.sync="open" width="500px" append-to-body> + <el-form ref="form" :model="form" :rules="rules" label-width="80px"> + <el-form-item label="key閿�" prop="testKey"> + <el-input v-model="form.testKey" placeholder="璇疯緭鍏ey閿�" /> + </el-form-item> + <el-form-item label="鍊�" prop="value"> + <el-input v-model="form.value" placeholder="璇疯緭鍏ュ��" /> + </el-form-item> + <el-form-item label="鐗堟湰" prop="version"> + <el-input v-model="form.version" placeholder="璇疯緭鍏ョ増鏈�" /> + </el-form-item> + <el-form-item label="鍒犻櫎鏍囧織" prop="deleted"> + <el-input v-model="form.deleted" placeholder="璇疯緭鍏ュ垹闄ゆ爣蹇�" /> + </el-form-item> + <el-form-item label="鐖秈d" prop="parentId"> + <el-input v-model="form.parentId" placeholder="璇疯緭鍏ョ埗id" /> + </el-form-item> + <el-form-item label="鎺掑簭鍙�" prop="orderNum"> + <el-input v-model="form.orderNum" placeholder="璇疯緭鍏ユ帓搴忓彿" /> + </el-form-item> + </el-form> + <div slot="footer" class="dialog-footer"> + <el-button type="primary" @click="submitForm">纭� 瀹�</el-button> + <el-button @click="cancel">鍙� 娑�</el-button> + </div> + </el-dialog> + </div> +</template> + +<script> +import { listTest, getTest, delTest, addTest, updateTest, exportTest } from "@/api/demo/test"; + +export default { + name: "Test", + components: { + }, + data() { + return { + // 閬僵灞� + loading: true, + // 閫変腑鏁扮粍 + ids: [], + // 闈炲崟涓鐢� + single: true, + // 闈炲涓鐢� + multiple: true, + // 鏄剧ず鎼滅储鏉′欢 + showSearch: true, + // 鎬绘潯鏁� + total: 0, + // 娴嬭瘯琛ㄦ牸鏁版嵁 + testList: [], + // 寮瑰嚭灞傛爣棰� + title: "", + // 鏄惁鏄剧ず寮瑰嚭灞� + open: false, + // 鍒涘缓鏃堕棿鏃堕棿鑼冨洿 + daterangeCreateTime: [], + // 鏌ヨ鍙傛暟 + queryParams: { + pageNum: 1, + pageSize: 10, + testKey: undefined, + value: undefined, + version: undefined, + createTime: undefined, + deleted: undefined, + parentId: undefined, + orderNum: undefined + }, + // 琛ㄥ崟鍙傛暟 + form: {}, + // 琛ㄥ崟鏍¢獙 + rules: { + } + }; + }, + created() { + this.getList(); + }, + methods: { + /** 鏌ヨ娴嬭瘯鍒楄〃 */ + getList() { + this.loading = true; + this.queryParams.params = {}; + if (null != this.daterangeCreateTime && '' != this.daterangeCreateTime) { + this.queryParams.params["beginCreateTime"] = this.daterangeCreateTime[0]; + this.queryParams.params["endCreateTime"] = this.daterangeCreateTime[1]; + } + listTest(this.queryParams).then(response => { + this.testList = response.rows; + this.total = response.total; + this.loading = false; + }); + }, + // 鍙栨秷鎸夐挳 + cancel() { + this.open = false; + this.reset(); + }, + // 琛ㄥ崟閲嶇疆 + reset() { + this.form = { + id: undefined, + testKey: undefined, + value: undefined, + version: undefined, + createTime: undefined, + deleted: undefined, + parentId: undefined, + orderNum: undefined + }; + this.resetForm("form"); + }, + /** 鎼滅储鎸夐挳鎿嶄綔 */ + handleQuery() { + this.queryParams.pageNum = 1; + this.getList(); + }, + /** 閲嶇疆鎸夐挳鎿嶄綔 */ + resetQuery() { + this.daterangeCreateTime = []; + this.resetForm("queryForm"); + this.handleQuery(); + }, + // 澶氶�夋閫変腑鏁版嵁 + handleSelectionChange(selection) { + this.ids = selection.map(item => item.id) + this.single = selection.length!==1 + this.multiple = !selection.length + }, + /** 鏂板鎸夐挳鎿嶄綔 */ + handleAdd() { + this.reset(); + this.open = true; + this.title = "娣诲姞娴嬭瘯"; + }, + /** 淇敼鎸夐挳鎿嶄綔 */ + handleUpdate(row) { + this.reset(); + const id = row.id || this.ids + getTest(id).then(response => { + this.form = response.data; + this.open = true; + this.title = "淇敼娴嬭瘯"; + }); + }, + /** 鎻愪氦鎸夐挳 */ + submitForm() { + this.$refs["form"].validate(valid => { + if (valid) { + if (this.form.id != null) { + updateTest(this.form).then(response => { + this.msgSuccess("淇敼鎴愬姛"); + this.open = false; + this.getList(); + }); + } else { + addTest(this.form).then(response => { + this.msgSuccess("鏂板鎴愬姛"); + this.open = false; + this.getList(); + }); + } + } + }); + }, + /** 鍒犻櫎鎸夐挳鎿嶄綔 */ + handleDelete(row) { + const ids = row.id || this.ids; + this.$confirm('鏄惁纭鍒犻櫎娴嬭瘯缂栧彿涓�"' + ids + '"鐨勬暟鎹」?', "璀﹀憡", { + confirmButtonText: "纭畾", + cancelButtonText: "鍙栨秷", + type: "warning" + }).then(function() { + return delTest(ids); + }).then(() => { + this.getList(); + this.msgSuccess("鍒犻櫎鎴愬姛"); + }) + }, + /** 瀵煎嚭鎸夐挳鎿嶄綔 */ + handleExport() { + const queryParams = this.queryParams; + this.$confirm('鏄惁纭瀵煎嚭鎵�鏈夋祴璇曟暟鎹」?', "璀﹀憡", { + confirmButtonText: "纭畾", + cancelButtonText: "鍙栨秷", + type: "warning" + }).then(function() { + return exportTest(queryParams); + }).then(response => { + this.download(response.msg); + }) + } + } +}; +</script> diff --git a/ruoyi-ui/src/views/demo/tree/index.vue b/ruoyi-ui/src/views/demo/tree/index.vue new file mode 100644 index 0000000..ddf7677 --- /dev/null +++ b/ruoyi-ui/src/views/demo/tree/index.vue @@ -0,0 +1,282 @@ +<template> + <div class="app-container"> + <el-form :model="queryParams" ref="queryForm" :inline="true" v-show="showSearch" label-width="68px"> + <el-form-item label="鏍戣妭鐐瑰悕" prop="treeName"> + <el-input + v-model="queryParams.treeName" + placeholder="璇疯緭鍏ユ爲鑺傜偣鍚�" + clearable + size="small" + @keyup.enter.native="handleQuery" + /> + </el-form-item> + <el-form-item label="鍒涘缓鏃堕棿"> + <el-date-picker + v-model="daterangeCreateTime" + size="small" + style="width: 240px" + value-format="yyyy-MM-dd" + type="daterange" + range-separator="-" + start-placeholder="寮�濮嬫棩鏈�" + end-placeholder="缁撴潫鏃ユ湡" + ></el-date-picker> + </el-form-item> + <el-form-item> + <el-button type="primary" icon="el-icon-search" size="mini" @click="handleQuery">鎼滅储</el-button> + <el-button icon="el-icon-refresh" size="mini" @click="resetQuery">閲嶇疆</el-button> + </el-form-item> + </el-form> + + <el-row :gutter="10" class="mb8"> + <el-col :span="1.5"> + <el-button + type="primary" + plain + icon="el-icon-plus" + size="mini" + @click="handleAdd" + v-hasPermi="['demo:tree:add']" + >鏂板</el-button> + </el-col> + <right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar> + </el-row> + + <el-table + v-loading="loading" + :data="treeList" + row-key="id" + default-expand-all + :tree-props="{children: 'children', hasChildren: 'hasChildren'}" + > + <el-table-column label="鐖秈d" prop="parentId" /> + <el-table-column label="閮ㄩ棬id" align="center" prop="deptId" /> + <el-table-column label="鐢ㄦ埛id" align="center" prop="userId" /> + <el-table-column label="鏍戣妭鐐瑰悕" align="center" prop="treeName" /> + <el-table-column label="鍒涘缓鏃堕棿" align="center" prop="createTime" width="180"> + <template slot-scope="scope"> + <span>{{ parseTime(scope.row.createTime, '{y}-{m}-{d}') }}</span> + </template> + </el-table-column> + <el-table-column label="鎿嶄綔" align="center" class-name="small-padding fixed-width"> + <template slot-scope="scope"> + <el-button + size="mini" + type="text" + icon="el-icon-edit" + @click="handleUpdate(scope.row)" + v-hasPermi="['demo:tree:edit']" + >淇敼</el-button> + <el-button + size="mini" + type="text" + icon="el-icon-plus" + @click="handleAdd(scope.row)" + v-hasPermi="['demo:tree:add']" + >鏂板</el-button> + <el-button + size="mini" + type="text" + icon="el-icon-delete" + @click="handleDelete(scope.row)" + v-hasPermi="['demo:tree:remove']" + >鍒犻櫎</el-button> + </template> + </el-table-column> + </el-table> + + <!-- 娣诲姞鎴栦慨鏀规祴璇曟爲琛ㄥ璇濇 --> + <el-dialog :title="title" :visible.sync="open" width="500px" append-to-body> + <el-form ref="form" :model="form" :rules="rules" label-width="80px"> + <el-form-item label="鐖秈d" prop="parentId"> + <treeselect v-model="form.parentId" :options="treeOptions" :normalizer="normalizer" placeholder="璇烽�夋嫨鐖秈d" /> + </el-form-item> + <el-form-item label="閮ㄩ棬id" prop="deptId"> + <el-input v-model="form.deptId" placeholder="璇疯緭鍏ラ儴闂╥d" /> + </el-form-item> + <el-form-item label="鐢ㄦ埛id" prop="userId"> + <el-input v-model="form.userId" placeholder="璇疯緭鍏ョ敤鎴穒d" /> + </el-form-item> + <el-form-item label="鏍戣妭鐐瑰悕" prop="treeName"> + <el-input v-model="form.treeName" placeholder="璇疯緭鍏ユ爲鑺傜偣鍚�" /> + </el-form-item> + </el-form> + <div slot="footer" class="dialog-footer"> + <el-button type="primary" @click="submitForm">纭� 瀹�</el-button> + <el-button @click="cancel">鍙� 娑�</el-button> + </div> + </el-dialog> + </div> +</template> + +<script> +import { listTree, getTree, delTree, addTree, updateTree, exportTree } from "@/api/demo/tree"; +import Treeselect from "@riophae/vue-treeselect"; +import "@riophae/vue-treeselect/dist/vue-treeselect.css"; + +export default { + name: "Tree", + components: { + Treeselect + }, + data() { + return { + // 閬僵灞� + loading: true, + // 鏄剧ず鎼滅储鏉′欢 + showSearch: true, + // 娴嬭瘯鏍戣〃琛ㄦ牸鏁版嵁 + treeList: [], + // 娴嬭瘯鏍戣〃鏍戦�夐」 + treeOptions: [], + // 寮瑰嚭灞傛爣棰� + title: "", + // 鏄惁鏄剧ず寮瑰嚭灞� + open: false, + // 鍒涘缓鏃堕棿鏃堕棿鑼冨洿 + daterangeCreateTime: [], + // 鏌ヨ鍙傛暟 + queryParams: { + treeName: null, + createTime: null, + }, + // 琛ㄥ崟鍙傛暟 + form: {}, + // 琛ㄥ崟鏍¢獙 + rules: { + treeName: [ + { required: true, message: "鏍戣妭鐐瑰悕涓嶈兘涓虹┖", trigger: "blur" } + ], + } + }; + }, + created() { + this.getList(); + }, + methods: { + /** 鏌ヨ娴嬭瘯鏍戣〃鍒楄〃 */ + getList() { + this.loading = true; + this.queryParams.params = {}; + if (null != this.daterangeCreateTime && '' != this.daterangeCreateTime) { + this.queryParams.params["beginCreateTime"] = this.daterangeCreateTime[0]; + this.queryParams.params["endCreateTime"] = this.daterangeCreateTime[1]; + } + listTree(this.queryParams).then(response => { + this.treeList = this.handleTree(response.data, "id", "parentId"); + this.loading = false; + }); + }, + /** 杞崲娴嬭瘯鏍戣〃鏁版嵁缁撴瀯 */ + normalizer(node) { + if (node.children && !node.children.length) { + delete node.children; + } + return { + id: node.id, + label: node.treeName, + children: node.children + }; + }, + /** 鏌ヨ娴嬭瘯鏍戣〃涓嬫媺鏍戠粨鏋� */ + getTreeselect() { + listTree().then(response => { + this.treeOptions = []; + const data = { id: 0, treeName: '椤剁骇鑺傜偣', children: [] }; + data.children = this.handleTree(response.data, "id", "parentId"); + this.treeOptions.push(data); + }); + }, + // 鍙栨秷鎸夐挳 + cancel() { + this.open = false; + this.reset(); + }, + // 琛ㄥ崟閲嶇疆 + reset() { + this.form = { + id: null, + parentId: null, + deptId: null, + userId: null, + treeName: null, + version: null, + createTime: null, + createBy: null, + updateTime: null, + updateBy: null, + delFlag: null + }; + this.resetForm("form"); + }, + /** 鎼滅储鎸夐挳鎿嶄綔 */ + handleQuery() { + this.getList(); + }, + /** 閲嶇疆鎸夐挳鎿嶄綔 */ + resetQuery() { + this.daterangeCreateTime = []; + this.resetForm("queryForm"); + this.handleQuery(); + }, + /** 鏂板鎸夐挳鎿嶄綔 */ + handleAdd(row) { + this.reset(); + this.getTreeselect(); + if (row != null && row.id) { + this.form.parentId = row.id; + } else { + this.form.parentId = 0; + } + this.open = true; + this.title = "娣诲姞娴嬭瘯鏍戣〃"; + }, + /** 淇敼鎸夐挳鎿嶄綔 */ + handleUpdate(row) { + this.reset(); + this.getTreeselect(); + if (row != null) { + this.form.parentId = row.id; + } + getTree(row.id).then(response => { + this.form = response.data; + this.open = true; + this.title = "淇敼娴嬭瘯鏍戣〃"; + }); + }, + /** 鎻愪氦鎸夐挳 */ + submitForm() { + this.$refs["form"].validate(valid => { + if (valid) { + if (this.form.id != null) { + updateTree(this.form).then(response => { + this.msgSuccess("淇敼鎴愬姛"); + this.open = false; + this.getList(); + }); + } else { + addTree(this.form).then(response => { + this.msgSuccess("鏂板鎴愬姛"); + this.open = false; + this.getList(); + }); + } + } + }); + }, + /** 鍒犻櫎鎸夐挳鎿嶄綔 */ + handleDelete(row) { + this.$confirm('鏄惁纭鍒犻櫎娴嬭瘯鏍戣〃缂栧彿涓�"' + row.id + '"鐨勬暟鎹」?', "璀﹀憡", { + confirmButtonText: "纭畾", + cancelButtonText: "鍙栨秷", + type: "warning" + }).then(function() { + return delTree(row.id); + }).then(() => { + this.getList(); + this.msgSuccess("鍒犻櫎鎴愬姛"); + }) + } + } +}; +</script> diff --git a/ruoyi-ui/src/views/index.vue b/ruoyi-ui/src/views/index.vue index 91beb84..c246ac9 100644 --- a/ruoyi-ui/src/views/index.vue +++ b/ruoyi-ui/src/views/index.vue @@ -80,6 +80,16 @@ <span>鏇存柊鏃ュ織</span> </div> <el-collapse accordion> + <el-collapse-item title="v2.3.0 - 2021-6-1"> + <ol> + <li>add 鍗囩骇 luttuce 涓� redisson 鎬ц兘鏇村己 宸ュ叿鏇村叏</li> + <li>add 澧炲姞娴嬭瘯鏁版嵁sql鏂囦欢</li> + <li>add 澧炲姞demo妯″潡 鍗曡〃婕旂ず妗堜緥(鍖呭惈鏁版嵁鏉冮檺)</li> + <li>update 瀹岀編淇 鏁版嵁鏉冮檺鍔熻兘(鏀寔鍗曡〃澶氳〃杩囨护)</li> + <li>update 浼樺寲浠g爜鐢熸垚妯℃澘</li> + <li>update 浼樺寲 system 妯″潡 鎵归噺鎿嶄綔鎬ц兘</li> + </ol> + </el-collapse-item> <el-collapse-item title="v2.2.1 - 2021-5-29"> <ol> <li>add 澧炲姞 security 鏉冮檺妗嗘灦 @Async 寮傛娉ㄨВ閰嶇疆</li> diff --git a/ry.bat b/ry.bat new file mode 100644 index 0000000..a6ba5a5 --- /dev/null +++ b/ry.bat @@ -0,0 +1,67 @@ +@echo off + +rem jar平级目录 +set AppName=ruoyi-admin.jar + +rem JVM参数 +set JVM_OPTS="-Dname=%AppName% -Duser.timezone=Asia/Shanghai -Xms512M -Xmx512M -XX:PermSize=256M -XX:MaxPermSize=512M -XX:+HeapDumpOnOutOfMemoryError -XX:+PrintGCDateStamps -XX:+PrintGCDetails -XX:NewRatio=1 -XX:SurvivorRatio=30 -XX:+UseParallelGC -XX:+UseParallelOldGC" + + +ECHO. + ECHO. [1] 启动%AppName% + ECHO. [2] 关闭%AppName% + ECHO. [3] 重启%AppName% + ECHO. [4] 启动状态 %AppName% + ECHO. [5] 退 出 +ECHO. + +ECHO.请输入选择项目的序号: +set /p ID= + IF "%id%"=="1" GOTO start + IF "%id%"=="2" GOTO stop + IF "%id%"=="3" GOTO restart + IF "%id%"=="4" GOTO status + IF "%id%"=="5" EXIT +PAUSE +:start + for /f "usebackq tokens=1-2" %%a in (`jps -l ^| findstr %AppName%`) do ( + set pid=%%a + set image_name=%%b + ) + if defined pid ( + echo %%is running + PAUSE + ) + +start javaw -jar %JAVA_OPTS% ruoyi-admin.jar + +echo starting…… +echo Start %AppName% success... +goto:eof + +rem 函数stop通过jps命令查找pid并结束进程 +:stop + for /f "usebackq tokens=1-2" %%a in (`jps -l ^| findstr %AppName%`) do ( + set pid=%%a + set image_name=%%b + ) + if not defined pid (echo process %AppName% does not exists) else ( + echo prepare to kill %image_name% + echo start kill %pid% ... + rem 根据进程ID,kill进程 + taskkill /f /pid %pid% + ) +goto:eof +:restart + call :stop + call :start +goto:eof +:status + for /f "usebackq tokens=1-2" %%a in (`jps -l ^| findstr %AppName%`) do ( + set pid=%%a + set image_name=%%b + ) + if not defined pid (echo process %AppName% is dead ) else ( + echo %image_name% is running + ) +goto:eof \ No newline at end of file diff --git a/ry.sh b/ry.sh index ecf7a5f..d296c55 100644 --- a/ry.sh +++ b/ry.sh @@ -1,8 +1,12 @@ -#!/bin/bash - +#!/bin/sh +# author ruoyi +# ./ry.sh start 鍚姩 +# ./ry.sh stop 鍋滄 +# ./ry.sh restart 閲嶅惎 +# ./ry.sh start 鐘舵�� AppName=ruoyi-admin.jar -#JVM鍙傛暟 +# JVM鍙傛暟 JVM_OPTS="-Dname=$AppName -Duser.timezone=Asia/Shanghai -Xms512M -Xmx512M -XX:PermSize=256M -XX:MaxPermSize=512M -XX:+HeapDumpOnOutOfMemoryError -XX:+PrintGCDateStamps -XX:+PrintGCDetails -XX:NewRatio=1 -XX:SurvivorRatio=30 -XX:+UseParallelGC -XX:+UseParallelOldGC" APP_HOME=`pwd` LOG_PATH=$APP_HOME/logs/$AppName.log @@ -34,7 +38,7 @@ function stop() { echo "Stop $AppName" - + PID="" query(){ PID=`ps -ef |grep java|grep $AppName|grep -v grep|awk '{print $2}'` diff --git a/sql/test.sql b/sql/test.sql new file mode 100644 index 0000000..b7003ce2 --- /dev/null +++ b/sql/test.sql @@ -0,0 +1,171 @@ +DROP TABLE if EXISTS test_demo; +CREATE TABLE test_demo +( + id int(0) NOT NULL AUTO_INCREMENT COMMENT '涓婚敭', + dept_id int(0) NULL DEFAULT NULL COMMENT '閮ㄩ棬id', + user_id int(0) NULL DEFAULT NULL COMMENT '鐢ㄦ埛id', + order_num int(0) NULL DEFAULT 0 COMMENT '鎺掑簭鍙�', + test_key varchar(255) NULL DEFAULT NULL COMMENT 'key閿�', + value varchar(255) NULL DEFAULT NULL COMMENT '鍊�', + version int(0) NULL DEFAULT 0 COMMENT '鐗堟湰', + create_time datetime(0) NULL DEFAULT NULL COMMENT '鍒涘缓鏃堕棿', + create_by varchar(64) NULL DEFAULT NULL COMMENT '鍒涘缓浜�', + update_time datetime(0) NULL DEFAULT NULL COMMENT '鏇存柊鏃堕棿', + update_by varchar(64) NULL DEFAULT NULL COMMENT '鏇存柊浜�', + del_flag int(0) NULL DEFAULT NULL COMMENT '鍒犻櫎鏍囧織', + PRIMARY KEY (id) USING BTREE +) ENGINE = InnoDB COMMENT = '娴嬭瘯鍗曡〃'; + +DROP TABLE if EXISTS test_tree; +CREATE TABLE test_tree +( + id int(0) NOT NULL AUTO_INCREMENT COMMENT '涓婚敭', + parent_id int(0) NULL DEFAULT 0 COMMENT '鐖秈d', + dept_id int(0) NULL DEFAULT NULL COMMENT '閮ㄩ棬id', + user_id int(0) NULL DEFAULT NULL COMMENT '鐢ㄦ埛id', + tree_name varchar(255) NULL DEFAULT NULL COMMENT '鍊�', + version int(0) NULL DEFAULT 0 COMMENT '鐗堟湰', + create_time datetime(0) NULL DEFAULT NULL COMMENT '鍒涘缓鏃堕棿', + create_by varchar(64) NULL DEFAULT NULL COMMENT '鍒涘缓浜�', + update_time datetime(0) NULL DEFAULT NULL COMMENT '鏇存柊鏃堕棿', + update_by varchar(64) NULL DEFAULT NULL COMMENT '鏇存柊浜�', + del_flag int(0) NULL DEFAULT NULL COMMENT '鍒犻櫎鏍囧織', + PRIMARY KEY (id) USING BTREE +) ENGINE = InnoDB COMMENT = '娴嬭瘯鏍戣〃'; + +INSERT INTO sys_menu(menu_id, menu_name, parent_id, order_num, path, component, is_frame, is_cache, menu_type, visible, status, perms, icon, create_by, create_time, update_by, update_time, remark) VALUES (5, '娴嬭瘯鑿滃崟', 0, 5, 'demo', NULL, 1, 0, 'M', '0', '0', NULL, 'star', 'admin', '2021-05-30 00:34:26', NULL, NULL, ''); + +INSERT INTO sys_menu(menu_id, menu_name, parent_id, order_num, path, component, is_frame, is_cache, menu_type, visible, status, perms, icon, create_by, create_time, update_by, update_time, remark) VALUES (1500, '娴嬭瘯鍗曡〃', 5, 1, 'demo', 'demo/demo/index', 1, 0, 'C', '0', '0', 'demo:demo:list', '#', 'admin', '2021-05-30 00:39:23', '', NULL, '娴嬭瘯鍗曡〃鑿滃崟'); +INSERT INTO sys_menu(menu_id, menu_name, parent_id, order_num, path, component, is_frame, is_cache, menu_type, visible, status, perms, icon, create_by, create_time, update_by, update_time, remark) VALUES (1501, '娴嬭瘯鍗曡〃鏌ヨ', 1500, 1, '#', '', 1, 0, 'F', '0', '0', 'demo:demo:query', '#', 'admin', '2021-05-30 00:39:23', '', NULL, ''); +INSERT INTO sys_menu(menu_id, menu_name, parent_id, order_num, path, component, is_frame, is_cache, menu_type, visible, status, perms, icon, create_by, create_time, update_by, update_time, remark) VALUES (1502, '娴嬭瘯鍗曡〃鏂板', 1500, 2, '#', '', 1, 0, 'F', '0', '0', 'demo:demo:add', '#', 'admin', '2021-05-30 00:39:23', '', NULL, ''); +INSERT INTO sys_menu(menu_id, menu_name, parent_id, order_num, path, component, is_frame, is_cache, menu_type, visible, status, perms, icon, create_by, create_time, update_by, update_time, remark) VALUES (1503, '娴嬭瘯鍗曡〃淇敼', 1500, 3, '#', '', 1, 0, 'F', '0', '0', 'demo:demo:edit', '#', 'admin', '2021-05-30 00:39:23', '', NULL, ''); +INSERT INTO sys_menu(menu_id, menu_name, parent_id, order_num, path, component, is_frame, is_cache, menu_type, visible, status, perms, icon, create_by, create_time, update_by, update_time, remark) VALUES (1504, '娴嬭瘯鍗曡〃鍒犻櫎', 1500, 4, '#', '', 1, 0, 'F', '0', '0', 'demo:demo:remove', '#', 'admin', '2021-05-30 00:39:23', '', NULL, ''); +INSERT INTO sys_menu(menu_id, menu_name, parent_id, order_num, path, component, is_frame, is_cache, menu_type, visible, status, perms, icon, create_by, create_time, update_by, update_time, remark) VALUES (1505, '娴嬭瘯鍗曡〃瀵煎嚭', 1500, 5, '#', '', 1, 0, 'F', '0', '0', 'demo:demo:export', '#', 'admin', '2021-05-30 00:39:23', '', NULL, ''); + +INSERT INTO sys_menu(menu_id, menu_name, parent_id, order_num, path, component, is_frame, is_cache, menu_type, visible, status, perms, icon, create_by, create_time, update_by, update_time, remark) VALUES (1506, '娴嬭瘯鏍戣〃', 5, 1, 'tree', 'demo/tree/index', 1, 0, 'C', '0', '0', 'demo:tree:list', '#', 'admin', '2021-05-30 00:39:30', '', NULL, '娴嬭瘯鏍戣〃鑿滃崟'); +INSERT INTO sys_menu(menu_id, menu_name, parent_id, order_num, path, component, is_frame, is_cache, menu_type, visible, status, perms, icon, create_by, create_time, update_by, update_time, remark) VALUES (1507, '娴嬭瘯鏍戣〃鏌ヨ', 1506, 1, '#', '', 1, 0, 'F', '0', '0', 'demo:tree:query', '#', 'admin', '2021-05-30 00:39:30', '', NULL, ''); +INSERT INTO sys_menu(menu_id, menu_name, parent_id, order_num, path, component, is_frame, is_cache, menu_type, visible, status, perms, icon, create_by, create_time, update_by, update_time, remark) VALUES (1508, '娴嬭瘯鏍戣〃鏂板', 1506, 2, '#', '', 1, 0, 'F', '0', '0', 'demo:tree:add', '#', 'admin', '2021-05-30 00:39:30', '', NULL, ''); +INSERT INTO sys_menu(menu_id, menu_name, parent_id, order_num, path, component, is_frame, is_cache, menu_type, visible, status, perms, icon, create_by, create_time, update_by, update_time, remark) VALUES (1509, '娴嬭瘯鏍戣〃淇敼', 1506, 3, '#', '', 1, 0, 'F', '0', '0', 'demo:tree:edit', '#', 'admin', '2021-05-30 00:39:30', '', NULL, ''); +INSERT INTO sys_menu(menu_id, menu_name, parent_id, order_num, path, component, is_frame, is_cache, menu_type, visible, status, perms, icon, create_by, create_time, update_by, update_time, remark) VALUES (1510, '娴嬭瘯鏍戣〃鍒犻櫎', 1506, 4, '#', '', 1, 0, 'F', '0', '0', 'demo:tree:remove', '#', 'admin', '2021-05-30 00:39:30', '', NULL, ''); +INSERT INTO sys_menu(menu_id, menu_name, parent_id, order_num, path, component, is_frame, is_cache, menu_type, visible, status, perms, icon, create_by, create_time, update_by, update_time, remark) VALUES (1511, '娴嬭瘯鏍戣〃瀵煎嚭', 1506, 5, '#', '', 1, 0, 'F', '0', '0', 'demo:tree:export', '#', 'admin', '2021-05-30 00:39:30', '', NULL, ''); + +INSERT INTO sys_role(role_id, role_name, role_key, role_sort, data_scope, menu_check_strictly, dept_check_strictly, status, del_flag, create_by, create_time, update_by, update_time, remark) VALUES (3, '鏈儴闂ㄥ強浠ヤ笅', 'test1', 3, '4', 1, 1, '0', '0', 'admin', '2021-05-08 22:31:37', 'admin', '2021-05-08 22:32:03', NULL); +INSERT INTO sys_role(role_id, role_name, role_key, role_sort, data_scope, menu_check_strictly, dept_check_strictly, status, del_flag, create_by, create_time, update_by, update_time, remark) VALUES (4, '浠呮湰浜�', 'test2', 4, '5', 1, 1, '0', '0', 'admin', '2021-05-30 01:14:52', 'admin', '2021-05-30 01:18:38', NULL); + +INSERT INTO sys_role_menu(role_id, menu_id) VALUES (3, 1); +INSERT INTO sys_role_menu(role_id, menu_id) VALUES (3, 5); +INSERT INTO sys_role_menu(role_id, menu_id) VALUES (3, 100); +INSERT INTO sys_role_menu(role_id, menu_id) VALUES (3, 101); +INSERT INTO sys_role_menu(role_id, menu_id) VALUES (3, 102); +INSERT INTO sys_role_menu(role_id, menu_id) VALUES (3, 103); +INSERT INTO sys_role_menu(role_id, menu_id) VALUES (3, 104); +INSERT INTO sys_role_menu(role_id, menu_id) VALUES (3, 105); +INSERT INTO sys_role_menu(role_id, menu_id) VALUES (3, 106); +INSERT INTO sys_role_menu(role_id, menu_id) VALUES (3, 107); +INSERT INTO sys_role_menu(role_id, menu_id) VALUES (3, 108); +INSERT INTO sys_role_menu(role_id, menu_id) VALUES (3, 500); +INSERT INTO sys_role_menu(role_id, menu_id) VALUES (3, 501); +INSERT INTO sys_role_menu(role_id, menu_id) VALUES (3, 1001); +INSERT INTO sys_role_menu(role_id, menu_id) VALUES (3, 1002); +INSERT INTO sys_role_menu(role_id, menu_id) VALUES (3, 1003); +INSERT INTO sys_role_menu(role_id, menu_id) VALUES (3, 1004); +INSERT INTO sys_role_menu(role_id, menu_id) VALUES (3, 1005); +INSERT INTO sys_role_menu(role_id, menu_id) VALUES (3, 1006); +INSERT INTO sys_role_menu(role_id, menu_id) VALUES (3, 1007); +INSERT INTO sys_role_menu(role_id, menu_id) VALUES (3, 1008); +INSERT INTO sys_role_menu(role_id, menu_id) VALUES (3, 1009); +INSERT INTO sys_role_menu(role_id, menu_id) VALUES (3, 1010); +INSERT INTO sys_role_menu(role_id, menu_id) VALUES (3, 1011); +INSERT INTO sys_role_menu(role_id, menu_id) VALUES (3, 1012); +INSERT INTO sys_role_menu(role_id, menu_id) VALUES (3, 1013); +INSERT INTO sys_role_menu(role_id, menu_id) VALUES (3, 1014); +INSERT INTO sys_role_menu(role_id, menu_id) VALUES (3, 1015); +INSERT INTO sys_role_menu(role_id, menu_id) VALUES (3, 1016); +INSERT INTO sys_role_menu(role_id, menu_id) VALUES (3, 1017); +INSERT INTO sys_role_menu(role_id, menu_id) VALUES (3, 1018); +INSERT INTO sys_role_menu(role_id, menu_id) VALUES (3, 1019); +INSERT INTO sys_role_menu(role_id, menu_id) VALUES (3, 1020); +INSERT INTO sys_role_menu(role_id, menu_id) VALUES (3, 1021); +INSERT INTO sys_role_menu(role_id, menu_id) VALUES (3, 1022); +INSERT INTO sys_role_menu(role_id, menu_id) VALUES (3, 1023); +INSERT INTO sys_role_menu(role_id, menu_id) VALUES (3, 1024); +INSERT INTO sys_role_menu(role_id, menu_id) VALUES (3, 1025); +INSERT INTO sys_role_menu(role_id, menu_id) VALUES (3, 1026); +INSERT INTO sys_role_menu(role_id, menu_id) VALUES (3, 1027); +INSERT INTO sys_role_menu(role_id, menu_id) VALUES (3, 1028); +INSERT INTO sys_role_menu(role_id, menu_id) VALUES (3, 1029); +INSERT INTO sys_role_menu(role_id, menu_id) VALUES (3, 1030); +INSERT INTO sys_role_menu(role_id, menu_id) VALUES (3, 1031); +INSERT INTO sys_role_menu(role_id, menu_id) VALUES (3, 1032); +INSERT INTO sys_role_menu(role_id, menu_id) VALUES (3, 1033); +INSERT INTO sys_role_menu(role_id, menu_id) VALUES (3, 1034); +INSERT INTO sys_role_menu(role_id, menu_id) VALUES (3, 1035); +INSERT INTO sys_role_menu(role_id, menu_id) VALUES (3, 1036); +INSERT INTO sys_role_menu(role_id, menu_id) VALUES (3, 1037); +INSERT INTO sys_role_menu(role_id, menu_id) VALUES (3, 1038); +INSERT INTO sys_role_menu(role_id, menu_id) VALUES (3, 1039); +INSERT INTO sys_role_menu(role_id, menu_id) VALUES (3, 1040); +INSERT INTO sys_role_menu(role_id, menu_id) VALUES (3, 1041); +INSERT INTO sys_role_menu(role_id, menu_id) VALUES (3, 1042); +INSERT INTO sys_role_menu(role_id, menu_id) VALUES (3, 1043); +INSERT INTO sys_role_menu(role_id, menu_id) VALUES (3, 1044); +INSERT INTO sys_role_menu(role_id, menu_id) VALUES (3, 1045); +INSERT INTO sys_role_menu(role_id, menu_id) VALUES (3, 1500); +INSERT INTO sys_role_menu(role_id, menu_id) VALUES (3, 1501); +INSERT INTO sys_role_menu(role_id, menu_id) VALUES (3, 1502); +INSERT INTO sys_role_menu(role_id, menu_id) VALUES (3, 1503); +INSERT INTO sys_role_menu(role_id, menu_id) VALUES (3, 1504); +INSERT INTO sys_role_menu(role_id, menu_id) VALUES (3, 1505); +INSERT INTO sys_role_menu(role_id, menu_id) VALUES (3, 1506); +INSERT INTO sys_role_menu(role_id, menu_id) VALUES (3, 1507); +INSERT INTO sys_role_menu(role_id, menu_id) VALUES (3, 1508); +INSERT INTO sys_role_menu(role_id, menu_id) VALUES (3, 1509); +INSERT INTO sys_role_menu(role_id, menu_id) VALUES (3, 1510); +INSERT INTO sys_role_menu(role_id, menu_id) VALUES (3, 1511); +INSERT INTO sys_role_menu(role_id, menu_id) VALUES (4, 5); +INSERT INTO sys_role_menu(role_id, menu_id) VALUES (4, 1500); +INSERT INTO sys_role_menu(role_id, menu_id) VALUES (4, 1501); +INSERT INTO sys_role_menu(role_id, menu_id) VALUES (4, 1502); +INSERT INTO sys_role_menu(role_id, menu_id) VALUES (4, 1503); +INSERT INTO sys_role_menu(role_id, menu_id) VALUES (4, 1504); +INSERT INTO sys_role_menu(role_id, menu_id) VALUES (4, 1505); +INSERT INTO sys_role_menu(role_id, menu_id) VALUES (4, 1506); +INSERT INTO sys_role_menu(role_id, menu_id) VALUES (4, 1507); +INSERT INTO sys_role_menu(role_id, menu_id) VALUES (4, 1508); +INSERT INTO sys_role_menu(role_id, menu_id) VALUES (4, 1509); +INSERT INTO sys_role_menu(role_id, menu_id) VALUES (4, 1510); +INSERT INTO sys_role_menu(role_id, menu_id) VALUES (4, 1511); + +INSERT INTO sys_user(user_id, dept_id, user_name, nick_name, user_type, email, phonenumber, sex, avatar, password, status, del_flag, login_ip, login_date, create_by, create_time, update_by, update_time, remark) VALUES (3, 108, 'test', '鏈儴闂ㄥ強浠ヤ笅 瀵嗙爜666', '00', '', '', '0', '', '$2a$10$M6tZRpUZbWKq11O/z6YISePQc./Jhru8E18mmVJTr9aV8whzfjacC', '0', '0', '127.0.0.1', '2021-05-30 02:00:37', 'admin', '2021-04-22 09:50:41', 'test', '2021-05-30 02:00:37', NULL); +INSERT INTO sys_user(user_id, dept_id, user_name, nick_name, user_type, email, phonenumber, sex, avatar, password, status, del_flag, login_ip, login_date, create_by, create_time, update_by, update_time, remark) VALUES (4, 102, 'test1', '浠呮湰浜� 瀵嗙爜666', '00', '', '', '0', '', '$2a$10$yBSXp5Ba1m402cxXTPSy4eXUO8CXCGvXfquNVP/XMWwZ8nf9GaoMy', '0', '0', '127.0.0.1', '2021-05-30 01:48:03', 'admin', '2021-05-30 01:16:02', 'test1', '2021-05-30 01:48:03', NULL); + +INSERT INTO sys_user_role(user_id, role_id) VALUES (3, 3); +INSERT INTO sys_user_role(user_id, role_id) VALUES (4, 4); + +INSERT INTO test_demo(id, dept_id, user_id, order_num, test_key, value, version, create_time, create_by, update_time, update_by, del_flag) VALUES (1, 102, 4, 1, '娴嬭瘯鏁版嵁鏉冮檺', '娴嬭瘯', 0, '2021-06-01 10:00:00', 'admin', NULL, NULL, 0); +INSERT INTO test_demo(id, dept_id, user_id, order_num, test_key, value, version, create_time, create_by, update_time, update_by, del_flag) VALUES (2, 102, 3, 2, '瀛愯妭鐐�1', '111', 0, '2021-06-01 10:00:00', 'admin', NULL, NULL, 0); +INSERT INTO test_demo(id, dept_id, user_id, order_num, test_key, value, version, create_time, create_by, update_time, update_by, del_flag) VALUES (3, 102, 3, 3, '瀛愯妭鐐�2', '222', 0, '2021-06-01 10:00:00', 'admin', NULL, NULL, 0); +INSERT INTO test_demo(id, dept_id, user_id, order_num, test_key, value, version, create_time, create_by, update_time, update_by, del_flag) VALUES (4, 108, 4, 4, '娴嬭瘯鏁版嵁', 'demo', 0, '2021-06-01 10:00:00', 'admin', NULL, NULL, 0); +INSERT INTO test_demo(id, dept_id, user_id, order_num, test_key, value, version, create_time, create_by, update_time, update_by, del_flag) VALUES (5, 108, 3, 13, '瀛愯妭鐐�11', '1111', 0, '2021-06-01 10:00:00', 'admin', NULL, NULL, 0); +INSERT INTO test_demo(id, dept_id, user_id, order_num, test_key, value, version, create_time, create_by, update_time, update_by, del_flag) VALUES (6, 108, 3, 12, '瀛愯妭鐐�22', '2222', 0, '2021-06-01 10:00:00', 'admin', NULL, NULL, 0); +INSERT INTO test_demo(id, dept_id, user_id, order_num, test_key, value, version, create_time, create_by, update_time, update_by, del_flag) VALUES (7, 108, 3, 11, '瀛愯妭鐐�33', '3333', 0, '2021-06-01 10:00:00', 'admin', NULL, NULL, 0); +INSERT INTO test_demo(id, dept_id, user_id, order_num, test_key, value, version, create_time, create_by, update_time, update_by, del_flag) VALUES (8, 108, 3, 10, '瀛愯妭鐐�44', '4444', 0, '2021-06-01 10:00:00', 'admin', NULL, NULL, 0); +INSERT INTO test_demo(id, dept_id, user_id, order_num, test_key, value, version, create_time, create_by, update_time, update_by, del_flag) VALUES (9, 108, 3, 9, '瀛愯妭鐐�55', '5555', 0, '2021-06-01 10:00:00', 'admin', NULL, NULL, 0); +INSERT INTO test_demo(id, dept_id, user_id, order_num, test_key, value, version, create_time, create_by, update_time, update_by, del_flag) VALUES (10, 108, 3, 8, '瀛愯妭鐐�66', '6666', 0, '2021-06-01 10:00:00', 'admin', NULL, NULL, 0); +INSERT INTO test_demo(id, dept_id, user_id, order_num, test_key, value, version, create_time, create_by, update_time, update_by, del_flag) VALUES (11, 108, 3, 7, '瀛愯妭鐐�77', '7777', 0, '2021-06-01 10:00:00', 'admin', NULL, NULL, 0); +INSERT INTO test_demo(id, dept_id, user_id, order_num, test_key, value, version, create_time, create_by, update_time, update_by, del_flag) VALUES (12, 108, 3, 6, '瀛愯妭鐐�88', '8888', 0, '2021-06-01 10:00:00', 'admin', NULL, NULL, 0); +INSERT INTO test_demo(id, dept_id, user_id, order_num, test_key, value, version, create_time, create_by, update_time, update_by, del_flag) VALUES (13, 108, 3, 5, '瀛愯妭鐐�99', '9999', 0, '2021-06-01 10:00:00', 'admin', NULL, NULL, 0); + +INSERT INTO test_tree(id, parent_id, dept_id, user_id, tree_name, version, create_time, create_by, update_time, update_by, del_flag) VALUES (1, 0, 102, 4, '娴嬭瘯鏁版嵁鏉冮檺', 0, '2021-06-01 10:00:00', 'admin', NULL, NULL, 0); +INSERT INTO test_tree(id, parent_id, dept_id, user_id, tree_name, version, create_time, create_by, update_time, update_by, del_flag) VALUES (2, 1, 102, 3, '瀛愯妭鐐�1', 0, '2021-06-01 10:00:00', 'admin', NULL, NULL, 0); +INSERT INTO test_tree(id, parent_id, dept_id, user_id, tree_name, version, create_time, create_by, update_time, update_by, del_flag) VALUES (3, 2, 102, 3, '瀛愯妭鐐�2', 0, '2021-06-01 10:00:00', 'admin', NULL, NULL, 0); +INSERT INTO test_tree(id, parent_id, dept_id, user_id, tree_name, version, create_time, create_by, update_time, update_by, del_flag) VALUES (4, 0, 108, 4, '娴嬭瘯鏍�1', 0, '2021-06-01 10:00:00', 'admin', NULL, NULL, 0); +INSERT INTO test_tree(id, parent_id, dept_id, user_id, tree_name, version, create_time, create_by, update_time, update_by, del_flag) VALUES (5, 4, 108, 3, '瀛愯妭鐐�11', 0, '2021-06-01 10:00:00', 'admin', NULL, NULL, 0); +INSERT INTO test_tree(id, parent_id, dept_id, user_id, tree_name, version, create_time, create_by, update_time, update_by, del_flag) VALUES (6, 4, 108, 3, '瀛愯妭鐐�22', 0, '2021-06-01 10:00:00', 'admin', NULL, NULL, 0); +INSERT INTO test_tree(id, parent_id, dept_id, user_id, tree_name, version, create_time, create_by, update_time, update_by, del_flag) VALUES (7, 4, 108, 3, '瀛愯妭鐐�33', 0, '2021-06-01 10:00:00', 'admin', NULL, NULL, 0); +INSERT INTO test_tree(id, parent_id, dept_id, user_id, tree_name, version, create_time, create_by, update_time, update_by, del_flag) VALUES (8, 5, 108, 3, '瀛愯妭鐐�44', 0, '2021-06-01 10:00:00', 'admin', NULL, NULL, 0); +INSERT INTO test_tree(id, parent_id, dept_id, user_id, tree_name, version, create_time, create_by, update_time, update_by, del_flag) VALUES (9, 6, 108, 3, '瀛愯妭鐐�55', 0, '2021-06-01 10:00:00', 'admin', NULL, NULL, 0); +INSERT INTO test_tree(id, parent_id, dept_id, user_id, tree_name, version, create_time, create_by, update_time, update_by, del_flag) VALUES (10, 7, 108, 3, '瀛愯妭鐐�66', 0, '2021-06-01 10:00:00', 'admin', NULL, NULL, 0); +INSERT INTO test_tree(id, parent_id, dept_id, user_id, tree_name, version, create_time, create_by, update_time, update_by, del_flag) VALUES (11, 7, 108, 3, '瀛愯妭鐐�77', 0, '2021-06-01 10:00:00', 'admin', NULL, NULL, 0); +INSERT INTO test_tree(id, parent_id, dept_id, user_id, tree_name, version, create_time, create_by, update_time, update_by, del_flag) VALUES (12, 10, 108, 3, '瀛愯妭鐐�88', 0, '2021-06-01 10:00:00', 'admin', NULL, NULL, 0); +INSERT INTO test_tree(id, parent_id, dept_id, user_id, tree_name, version, create_time, create_by, update_time, update_by, del_flag) VALUES (13, 10, 108, 3, '瀛愯妭鐐�99', 0, '2021-06-01 10:00:00', 'admin', NULL, NULL, 0); -- Gitblit v1.9.3