From 83718c61cdd544f0a0190efa775ba7aeb08fedb0 Mon Sep 17 00:00:00 2001 From: 疯狂的狮子li <15040126243@163.com> Date: 星期五, 11 六月 2021 09:29:21 +0800 Subject: [PATCH] 发布 v2.3.2 --- ruoyi-framework/src/main/java/com/ruoyi/framework/aspectj/RedisLockAspect.java | 37 -- ruoyi-ui/src/views/monitor/online/index.vue | 2 ruoyi-common/src/main/java/com/ruoyi/common/core/page/PagePlus.java | 7 ruoyi-ui/src/views/monitor/job/log.vue | 6 ruoyi-ui/src/views/tool/gen/index.vue | 4 ruoyi-ui/src/components/Editor/index.vue | 2 ruoyi-ui/src/views/index.vue | 11 + ruoyi-ui/src/views/system/role/index.vue | 4 ruoyi-ui/src/views/system/menu/index.vue | 4 ruoyi-ui/src/views/system/user/index.vue | 4 pom.xml | 35 +-- ruoyi-demo/src/main/java/com/ruoyi/demo/mapper/TestDemoMapper.java | 5 ruoyi-ui/src/views/system/dict/index.vue | 4 ruoyi-framework/src/main/java/com/ruoyi/framework/config/properties/TokenProperties.java | 5 ruoyi-ui/package.json | 2 ruoyi-framework/src/main/java/com/ruoyi/framework/config/properties/XssProperties.java | 2 ruoyi-generator/src/main/resources/vm/java/controller.java.vm | 5 ruoyi-framework/src/main/java/com/ruoyi/framework/config/properties/SwaggerProperties.java | 2 ruoyi-framework/src/main/java/com/ruoyi/framework/config/AsyncConfig.java | 5 ruoyi-common/src/main/java/com/ruoyi/common/core/domain/entity/SysRole.java | 6 ruoyi-ui/src/views/monitor/logininfor/index.vue | 6 ruoyi-ui/src/views/system/post/index.vue | 4 ruoyi-ui/src/views/system/dict/data.vue | 4 ruoyi-ui/src/views/system/notice/index.vue | 2 ruoyi-framework/src/main/java/com/ruoyi/framework/config/properties/ThreadPoolProperties.java | 2 ruoyi-generator/src/main/resources/vm/vue/index.vue.vm | 4 ruoyi-ui/src/views/system/dept/index.vue | 20 ruoyi-admin/src/main/resources/application.yml | 2 ruoyi-common/src/main/java/com/ruoyi/common/core/mybatisplus/MybatisPlusRedisCache.java | 102 +++++++++ ruoyi-demo/src/main/java/com/ruoyi/demo/controller/RedisLockController.java | 44 +++ ruoyi-common/pom.xml | 5 ruoyi-ui/src/views/monitor/job/index.vue | 6 ruoyi-ui/src/views/monitor/operlog/index.vue | 6 README.md | 37 -- ruoyi-generator/src/main/resources/vm/java/mapper.java.vm | 3 ruoyi-ui/src/layout/components/Navbar.vue | 4 ruoyi-ui/src/views/system/config/index.vue | 4 ruoyi-ui/src/utils/request.js | 2 /dev/null | 0 ruoyi-generator/src/main/resources/vm/vue/index-tree.vue.vm | 2 ruoyi-framework/src/main/java/com/ruoyi/framework/config/SwaggerConfig.java | 11 ruoyi-framework/src/main/java/com/ruoyi/framework/config/RedisConfig.java | 16 + ruoyi-framework/src/main/java/com/ruoyi/framework/config/ResourcesConfig.java | 7 ruoyi-demo/src/main/java/com/ruoyi/demo/mapper/TestTreeMapper.java | 5 ruoyi-common/src/main/java/com/ruoyi/common/core/redis/RedisLockManager.java | 170 +++++++++++++++ 45 files changed, 457 insertions(+), 163 deletions(-) diff --git a/README.md b/README.md index b877e68..312f3e1 100644 --- a/README.md +++ b/README.md @@ -18,6 +18,9 @@ * 鏂囨。妗嗘灦 knife4j 缇庡寲鎺ュ彛鏂囨。 * 浠g爜鐢熸垚鍣� 涓�閿敓鎴愬墠鍚庣浠g爜 +## 鍙傝�冩枃妗� +[鍙傝�冩枃妗� Wiki](https://gitee.com/JavaLionLi/RuoYi-Vue-Plus/wikis/pages) + ## 淇敼RuoYi鍔熻兘 ### 渚濊禆鏀瑰姩 @@ -43,6 +46,8 @@ * 椤圭洰淇敼涓� maven澶氱幆澧冮厤缃� * 椤圭洰閰嶇疆淇敼涓� application.yml 缁熶竴绠$悊 * 鏁版嵁鏉冮檺淇敼涓� 閫傞厤鏀寔鍗曡〃銆佸琛� +* 浣跨敤 redisson 瀹炵幇 spring-cache 鏁村悎 +* 澧炲姞 mybatis-plus 浜岀骇缂撳瓨 redis 瀛樺偍 ### 鍏朵粬 @@ -58,38 +63,6 @@ 浣滆�呬负鍏艰亴鍋氬紑婧�,骞虫椂杩橀渶瑕佸伐浣�,濡傛灉甯埌浜嗘偍鍙互璇蜂綔鑰呭悆涓洅楗� <img src="https://images.gitee.com/uploads/images/2021/0525/101654_451e4523_1766278.jpeg" width="300px" height="450px" /> <img src="https://images.gitee.com/uploads/images/2021/0525/101713_3d18b119_1766278.jpeg" width="300px" height="450px" /> - -## 閲嶇偣娉ㄦ剰浜嬮」 - -鑻ヤ緷鏂囨。瀵逛簨鍔℃敞瑙g殑鎻忚堪 [鍏充簬浜嬪姟](https://doc.ruoyi.vip/ruoyi/document/htsc.html#%E4%BA%8B%E5%8A%A1%E7%AE%A1%E7%90%86) 浠ヤ笅瀵瑰鏁版嵁婧愪簨鍔″仛琛ュ厖: -* 鍚屼竴涓簨鍔′笅鏄棤娉曞垏鎹㈡暟鎹簮鐨� -* 绂佹 鐖舵柟娉曚娇鐢� @Transactional 鍒涘缓浜嬪姟 瀛愭柟娉曚娇鐢� @DataSource 鍒囨崲鏁版嵁婧� -* 姝g‘鐢ㄦ硶: 瀛愭柟娉曞崟鐙垱寤轰簨鍔� 鎴� 鐖舵柟娉曚娇鐢� @Transactional(propagation = Propagation.REQUIRES_NEW) 涓烘墍鏈夊瓙鏂规硶鍒涘缓鏂颁簨鍔� - -鍏充簬濡備綍浣跨敤Tomcat -* 鏌ョ湅ruoyi-framework妯″潡鐨刾om.xml鏂囦欢,鏍规嵁娉ㄩ噴鏇存敼渚濊禆 -* 鏌ョ湅ruoyi-admin妯″潡涓殑application.yml鏂囦欢,鏍规嵁娉ㄩ噴鏇存敼閰嶇疆 - -鍏充簬濡備綍鍒涘缓鏂版ā鍧� -* 鍙傝�價uoyi-demo妯″潡 -* 闇�瑕佹敼鍔�: 鐖秔om 涓� admin妯″潡pom - -鍏充簬鏍戣〃鐢熸垚 -* 鐩存帴鍦╩ysql琛ㄤ腑 娣诲姞 parentId orderNum 绛夊瓧娈�(鏍规嵁闇�瑕佸弬鑰� TreeEntity绫�) -* 浠g爜鐢熸垚閫夋嫨鏍戣〃鐢熸垚鍗冲彲 - -鍏充簬鏁版嵁鏉冮檺 -* 鍒涘缓琛� 闇�棰勭暀 dept_id 瀛楁 濡傞渶鐢ㄦ埛鏉冮檺 杩橀渶棰勭暀 user_id 瀛楁 -* 鏀寔 Mybatis-Plus 鏂瑰紡娉ㄥ叆 鍙傝�� demo 妯″潡鐢ㄦ硶(闇�瀵煎叆 test.sql 鏂囦欢) -* 鏀寔 XML 鏂瑰紡娉ㄥ叆 鍙傝�� system 妯″潡鐢ㄦ硶 - -鍏充簬vue涓巄oot鏁村悎閮ㄧ讲 -* [鍓嶇闈欐�佽祫婧愬浣曟暣鍚堝埌鍚庣璁块棶](https://doc.ruoyi.vip/ruoyi-vue/other/faq.html#鍓嶇闈欐�佽祫婧愬浣曟暣鍚堝埌鍚庣璁块棶) - -鍏充簬淇敼鍖呭悕 -* 灏嗘枃浠跺す鍏ㄩ儴淇敼涓� com.xxx -* 浣跨敤IDEA鍏ㄥ眬鏇挎崲 com.ruoyi 鏇挎崲涓� com.xxx -* 涓ョ鎵嬪姩淇敼 ## 鍐呯疆鍔熻兘 diff --git a/pom.xml b/pom.xml index f50e460..4a73f1e 100644 --- a/pom.xml +++ b/pom.xml @@ -13,7 +13,7 @@ <description>RuoYi-Vue-Plus鍚庡彴绠$悊绯荤粺</description> <properties> - <ruoyi-vue-plus.version>2.3.1</ruoyi-vue-plus.version> + <ruoyi-vue-plus.version>2.3.2</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> @@ -21,7 +21,6 @@ <maven-jar-plugin.version>3.1.1</maven-jar-plugin.version> <druid.version>1.2.6</druid.version> <knife4j.version>3.0.2</knife4j.version> - <swagger-annotations.version>1.5.22</swagger-annotations.version> <fastjson.version>1.2.76</fastjson.version> <poi.version>4.1.2</poi.version> <velocity.version>1.7</velocity.version> @@ -47,7 +46,7 @@ <scope>import</scope> </dependency> - <!--闃块噷鏁版嵁搴撹繛鎺ユ睜 --> + <!-- 闃块噷鏁版嵁搴撹繛鎺ユ睜 --> <dependency> <groupId>com.alibaba</groupId> <artifactId>druid-spring-boot-starter</artifactId> @@ -58,18 +57,6 @@ <groupId>com.github.xiaoymin</groupId> <artifactId>knife4j-spring-boot-starter</artifactId> <version>${knife4j.version}</version> - <exclusions> - <exclusion> - <artifactId>swagger-annotations</artifactId> - <groupId>io.swagger</groupId> - </exclusion> - </exclusions> - </dependency> - - <dependency> - <groupId>io.swagger</groupId> - <artifactId>swagger-annotations</artifactId> - <version>${swagger-annotations.version}</version> </dependency> <!-- excel宸ュ叿 --> @@ -79,7 +66,7 @@ <version>${poi.version}</version> </dependency> - <!--velocity浠g爜鐢熸垚浣跨敤妯℃澘 --> + <!-- velocity浠g爜鐢熸垚浣跨敤妯℃澘 --> <dependency> <groupId>org.apache.velocity</groupId> <artifactId>velocity</artifactId> @@ -93,7 +80,7 @@ <version>${fastjson.version}</version> </dependency> - <!--Token鐢熸垚涓庤В鏋�--> + <!-- Token鐢熸垚涓庤В鏋�--> <dependency> <groupId>io.jsonwebtoken</groupId> <artifactId>jjwt</artifactId> @@ -139,6 +126,13 @@ <version>${spring-boot-admin.version}</version> </dependency> + <!--redisson--> + <dependency> + <groupId>org.redisson</groupId> + <artifactId>redisson-spring-boot-starter</artifactId> + <version>${redisson.version}</version> + </dependency> + <!-- 瀹氭椂浠诲姟--> <dependency> <groupId>com.ruoyi</groupId> @@ -179,13 +173,6 @@ <groupId>com.ruoyi</groupId> <artifactId>ruoyi-demo</artifactId> <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> diff --git a/ruoyi-admin/src/main/resources/application.yml b/ruoyi-admin/src/main/resources/application.yml index 3ea04c7..476a933 100644 --- a/ruoyi-admin/src/main/resources/application.yml +++ b/ruoyi-admin/src/main/resources/application.yml @@ -288,8 +288,6 @@ url: http://localhost:${server.port}${spring.boot.admin.context-path} instance: prefer-ip: true # 娉ㄥ唽瀹炰緥鏃讹紝浼樺厛浣跨敤 IP - # username: ruoyi - # password: 123456 # Spring Boot Admin Server 鏈嶅姟绔殑鐩稿叧閰嶇疆 context-path: /admin # 閰嶇疆 Spring diff --git a/ruoyi-admin/src/main/resources/mybatis/mybatis-config.xml b/ruoyi-admin/src/main/resources/mybatis/mybatis-config.xml deleted file mode 100644 index e69de29..0000000 --- a/ruoyi-admin/src/main/resources/mybatis/mybatis-config.xml +++ /dev/null diff --git a/ruoyi-common/pom.xml b/ruoyi-common/pom.xml index 2c75fcd..c6275c2 100644 --- a/ruoyi-common/pom.xml +++ b/ruoyi-common/pom.xml @@ -137,11 +137,6 @@ </dependency> <dependency> - <groupId>io.swagger</groupId> - <artifactId>swagger-annotations</artifactId> - </dependency> - - <dependency> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-starter-actuator</artifactId> </dependency> diff --git a/ruoyi-common/src/main/java/com/ruoyi/common/core/domain/entity/SysRole.java b/ruoyi-common/src/main/java/com/ruoyi/common/core/domain/entity/SysRole.java index 6cbd22a..a658559 100644 --- a/ruoyi-common/src/main/java/com/ruoyi/common/core/domain/entity/SysRole.java +++ b/ruoyi-common/src/main/java/com/ruoyi/common/core/domain/entity/SysRole.java @@ -17,7 +17,7 @@ /** * 瑙掕壊琛� sys_role - * + * * @author ruoyi */ @@ -51,8 +51,8 @@ @NotBlank(message = "鏄剧ず椤哄簭涓嶈兘涓虹┖") private String roleSort; - /** 鏁版嵁鑼冨洿锛�1锛氭墍鏈夋暟鎹潈闄愶紱2锛氳嚜瀹氫箟鏁版嵁鏉冮檺锛�3锛氭湰閮ㄩ棬鏁版嵁鏉冮檺锛�4锛氭湰閮ㄩ棬鍙婁互涓嬫暟鎹潈闄愶級 */ - @Excel(name = "鏁版嵁鑼冨洿", readConverterExp = "1=鎵�鏈夋暟鎹潈闄�,2=鑷畾涔夋暟鎹潈闄�,3=鏈儴闂ㄦ暟鎹潈闄�,4=鏈儴闂ㄥ強浠ヤ笅鏁版嵁鏉冮檺") + /** 鏁版嵁鑼冨洿锛�1锛氭墍鏈夋暟鎹潈闄愶紱2锛氳嚜瀹氫箟鏁版嵁鏉冮檺锛�3锛氭湰閮ㄩ棬鏁版嵁鏉冮檺锛�4锛氭湰閮ㄩ棬鍙婁互涓嬫暟鎹潈闄愶紱5锛氫粎鏈汉鏁版嵁鏉冮檺锛� */ + @Excel(name = "鏁版嵁鑼冨洿", readConverterExp = "1=鎵�鏈夋暟鎹潈闄�,2=鑷畾涔夋暟鎹潈闄�,3=鏈儴闂ㄦ暟鎹潈闄�,4=鏈儴闂ㄥ強浠ヤ笅鏁版嵁鏉冮檺,5=浠呮湰浜烘暟鎹潈闄�") private String dataScope; /** 鑿滃崟鏍戦�夋嫨椤规槸鍚﹀叧鑱旀樉绀猴紙 0锛氱埗瀛愪笉浜掔浉鍏宠仈鏄剧ず 1锛氱埗瀛愪簰鐩稿叧鑱旀樉绀猴級 */ diff --git a/ruoyi-common/src/main/java/com/ruoyi/common/core/mybatisplus/MybatisPlusRedisCache.java b/ruoyi-common/src/main/java/com/ruoyi/common/core/mybatisplus/MybatisPlusRedisCache.java new file mode 100644 index 0000000..6ff6a98 --- /dev/null +++ b/ruoyi-common/src/main/java/com/ruoyi/common/core/mybatisplus/MybatisPlusRedisCache.java @@ -0,0 +1,102 @@ +package com.ruoyi.common.core.mybatisplus; + +import cn.hutool.extra.spring.SpringUtil; +import com.ruoyi.common.core.redis.RedisCache; +import lombok.extern.slf4j.Slf4j; +import org.apache.ibatis.cache.Cache; +import org.springframework.data.redis.connection.RedisServerCommands; +import org.springframework.data.redis.core.RedisTemplate; +import org.springframework.util.CollectionUtils; + +import java.util.Collection; +import java.util.concurrent.locks.ReadWriteLock; +import java.util.concurrent.locks.ReentrantReadWriteLock; + +/** + * mybatis-redis 浜岀骇缂撳瓨 + * + * @author Lion Li + */ +@Slf4j +public class MybatisPlusRedisCache implements Cache { + + private final ReadWriteLock readWriteLock = new ReentrantReadWriteLock(true); + + private RedisCache redisCache; + + private String id; + + public MybatisPlusRedisCache(final String id) { + if (id == null) { + throw new IllegalArgumentException("Cache instances require an ID"); + } + this.id = id; + } + + @Override + public String getId() { + return this.id; + } + + @Override + public void putObject(Object key, Object value) { + if (redisCache == null) { + redisCache = SpringUtil.getBean(RedisCache.class); + } + if (value != null) { + redisCache.setCacheObject(key.toString(), value); + } + } + + @Override + public Object getObject(Object key) { + if (redisCache == null) { + //鐢变簬鍚姩鏈熼棿娉ㄥ叆澶辫触锛屽彧鑳借繍琛屾湡闂存敞鍏ワ紝杩欐浠g爜鍙互鍒犻櫎 + redisCache = SpringUtil.getBean(RedisCache.class); + } + try { + if (key != null) { + return redisCache.getCacheObject(key.toString()); + } + } catch (Exception e) { + e.printStackTrace(); + log.error("缂撳瓨鍑洪敊"); + } + return null; + } + + @Override + public Object removeObject(Object key) { + if (redisCache == null) { + redisCache = SpringUtil.getBean(RedisCache.class); + } + if (key != null) { + redisCache.deleteObject(key.toString()); + } + return null; + } + + @Override + public void clear() { + log.debug("娓呯┖缂撳瓨"); + if (redisCache == null) { + redisCache = SpringUtil.getBean(RedisCache.class); + } + Collection<String> keys = redisCache.keys("*:" + this.id + "*"); + if (!CollectionUtils.isEmpty(keys)) { + redisCache.deleteObject(keys); + } + } + + @Override + public int getSize() { + RedisTemplate<String, Object> redisTemplate = SpringUtil.getBean("redisTemplate"); + Long size = redisTemplate.execute(RedisServerCommands::dbSize); + return size.intValue(); + } + + @Override + public ReadWriteLock getReadWriteLock() { + return this.readWriteLock; + } +} diff --git a/ruoyi-common/src/main/java/com/ruoyi/common/core/page/PagePlus.java b/ruoyi-common/src/main/java/com/ruoyi/common/core/page/PagePlus.java index 812a683..79d889c 100644 --- a/ruoyi-common/src/main/java/com/ruoyi/common/core/page/PagePlus.java +++ b/ruoyi-common/src/main/java/com/ruoyi/common/core/page/PagePlus.java @@ -10,6 +10,13 @@ import java.util.Collections; import java.util.List; +/** + * 鍒嗛〉 Page 澧炲己瀵硅薄 + * + * @param <T> 鏁版嵁搴撳疄浣� + * @param <K> vo瀹炰綋 + * @author Lion Li + */ @Data @Accessors(chain = true) public class PagePlus<T,K> implements IPage<T> { diff --git a/ruoyi-common/src/main/java/com/ruoyi/common/core/redis/RedisLockManager.java b/ruoyi-common/src/main/java/com/ruoyi/common/core/redis/RedisLockManager.java new file mode 100644 index 0000000..0688bb1 --- /dev/null +++ b/ruoyi-common/src/main/java/com/ruoyi/common/core/redis/RedisLockManager.java @@ -0,0 +1,170 @@ +package com.ruoyi.common.core.redis; + +import cn.hutool.core.lang.Assert; +import cn.hutool.core.lang.Validator; +import cn.hutool.core.util.StrUtil; +import org.redisson.api.RCountDownLatch; +import org.redisson.api.RLock; +import org.redisson.api.RedissonClient; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Component; + +import java.util.concurrent.TimeUnit; + +/** + * redis 閿佺鐞嗙被 + * + * @author shenxinquan + */ +@Component +public class RedisLockManager { + + @Autowired + private RedissonClient redissonClient; + + /** + * 閫氱敤閿� + */ + private final static Integer BASE_LOCK = 1; + + /** + * 鍏钩閿� + */ + private final static Integer FAIR_LOCK = 2; + + /** + * 瀛樻斁褰撳墠绾跨▼鑾峰彇閿佺殑绫诲瀷 + */ + private final ThreadLocal<Integer> threadLocal = new ThreadLocal<>(); + + /** + * 鑾峰彇閿� + */ + private RLock getLock(String key, Integer lockType) { + Assert.isTrue(StrUtil.isNotBlank(key), "key涓嶈兘涓虹┖"); + threadLocal.set(lockType); + RLock lock; + if (BASE_LOCK.equals(lockType)) { + lock = redissonClient.getLock(key); + } else if (FAIR_LOCK.equals(lockType)) { + lock = redissonClient.getFairLock(key); + } else { + throw new RuntimeException("閿佷笉瀛樺湪!"); + } + return lock; + } + + /** + * 鑾峰彇閿侊紙涓嶇敤璁剧疆瓒呮椂鏃堕棿锛屼竴鐩寸瓑寰咃級 + */ + public boolean getLock(String key) { + RLock lock = getLock(key, BASE_LOCK); + return lock.tryLock(); + } + + /** + * 璁剧疆杩囨湡鏃堕棿 + * + * @param key + * @param time 杩囨湡鏃堕棿 + * @param expireUnit 鏃堕棿鍗曚綅 + */ + public boolean getLock(String key, long time, TimeUnit expireUnit) { + Assert.isTrue(time > 0, "杩囨湡鏃堕棿蹇呴』澶т簬0"); + Assert.isTrue(Validator.isNotEmpty(expireUnit), "鏃堕棿鍗曚綅涓嶈兘涓虹┖"); + RLock lock = getLock(key, BASE_LOCK); + try { + return lock.tryLock(time, expireUnit); + } catch (InterruptedException e) { + e.printStackTrace(); + return false; + } + } + + /** + * 璁剧疆杩囨湡鏃堕棿 + * + * @param key + * @param waitTime 鑾峰彇閿佺瓑寰呮椂闂� + * @param leaseTime 淇濈暀閿佺殑鏃堕棿 + * @param expireUnit 鏃堕棿鍗曚綅 + */ + public boolean getLock(String key, long waitTime, long leaseTime, TimeUnit expireUnit) { + Assert.isTrue(waitTime > 0, "鑾峰彇閿佺瓑寰呮椂闂村繀椤诲ぇ浜�0"); + Assert.isTrue(leaseTime > 0, "淇濈暀閿佺殑鏃堕棿蹇呴』澶т簬0"); + Assert.isTrue(Validator.isNotEmpty(expireUnit), "鏃堕棿鍗曚綅涓嶈兘涓虹┖"); + RLock lock = getLock(key, BASE_LOCK); + try { + return lock.tryLock(waitTime, leaseTime, expireUnit); + } catch (InterruptedException e) { + e.printStackTrace(); + return false; + } + } + + + /** + * 鑾峰彇璁℃暟鍣ㄩ攣 + * + * @param key + * @param count countDownLatch 鐨勬暟閲� + */ + public RCountDownLatch getCountDownLatch(String key, long count) { + Assert.isTrue(count >= 0, "count鏁伴噺蹇呴』澶т簬绛変簬0"); + RCountDownLatch rCountDownLatch = redissonClient.getCountDownLatch(key); + rCountDownLatch.trySetCount(count); + return rCountDownLatch; + } + + /** + * 鑾峰彇鍏钩閿� + * + * @param key + * @param waitTime 鑾峰彇閿佺瓑寰呮椂闂� + * @param leaseTime 鎸佹湁閿佺殑鏃堕棿 + * @param expireUnit 鏃堕棿鍗曚綅 + * @return + * @throws InterruptedException + */ + public boolean getFairLock(String key, long waitTime, long leaseTime, TimeUnit expireUnit) { + Assert.isTrue(waitTime > 0, "鑾峰彇閿佺瓑寰呮椂闂村繀椤诲ぇ浜�0"); + Assert.isTrue(leaseTime > 0, "淇濈暀閿佺殑鏃堕棿蹇呴』澶т簬0"); + Assert.isTrue(Validator.isNotEmpty(expireUnit), "鏃堕棿鍗曚綅涓嶈兘涓虹┖"); + RLock lock = getLock(key, FAIR_LOCK); + try { + return lock.tryLock(waitTime, leaseTime, expireUnit); + } catch (InterruptedException e) { + e.printStackTrace(); + return false; + } + } + + /** + * 鑾峰彇鍏钩閿� + * + * @param key + * @param leaseTime 鎸佹湁閿佺殑鏃堕棿 + * @param expireUnit 鏃堕棿鍗曚綅 + */ + public boolean getFairLock(String key, long leaseTime, TimeUnit expireUnit) { + Assert.isTrue(leaseTime > 0, "淇濈暀閿佺殑鏃堕棿蹇呴』澶т簬0"); + Assert.isTrue(Validator.isNotEmpty(expireUnit), "鏃堕棿鍗曚綅涓嶈兘涓虹┖"); + RLock lock = getLock(key, FAIR_LOCK); + try { + return lock.tryLock(leaseTime, expireUnit); + } catch (InterruptedException e) { + e.printStackTrace(); + return false; + } + } + + /** + * 閲婃斁閿�(缁熶竴閲婃斁) + */ + public void unLock(String key) { + Integer lockType = threadLocal.get(); + RLock lock = getLock(key, lockType); + lock.unlock(); + threadLocal.remove(); + } +} diff --git a/ruoyi-demo/src/main/java/com/ruoyi/demo/controller/RedisLockController.java b/ruoyi-demo/src/main/java/com/ruoyi/demo/controller/RedisLockController.java index 7792784..c3c71ef 100644 --- a/ruoyi-demo/src/main/java/com/ruoyi/demo/controller/RedisLockController.java +++ b/ruoyi-demo/src/main/java/com/ruoyi/demo/controller/RedisLockController.java @@ -2,9 +2,15 @@ import com.ruoyi.common.annotation.RedisLock; import com.ruoyi.common.core.domain.AjaxResult; +import com.ruoyi.common.core.redis.RedisLockManager; +import lombok.extern.slf4j.Slf4j; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.cache.annotation.Cacheable; import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RestController; + +import java.util.concurrent.TimeUnit; /** @@ -12,16 +18,20 @@ * * @author shenxinquan */ +@Slf4j @RestController @RequestMapping("/demo/redisLock") public class RedisLockController { + @Autowired + private RedisLockManager redisLockManager; + /** * #p0 鏍囪瘑鍙栫涓�涓弬鏁颁负redis閿佺殑key */ - @GetMapping("/getLock") + @GetMapping("/testLock1") @RedisLock(expireTime = 10, key = "#p0") - public AjaxResult<String> getLock(String key, String value) { + public AjaxResult<String> testLock1(String key, String value) { try { // 鍚屾椂璇锋眰鎺掗槦 // Thread.sleep(5000); @@ -32,4 +42,34 @@ } return AjaxResult.success("鎿嶄綔鎴愬姛",value); } + + /** + * 娴嬭瘯閿佸伐鍏风被 + */ + @GetMapping("/testLock2") + public AjaxResult<Void> testLock(String key, Long time) { + try { + boolean flag = redisLockManager.getLock(key, time, TimeUnit.SECONDS); + if (flag) { + log.info("鑾峰彇閿佹垚鍔�: " + key); + Thread.sleep(3000); + redisLockManager.unLock(key); + log.info("閲婃斁閿佹垚鍔�: " + key); + } else { + log.error("鑾峰彇閿佸け璐�: " + key); + } + } catch (InterruptedException e) { + log.error(e.getMessage()); + } + return AjaxResult.success(); + } + + /** + * 娴嬭瘯spring-cache娉ㄨВ + */ + @Cacheable(value = "test", key = "#key") + @GetMapping("/testCache") + public AjaxResult<String> testCache(String key) { + return AjaxResult.success("鎿嶄綔鎴愬姛", key); + } } 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 index 2416f0e..5cfb9f6 100644 --- a/ruoyi-demo/src/main/java/com/ruoyi/demo/mapper/TestDemoMapper.java +++ b/ruoyi-demo/src/main/java/com/ruoyi/demo/mapper/TestDemoMapper.java @@ -1,7 +1,9 @@ package com.ruoyi.demo.mapper; -import com.ruoyi.demo.domain.TestDemo; +import com.ruoyi.common.core.mybatisplus.MybatisPlusRedisCache; import com.ruoyi.common.core.page.BaseMapperPlus; +import com.ruoyi.demo.domain.TestDemo; +import org.apache.ibatis.annotations.CacheNamespace; /** * 娴嬭瘯鍗曡〃Mapper鎺ュ彛 @@ -9,6 +11,7 @@ * @author Lion Li * @date 2021-05-30 */ +@CacheNamespace(implementation = MybatisPlusRedisCache.class, eviction = MybatisPlusRedisCache.class) 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 index 6dd75c5..0635ebc 100644 --- a/ruoyi-demo/src/main/java/com/ruoyi/demo/mapper/TestTreeMapper.java +++ b/ruoyi-demo/src/main/java/com/ruoyi/demo/mapper/TestTreeMapper.java @@ -1,7 +1,9 @@ package com.ruoyi.demo.mapper; -import com.ruoyi.demo.domain.TestTree; +import com.ruoyi.common.core.mybatisplus.MybatisPlusRedisCache; import com.ruoyi.common.core.page.BaseMapperPlus; +import com.ruoyi.demo.domain.TestTree; +import org.apache.ibatis.annotations.CacheNamespace; /** * 娴嬭瘯鏍戣〃Mapper鎺ュ彛 @@ -9,6 +11,7 @@ * @author Lion Li * @date 2021-05-30 */ +@CacheNamespace(implementation = MybatisPlusRedisCache.class, eviction = MybatisPlusRedisCache.class) public interface TestTreeMapper extends BaseMapperPlus<TestTree> { } diff --git a/ruoyi-framework/src/main/java/com/ruoyi/framework/aspectj/RedisLockAspect.java b/ruoyi-framework/src/main/java/com/ruoyi/framework/aspectj/RedisLockAspect.java index 0af3844..d81c3ca 100644 --- a/ruoyi-framework/src/main/java/com/ruoyi/framework/aspectj/RedisLockAspect.java +++ b/ruoyi-framework/src/main/java/com/ruoyi/framework/aspectj/RedisLockAspect.java @@ -3,6 +3,7 @@ import com.ruoyi.common.annotation.RedisLock; import com.ruoyi.common.constant.Constants; +import com.ruoyi.common.core.redis.RedisLockManager; import lombok.extern.slf4j.Slf4j; import org.aspectj.lang.ProceedingJoinPoint; import org.aspectj.lang.annotation.Around; @@ -33,7 +34,7 @@ public class RedisLockAspect { @Autowired - private RedissonClient redissonClient; + private RedisLockManager redisLockManager; @Pointcut("@annotation(com.ruoyi.common.annotation.RedisLock)") public void annotationPointcut() { @@ -70,14 +71,16 @@ key = Constants.REDIS_LOCK_KEY + key; Object res; try { - if (acquire(key, expireTime, TimeUnit.SECONDS)) { + if (redisLockManager.getLock(key, expireTime, TimeUnit.SECONDS)) { + log.info("lock => key : " + key + " , ThreadName : " + Thread.currentThread().getName()); try { res = joinPoint.proceed(); return res; } catch (Exception e) { throw new RuntimeException(e); } finally { - release(key); + redisLockManager.unLock(key); + log.info("unlock => key : " + key + " , ThreadName : " + Thread.currentThread().getName()); } } else { throw new RuntimeException("redis鍒嗗竷寮忛攣娉ㄨВ鍙傛暟寮傚父"); @@ -131,34 +134,6 @@ } } return listPar; - } - - /** - * 鍔犻攣锛圧Lock锛夊甫瓒呮椂鏃堕棿鐨� - */ - private boolean acquire(String key, long expire, TimeUnit expireUnit) { - try { - //鑾峰彇閿佸璞� - RLock mylock = redissonClient.getLock(key); - //鍔犻攣锛屽苟涓旇缃攣杩囨湡鏃堕棿锛岄槻姝㈡閿佺殑浜х敓 - mylock.tryLock(expire, expire, expireUnit); - } catch (InterruptedException e) { - return false; - } - log.info("lock => key : " + key + " , ThreadName : " + Thread.currentThread().getName()); - //鍔犻攣鎴愬姛 - return true; - } - - /** - * 閿佺殑閲婃斁 - */ - private void release(String lockName) { - //鑾峰彇鎵�瀵硅薄 - RLock mylock = redissonClient.getLock(lockName); - //閲婃斁閿侊紙瑙i攣锛� - mylock.unlock(); - log.info("unlock => key : " + lockName + " , ThreadName : " + Thread.currentThread().getName()); } } 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 index 5682602..5c11ae6 100644 --- a/ruoyi-framework/src/main/java/com/ruoyi/framework/config/AsyncConfig.java +++ b/ruoyi-framework/src/main/java/com/ruoyi/framework/config/AsyncConfig.java @@ -11,6 +11,11 @@ import java.util.concurrent.Executor; import java.util.concurrent.Executors; +/** + * 寮傛閰嶇疆 + * + * @author Lion Li + */ @EnableAsync @Configuration public class AsyncConfig extends AsyncConfigurerSupport { 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 e86f5bc..95c7572 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 @@ -6,15 +6,20 @@ import org.redisson.api.RedissonClient; import org.redisson.codec.JsonJacksonCodec; import org.redisson.config.Config; +import org.redisson.spring.cache.CacheConfig; +import org.redisson.spring.cache.RedissonSpringCacheManager; 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.CacheManager; 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 java.io.IOException; +import java.util.HashMap; +import java.util.Map; /** * redis閰嶇疆 @@ -67,4 +72,15 @@ .setDnsMonitoringInterval(singleServerConfig.getDnsMonitoringInterval()); return Redisson.create(config); } + + /** + * 鏁村悎spring-cache + */ + @Bean + public CacheManager cacheManager(RedissonClient redissonClient) { + Map<String, CacheConfig> config = new HashMap<>(); + config.put("redissonCacheMap", new CacheConfig(30*60*1000, 10*60*1000)); + return new RedissonSpringCacheManager(redissonClient, config, JsonJacksonCodec.INSTANCE); + } + } diff --git a/ruoyi-framework/src/main/java/com/ruoyi/framework/config/ResourcesConfig.java b/ruoyi-framework/src/main/java/com/ruoyi/framework/config/ResourcesConfig.java index 7f0a629..005f032 100644 --- a/ruoyi-framework/src/main/java/com/ruoyi/framework/config/ResourcesConfig.java +++ b/ruoyi-framework/src/main/java/com/ruoyi/framework/config/ResourcesConfig.java @@ -15,7 +15,7 @@ /** * 閫氱敤閰嶇疆 - * + * * @author ruoyi */ @Configuration @@ -31,8 +31,7 @@ registry.addResourceHandler(Constants.RESOURCE_PREFIX + "/**").addResourceLocations("file:" + RuoYiConfig.getProfile() + "/"); /** swagger閰嶇疆 */ - registry.addResourceHandler("swagger-ui.html").addResourceLocations("classpath:/META-INF/resources/"); - registry.addResourceHandler("/webjars/**").addResourceLocations("classpath:/META-INF/resources/webjars/"); + registry.addResourceHandler("/swagger-ui/**").addResourceLocations("classpath:/META-INF/resources/webjars/springfox-swagger-ui/"); } /** @@ -63,4 +62,4 @@ source.registerCorsConfiguration("/**", config); return new CorsFilter(source); } -} \ No newline at end of file +} diff --git a/ruoyi-framework/src/main/java/com/ruoyi/framework/config/SwaggerConfig.java b/ruoyi-framework/src/main/java/com/ruoyi/framework/config/SwaggerConfig.java index 1a92ca0..2c65ac6 100644 --- a/ruoyi-framework/src/main/java/com/ruoyi/framework/config/SwaggerConfig.java +++ b/ruoyi-framework/src/main/java/com/ruoyi/framework/config/SwaggerConfig.java @@ -3,6 +3,7 @@ import com.github.xiaoymin.knife4j.spring.annotations.EnableKnife4j; import com.ruoyi.framework.config.properties.SwaggerProperties; import io.swagger.annotations.ApiOperation; +import io.swagger.models.auth.In; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Configuration; @@ -13,18 +14,16 @@ import springfox.documentation.spi.DocumentationType; import springfox.documentation.spi.service.contexts.SecurityContext; import springfox.documentation.spring.web.plugins.Docket; -import springfox.documentation.swagger2.annotations.EnableSwagger2; import java.util.ArrayList; import java.util.List; /** - * Swagger2鐨勬帴鍙i厤缃� + * Swagger 鏂囨。閰嶇疆 * * @author Lion Li */ @Configuration -@EnableSwagger2 @EnableKnife4j public class SwaggerConfig { @@ -36,7 +35,7 @@ */ @Bean public Docket createRestApi() { - return new Docket(DocumentationType.SWAGGER_2) + return new Docket(DocumentationType.OAS_30) .enable(swaggerProperties.getEnabled()) // 鐢ㄦ潵鍒涘缓璇PI鐨勫熀鏈俊鎭紝灞曠ず鍦ㄦ枃妗g殑椤甸潰涓紙鑷畾涔夊睍绀虹殑淇℃伅锛� .apiInfo(apiInfo()) @@ -60,7 +59,7 @@ */ private List<SecurityScheme> securitySchemes() { List<SecurityScheme> apiKeyList = new ArrayList<SecurityScheme>(); - apiKeyList.add(new ApiKey("Authorization", "Authorization", "header")); + apiKeyList.add(new ApiKey("Authorization", "Authorization", In.HEADER.toValue())); return apiKeyList; } @@ -72,7 +71,7 @@ securityContexts.add( SecurityContext.builder() .securityReferences(defaultAuth()) - .forPaths(PathSelectors.regex("^(?!auth).*$")) + .operationSelector(o -> o.requestMappingPattern().matches("/.*")) .build()); return securityContexts; } diff --git a/ruoyi-framework/src/main/java/com/ruoyi/framework/config/properties/SwaggerProperties.java b/ruoyi-framework/src/main/java/com/ruoyi/framework/config/properties/SwaggerProperties.java index f99c3da..ece75ef 100644 --- a/ruoyi-framework/src/main/java/com/ruoyi/framework/config/properties/SwaggerProperties.java +++ b/ruoyi-framework/src/main/java/com/ruoyi/framework/config/properties/SwaggerProperties.java @@ -6,7 +6,7 @@ import org.springframework.stereotype.Component; /** - * 楠岃瘉鐮� 閰嶇疆灞炴�� + * swagger 閰嶇疆灞炴�� * * @author Lion Li */ diff --git a/ruoyi-framework/src/main/java/com/ruoyi/framework/config/properties/ThreadPoolProperties.java b/ruoyi-framework/src/main/java/com/ruoyi/framework/config/properties/ThreadPoolProperties.java index 68cb093..08b6842 100644 --- a/ruoyi-framework/src/main/java/com/ruoyi/framework/config/properties/ThreadPoolProperties.java +++ b/ruoyi-framework/src/main/java/com/ruoyi/framework/config/properties/ThreadPoolProperties.java @@ -5,7 +5,7 @@ import org.springframework.stereotype.Component; /** - * 楠岃瘉鐮� 閰嶇疆灞炴�� + * 绾跨▼姹� 閰嶇疆灞炴�� * * @author Lion Li */ diff --git a/ruoyi-framework/src/main/java/com/ruoyi/framework/config/properties/TokenProperties.java b/ruoyi-framework/src/main/java/com/ruoyi/framework/config/properties/TokenProperties.java index d582e54..f695c1c 100644 --- a/ruoyi-framework/src/main/java/com/ruoyi/framework/config/properties/TokenProperties.java +++ b/ruoyi-framework/src/main/java/com/ruoyi/framework/config/properties/TokenProperties.java @@ -4,6 +4,11 @@ import org.springframework.boot.context.properties.ConfigurationProperties; import org.springframework.stereotype.Component; +/** + * token 閰嶇疆灞炴�� + * + * @author Lion Li + */ @Data @Component @ConfigurationProperties(prefix = "token") diff --git a/ruoyi-framework/src/main/java/com/ruoyi/framework/config/properties/XssProperties.java b/ruoyi-framework/src/main/java/com/ruoyi/framework/config/properties/XssProperties.java index 35ae2e4..d8a68a8 100644 --- a/ruoyi-framework/src/main/java/com/ruoyi/framework/config/properties/XssProperties.java +++ b/ruoyi-framework/src/main/java/com/ruoyi/framework/config/properties/XssProperties.java @@ -5,7 +5,7 @@ import org.springframework.stereotype.Component; /** - * 楠岃瘉鐮� 閰嶇疆灞炴�� + * xss杩囨护 閰嶇疆灞炴�� * * @author Lion Li */ diff --git a/ruoyi-generator/src/main/resources/vm/java/controller.java.vm b/ruoyi-generator/src/main/resources/vm/java/controller.java.vm index b40b497..900f510 100644 --- a/ruoyi-generator/src/main/resources/vm/java/controller.java.vm +++ b/ruoyi-generator/src/main/resources/vm/java/controller.java.vm @@ -9,6 +9,7 @@ import org.springframework.beans.factory.annotation.Autowired; import org.springframework.web.bind.annotation.*; import org.springframework.validation.annotation.Validated; +import com.ruoyi.common.annotation.RepeatSubmit; import com.ruoyi.common.annotation.Log; import com.ruoyi.common.core.controller.BaseController; import com.ruoyi.common.core.domain.AjaxResult; @@ -28,7 +29,7 @@ /** * ${functionName}Controller - * + * * @author ${author} * @date ${datetime} */ @@ -87,6 +88,7 @@ @ApiOperation("鏂板${functionName}") @PreAuthorize("@ss.hasPermi('${permissionPrefix}:add')") @Log(title = "${functionName}", businessType = BusinessType.INSERT) + @RepeatSubmit @PostMapping() public AjaxResult<Void> add(@Validated @RequestBody ${ClassName}AddBo bo) { return toAjax(i${ClassName}Service.insertByAddBo(bo) ? 1 : 0); @@ -98,6 +100,7 @@ @ApiOperation("淇敼${functionName}") @PreAuthorize("@ss.hasPermi('${permissionPrefix}:edit')") @Log(title = "${functionName}", businessType = BusinessType.UPDATE) + @RepeatSubmit @PutMapping() public AjaxResult<Void> edit(@Validated @RequestBody ${ClassName}EditBo bo) { return toAjax(i${ClassName}Service.updateByEditBo(bo) ? 1 : 0); diff --git a/ruoyi-generator/src/main/resources/vm/java/mapper.java.vm b/ruoyi-generator/src/main/resources/vm/java/mapper.java.vm index 6008418..36a9864 100644 --- a/ruoyi-generator/src/main/resources/vm/java/mapper.java.vm +++ b/ruoyi-generator/src/main/resources/vm/java/mapper.java.vm @@ -2,6 +2,8 @@ import ${packageName}.domain.${ClassName}; import com.ruoyi.common.core.page.BaseMapperPlus; +import com.ruoyi.common.core.mybatisplus.MybatisPlusRedisCache; +import org.apache.ibatis.annotations.CacheNamespace; /** * ${functionName}Mapper鎺ュ彛 @@ -9,6 +11,7 @@ * @author ${author} * @date ${datetime} */ +@CacheNamespace(implementation = MybatisPlusRedisCache.class, eviction = MybatisPlusRedisCache.class) public interface ${ClassName}Mapper extends BaseMapperPlus<${ClassName}> { } diff --git a/ruoyi-generator/src/main/resources/vm/vue/index-tree.vue.vm b/ruoyi-generator/src/main/resources/vm/vue/index-tree.vue.vm index f1247ab..0b971b2 100644 --- a/ruoyi-generator/src/main/resources/vm/vue/index-tree.vue.vm +++ b/ruoyi-generator/src/main/resources/vm/vue/index-tree.vue.vm @@ -541,7 +541,7 @@ this.loading = false; this.getList(); this.msgSuccess("鍒犻櫎鎴愬姛"); - }) + }).catch(() => {}); } } }; diff --git a/ruoyi-generator/src/main/resources/vm/vue/index.vue.vm b/ruoyi-generator/src/main/resources/vm/vue/index.vue.vm index 9f58575..d6b311c 100644 --- a/ruoyi-generator/src/main/resources/vm/vue/index.vue.vm +++ b/ruoyi-generator/src/main/resources/vm/vue/index.vue.vm @@ -599,7 +599,7 @@ this.loading = false; this.getList(); this.msgSuccess("鍒犻櫎鎴愬姛"); - }) + }).catch(() => {}); }, #if($table.sub) /** ${subTable.functionName}搴忓彿 */ @@ -648,7 +648,7 @@ }).then(response => { this.download(response.msg); this.exportLoading = false; - }) + }).catch(() => {}); } } }; diff --git a/ruoyi-ui/package.json b/ruoyi-ui/package.json index 52551a4..d90fdba 100644 --- a/ruoyi-ui/package.json +++ b/ruoyi-ui/package.json @@ -1,6 +1,6 @@ { "name": "ruoyi-vue-plus", - "version": "2.3.1", + "version": "2.3.2", "description": "RuoYi-Vue-Plus鍚庡彴绠$悊绯荤粺", "author": "LionLi", "license": "MIT", diff --git a/ruoyi-ui/src/components/Editor/index.vue b/ruoyi-ui/src/components/Editor/index.vue index 640049c..d63a48d 100644 --- a/ruoyi-ui/src/components/Editor/index.vue +++ b/ruoyi-ui/src/components/Editor/index.vue @@ -75,7 +75,7 @@ [{ color: [] }, { background: [] }], // 瀛椾綋棰滆壊銆佸瓧浣撹儗鏅鑹� [{ align: [] }], // 瀵归綈鏂瑰紡 ["clean"], // 娓呴櫎鏂囨湰鏍煎紡 - ["link", "image"] // 閾炬帴銆佸浘鐗� + ["link", "image", "video"] // 閾炬帴銆佸浘鐗囥�佽棰� ], }, placeholder: "璇疯緭鍏ュ唴瀹�", diff --git a/ruoyi-ui/src/layout/components/Navbar.vue b/ruoyi-ui/src/layout/components/Navbar.vue index 9d220e9..466cd98 100644 --- a/ruoyi-ui/src/layout/components/Navbar.vue +++ b/ruoyi-ui/src/layout/components/Navbar.vue @@ -8,7 +8,7 @@ <div class="right-menu"> <template v-if="device!=='mobile'"> <search id="header-search" class="right-menu-item" /> - + <el-tooltip content="婧愮爜鍦板潃" effect="dark" placement="bottom"> <ruo-yi-git id="ruoyi-git" class="right-menu-item hover-effect" /> </el-tooltip> @@ -104,7 +104,7 @@ this.$store.dispatch('LogOut').then(() => { location.href = '/index'; }) - }) + }).catch(() => {}); } } } diff --git a/ruoyi-ui/src/utils/request.js b/ruoyi-ui/src/utils/request.js index ae89f24..a510d2d 100644 --- a/ruoyi-ui/src/utils/request.js +++ b/ruoyi-ui/src/utils/request.js @@ -63,7 +63,7 @@ store.dispatch('LogOut').then(() => { location.href = '/index'; }) - }) + }).catch(() => {}); } else if (code === 500) { Message({ message: msg, diff --git a/ruoyi-ui/src/views/index.vue b/ruoyi-ui/src/views/index.vue index d904f30..5f487c9 100644 --- a/ruoyi-ui/src/views/index.vue +++ b/ruoyi-ui/src/views/index.vue @@ -80,6 +80,17 @@ <span>鏇存柊鏃ュ織</span> </div> <el-collapse accordion> + <el-collapse-item title="v2.3.2 - 2021-6-11"> + <ol> + <li>add redis閿佸伐鍏风被缂栧啓</li> + <li>update spring-cache 鏁村悎 redisson</li> + <li>update MybatisPlus鏁村悎Redis浜岀骇缂撳瓨</li> + <li>update swagger 鍗囩骇涓� 3.0.0 浣跨敤 OAS_30 鍗忚</li> + <li>update 浼樺寲 浠g爜鐢熸垚鍣� 澧炲姞琛ㄥ崟闃查噸娉ㄨВ</li> + <li>update 浼樺寲 閿佸垏闈唬鐮� key鍒板父閲忕被</li> + <li>fix 淇鐩稿璺緞涓婁紶寮傚父闂</li> + </ol> + </el-collapse-item> <el-collapse-item title="v2.3.1 - 2021-6-4"> <ol> <li>add 澧炲姞 redisson 鍒嗗竷寮忛攣 娉ㄨВ涓巇emo妗堜緥</li> diff --git a/ruoyi-ui/src/views/monitor/job/index.vue b/ruoyi-ui/src/views/monitor/job/index.vue index 8074287..69fa8bd 100644 --- a/ruoyi-ui/src/views/monitor/job/index.vue +++ b/ruoyi-ui/src/views/monitor/job/index.vue @@ -410,7 +410,7 @@ return runJob(row.jobId, row.jobGroup); }).then(() => { this.msgSuccess("鎵ц鎴愬姛"); - }) + }).catch(() => {}); }, /** 浠诲姟璇︾粏淇℃伅 */ handleView(row) { @@ -471,7 +471,7 @@ }).then(() => { this.getList(); this.msgSuccess("鍒犻櫎鎴愬姛"); - }) + }).catch(() => {}); }, /** 瀵煎嚭鎸夐挳鎿嶄綔 */ handleExport() { @@ -486,7 +486,7 @@ }).then(response => { this.download(response.msg); this.exportLoading = false; - }) + }).catch(() => {}); } } }; diff --git a/ruoyi-ui/src/views/monitor/job/log.vue b/ruoyi-ui/src/views/monitor/job/log.vue index 121dde8..fa5976f 100644 --- a/ruoyi-ui/src/views/monitor/job/log.vue +++ b/ruoyi-ui/src/views/monitor/job/log.vue @@ -269,7 +269,7 @@ }).then(() => { this.getList(); this.msgSuccess("鍒犻櫎鎴愬姛"); - }) + }).catch(() => {}); }, /** 娓呯┖鎸夐挳鎿嶄綔 */ handleClean() { @@ -282,7 +282,7 @@ }).then(() => { this.getList(); this.msgSuccess("娓呯┖鎴愬姛"); - }) + }).catch(() => {}); }, /** 瀵煎嚭鎸夐挳鎿嶄綔 */ handleExport() { @@ -297,7 +297,7 @@ }).then(response => { this.download(response.msg); this.exportLoading = false; - }) + }).catch(() => {}); } } }; diff --git a/ruoyi-ui/src/views/monitor/logininfor/index.vue b/ruoyi-ui/src/views/monitor/logininfor/index.vue index 1ab76be..92baaa9 100644 --- a/ruoyi-ui/src/views/monitor/logininfor/index.vue +++ b/ruoyi-ui/src/views/monitor/logininfor/index.vue @@ -202,7 +202,7 @@ }).then(() => { this.getList(); this.msgSuccess("鍒犻櫎鎴愬姛"); - }) + }).catch(() => {}); }, /** 娓呯┖鎸夐挳鎿嶄綔 */ handleClean() { @@ -215,7 +215,7 @@ }).then(() => { this.getList(); this.msgSuccess("娓呯┖鎴愬姛"); - }) + }).catch(() => {}); }, /** 瀵煎嚭鎸夐挳鎿嶄綔 */ handleExport() { @@ -230,7 +230,7 @@ }).then(response => { this.download(response.msg); this.exportLoading = false; - }) + }).catch(() => {}); } } }; diff --git a/ruoyi-ui/src/views/monitor/online/index.vue b/ruoyi-ui/src/views/monitor/online/index.vue index fc18a5e..64aa25c 100644 --- a/ruoyi-ui/src/views/monitor/online/index.vue +++ b/ruoyi-ui/src/views/monitor/online/index.vue @@ -120,7 +120,7 @@ }).then(() => { this.getList(); this.msgSuccess("寮洪��鎴愬姛"); - }) + }).catch(() => {}); } } }; diff --git a/ruoyi-ui/src/views/monitor/operlog/index.vue b/ruoyi-ui/src/views/monitor/operlog/index.vue index 03d0f8e..d45f6e9 100644 --- a/ruoyi-ui/src/views/monitor/operlog/index.vue +++ b/ruoyi-ui/src/views/monitor/operlog/index.vue @@ -290,7 +290,7 @@ }).then(() => { this.getList(); this.msgSuccess("鍒犻櫎鎴愬姛"); - }) + }).catch(() => {}); }, /** 娓呯┖鎸夐挳鎿嶄綔 */ handleClean() { @@ -303,7 +303,7 @@ }).then(() => { this.getList(); this.msgSuccess("娓呯┖鎴愬姛"); - }) + }).catch(() => {}); }, /** 瀵煎嚭鎸夐挳鎿嶄綔 */ handleExport() { @@ -318,7 +318,7 @@ }).then(response => { this.download(response.msg); this.exportLoading = false; - }) + }).catch(() => {}); } } }; diff --git a/ruoyi-ui/src/views/system/config/index.vue b/ruoyi-ui/src/views/system/config/index.vue index 4d6f7ae..25086a9 100644 --- a/ruoyi-ui/src/views/system/config/index.vue +++ b/ruoyi-ui/src/views/system/config/index.vue @@ -338,7 +338,7 @@ }).then(() => { this.getList(); this.msgSuccess("鍒犻櫎鎴愬姛"); - }) + }).catch(() => {}); }, /** 瀵煎嚭鎸夐挳鎿嶄綔 */ handleExport() { @@ -353,7 +353,7 @@ }).then(response => { this.download(response.msg); this.exportLoading = false; - }) + }).catch(() => {}); }, /** 鍒锋柊缂撳瓨鎸夐挳鎿嶄綔 */ handleRefreshCache() { diff --git a/ruoyi-ui/src/views/system/dept/index.vue b/ruoyi-ui/src/views/system/dept/index.vue index 1d86425..b10653e 100644 --- a/ruoyi-ui/src/views/system/dept/index.vue +++ b/ruoyi-ui/src/views/system/dept/index.vue @@ -57,17 +57,17 @@ </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" + <el-button + size="mini" + type="text" + icon="el-icon-edit" @click="handleUpdate(scope.row)" v-hasPermi="['system:dept:edit']" >淇敼</el-button> - <el-button - size="mini" - type="text" - icon="el-icon-plus" + <el-button + size="mini" + type="text" + icon="el-icon-plus" @click="handleAdd(scope.row)" v-hasPermi="['system:dept:add']" >鏂板</el-button> @@ -310,8 +310,8 @@ }).then(() => { this.getList(); this.msgSuccess("鍒犻櫎鎴愬姛"); - }) + }).catch(() => {}); } } }; -</script> \ No newline at end of file +</script> diff --git a/ruoyi-ui/src/views/system/dict/data.vue b/ruoyi-ui/src/views/system/dict/data.vue index d93bbf5..9a4b429 100644 --- a/ruoyi-ui/src/views/system/dict/data.vue +++ b/ruoyi-ui/src/views/system/dict/data.vue @@ -337,7 +337,7 @@ }).then(() => { this.getList(); this.msgSuccess("鍒犻櫎鎴愬姛"); - }) + }).catch(() => {}); }, /** 瀵煎嚭鎸夐挳鎿嶄綔 */ handleExport() { @@ -352,7 +352,7 @@ }).then(response => { this.download(response.msg); this.exportLoading = false; - }) + }).catch(() => {}); } } }; diff --git a/ruoyi-ui/src/views/system/dict/index.vue b/ruoyi-ui/src/views/system/dict/index.vue index b23233e..a6b8ba3 100644 --- a/ruoyi-ui/src/views/system/dict/index.vue +++ b/ruoyi-ui/src/views/system/dict/index.vue @@ -342,7 +342,7 @@ }).then(() => { this.getList(); this.msgSuccess("鍒犻櫎鎴愬姛"); - }) + }).catch(() => {}); }, /** 瀵煎嚭鎸夐挳鎿嶄綔 */ handleExport() { @@ -357,7 +357,7 @@ }).then(response => { this.download(response.msg); this.exportLoading = false; - }) + }).catch(() => {}); }, /** 鍒锋柊缂撳瓨鎸夐挳鎿嶄綔 */ handleRefreshCache() { diff --git a/ruoyi-ui/src/views/system/menu/index.vue b/ruoyi-ui/src/views/system/menu/index.vue index 8d2137a..a7d3ce7 100644 --- a/ruoyi-ui/src/views/system/menu/index.vue +++ b/ruoyi-ui/src/views/system/menu/index.vue @@ -163,7 +163,7 @@ </el-col> <el-col :span="12"> <el-form-item v-if="form.menuType != 'M'" label="鏉冮檺鏍囪瘑"> - <el-input v-model="form.perms" placeholder="璇锋潈闄愭爣璇�" maxlength="100" /> + <el-input v-model="form.perms" placeholder="璇疯緭鍏ユ潈闄愭爣璇�" maxlength="100" /> </el-form-item> </el-col> <el-col :span="12"> @@ -393,7 +393,7 @@ }).then(() => { this.getList(); this.msgSuccess("鍒犻櫎鎴愬姛"); - }) + }).catch(() => {}); } } }; diff --git a/ruoyi-ui/src/views/system/notice/index.vue b/ruoyi-ui/src/views/system/notice/index.vue index aefa12b..3115543 100644 --- a/ruoyi-ui/src/views/system/notice/index.vue +++ b/ruoyi-ui/src/views/system/notice/index.vue @@ -336,7 +336,7 @@ }).then(() => { this.getList(); this.msgSuccess("鍒犻櫎鎴愬姛"); - }) + }).catch(() => {}); } } }; diff --git a/ruoyi-ui/src/views/system/post/index.vue b/ruoyi-ui/src/views/system/post/index.vue index 2b116e6..9d15938 100644 --- a/ruoyi-ui/src/views/system/post/index.vue +++ b/ruoyi-ui/src/views/system/post/index.vue @@ -309,7 +309,7 @@ }).then(() => { this.getList(); this.msgSuccess("鍒犻櫎鎴愬姛"); - }) + }).catch(() => {}); }, /** 瀵煎嚭鎸夐挳鎿嶄綔 */ handleExport() { @@ -324,7 +324,7 @@ }).then(response => { this.download(response.msg); this.exportLoading = false; - }) + }).catch(() => {}); } } }; diff --git a/ruoyi-ui/src/views/system/role/index.vue b/ruoyi-ui/src/views/system/role/index.vue index fdcfbf0..081ea81 100644 --- a/ruoyi-ui/src/views/system/role/index.vue +++ b/ruoyi-ui/src/views/system/role/index.vue @@ -593,7 +593,7 @@ }).then(() => { this.getList(); this.msgSuccess("鍒犻櫎鎴愬姛"); - }) + }).catch(() => {}); }, /** 瀵煎嚭鎸夐挳鎿嶄綔 */ handleExport() { @@ -608,7 +608,7 @@ }).then(response => { this.download(response.msg); this.exportLoading = false; - }) + }).catch(() => {}); } } }; diff --git a/ruoyi-ui/src/views/system/user/index.vue b/ruoyi-ui/src/views/system/user/index.vue index 70d586f..1a89876 100644 --- a/ruoyi-ui/src/views/system/user/index.vue +++ b/ruoyi-ui/src/views/system/user/index.vue @@ -631,7 +631,7 @@ }).then(() => { this.getList(); this.msgSuccess("鍒犻櫎鎴愬姛"); - }) + }).catch(() => {}); }, /** 瀵煎嚭鎸夐挳鎿嶄綔 */ handleExport() { @@ -646,7 +646,7 @@ }).then(response => { this.download(response.msg); this.exportLoading = false; - }) + }).catch(() => {}); }, /** 瀵煎叆鎸夐挳鎿嶄綔 */ handleImport() { diff --git a/ruoyi-ui/src/views/tool/gen/index.vue b/ruoyi-ui/src/views/tool/gen/index.vue index 9d29399..0efc75a 100644 --- a/ruoyi-ui/src/views/tool/gen/index.vue +++ b/ruoyi-ui/src/views/tool/gen/index.vue @@ -283,7 +283,7 @@ return synchDb(tableName); }).then(() => { this.msgSuccess("鍚屾鎴愬姛"); - }) + }).catch(() => {}); }, /** 鎵撳紑瀵煎叆琛ㄥ脊绐� */ openImportTable() { @@ -333,7 +333,7 @@ }).then(() => { this.getList(); this.msgSuccess("鍒犻櫎鎴愬姛"); - }) + }).catch(() => {}); } } }; -- Gitblit v1.9.3