From 25264faf3792cdc90a5a68c488b5af239caf3724 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E7=96=AF=E7=8B=82=E7=9A=84=E7=8B=AE=E5=AD=90li?= <15040126243@163.com> Date: Tue, 25 May 2021 14:28:38 +0800 Subject: [PATCH 01/41] =?UTF-8?q?=E9=85=8D=E7=BD=AE=E6=96=87=E4=BB=B6?= =?UTF-8?q?=E9=94=99=E8=AF=AF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ruoyi-admin/src/main/resources/application-dev.yml | 14 +++++--------- 1 file changed, 5 insertions(+), 9 deletions(-) diff --git a/ruoyi-admin/src/main/resources/application-dev.yml b/ruoyi-admin/src/main/resources/application-dev.yml index 3a2a03d64..06456dd8d 100644 --- a/ruoyi-admin/src/main/resources/application-dev.yml +++ b/ruoyi-admin/src/main/resources/application-dev.yml @@ -1,7 +1,3 @@ ---- -server: - port: 8081 ---- # 数据源配置 spring: datasource: @@ -10,9 +6,9 @@ spring: druid: # 主库数据源 master: - url: jdbc:mysql://39.101.143.184:3306/ruoyi-vue?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=true&serverTimezone=GMT%2B8&autoReconnect=true - username: ruoyi-vue - password: ryvue + url: jdbc:mysql://localhost:3306/ry-vue?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=true&serverTimezone=GMT%2B8&autoReconnect=true + username: root + password: root # 从库数据源 slave: # 从数据源开关/默认关闭 @@ -62,13 +58,13 @@ spring: # redis 配置 redis: # 地址 - host: 39.101.143.184 + host: localhost # 端口,默认为6379 port: 6379 # 数据库索引 database: 0 # 密码 - password: ryvue + password: # 连接超时时间 timeout: 10s lettuce: From c94756f8a2addcacd67332d4e57307e87d42a749 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E7=96=AF=E7=8B=82=E7=9A=84=E7=8B=AE=E5=AD=90li?= <15040126243@163.com> Date: Tue, 25 May 2021 14:32:41 +0800 Subject: [PATCH 02/41] =?UTF-8?q?remove=20=E5=88=A0=E9=99=A4=E6=8F=90?= =?UTF-8?q?=E4=BA=A4=E9=94=99=E8=AF=AF=E6=96=87=E4=BB=B6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../src/main/java/com/ruoyi/common/utils/ExceptionUtil.java | 0 1 file changed, 0 insertions(+), 0 deletions(-) delete mode 100644 ruoyi-common/src/main/java/com/ruoyi/common/utils/ExceptionUtil.java diff --git a/ruoyi-common/src/main/java/com/ruoyi/common/utils/ExceptionUtil.java b/ruoyi-common/src/main/java/com/ruoyi/common/utils/ExceptionUtil.java deleted file mode 100644 index e69de29bb..000000000 From f793ee395dbf095a73b28c26a06aed5aba39118a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E7=96=AF=E7=8B=82=E7=9A=84=E7=8B=AE=E5=AD=90li?= <15040126243@163.com> Date: Wed, 26 May 2021 09:23:56 +0800 Subject: [PATCH 03/41] =?UTF-8?q?fix=20=E4=BF=AE=E5=A4=8Dsql=E7=AC=A6?= =?UTF-8?q?=E5=8F=B7=E9=94=99=E8=AF=AF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../ruoyi/system/service/impl/SysConfigServiceImpl.java | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) 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 fbf6ec814..7c76c5713 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 @@ -55,10 +55,10 @@ public class SysConfigServiceImpl extends ServiceImpl= date_format(#{0},'%y%m%d')", + "date_format(create_time,'%y%m%d') >= date_format({0},'%y%m%d')", params.get("beginTime")) .apply(Validator.isNotEmpty(params.get("endTime")), - "date_format(create_time,'%y%m%d') <= date_format(#{0},'%y%m%d')", + "date_format(create_time,'%y%m%d') <= date_format({0},'%y%m%d')", params.get("endTime")); return PageUtils.buildDataInfo(page(PageUtils.buildPage(), lqw)); } @@ -110,10 +110,10 @@ public class SysConfigServiceImpl extends ServiceImpl= date_format(#{0},'%y%m%d')", + "date_format(create_time,'%y%m%d') >= date_format({0},'%y%m%d')", params.get("beginTime")) .apply(Validator.isNotEmpty(params.get("endTime")), - "date_format(create_time,'%y%m%d') >= date_format(#{0},'%y%m%d')", + "date_format(create_time,'%y%m%d') <= date_format({0},'%y%m%d')", params.get("endTime")); return baseMapper.selectList(lqw); } From 454a07b7756cd564a02b52606589ee96a66fe8be Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E7=96=AF=E7=8B=82=E7=9A=84=E7=8B=AE=E5=AD=90li?= <15040126243@163.com> Date: Wed, 26 May 2021 16:44:59 +0800 Subject: [PATCH 04/41] =?UTF-8?q?update=20=E6=96=87=E6=A1=A3=E5=A2=9E?= =?UTF-8?q?=E5=8A=A0=E6=BC=94=E7=A4=BA=E5=9B=BE=E4=BE=8B?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- README.md | 41 +++++++++++++++++++++++++++++++++++++++++ pom.xml | 8 ++++++++ 2 files changed, 49 insertions(+) diff --git a/README.md b/README.md index 796d57fba..778346524 100644 --- a/README.md +++ b/README.md @@ -100,6 +100,47 @@ 17. 在线构建器:拖动表单元素生成相应的HTML代码。 18. 连接池监视:监视当前系统数据库连接池状态,可进行分析SQL找出系统性能瓶颈。 +## 演示图例 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+

+
+ ## 在线体验 - admin/admin123 diff --git a/pom.xml b/pom.xml index a197fd391..43c0aead1 100644 --- a/pom.xml +++ b/pom.xml @@ -248,6 +248,14 @@ + + local + + + local + debug + + dev From 08d82bb12f43578c53ec73894201d2e8f4348051 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E7=96=AF=E7=8B=82=E7=9A=84=E7=8B=AE=E5=AD=90li?= <15040126243@163.com> Date: Tue, 25 May 2021 14:28:38 +0800 Subject: [PATCH 05/41] =?UTF-8?q?=E9=85=8D=E7=BD=AE=E6=96=87=E4=BB=B6?= =?UTF-8?q?=E9=94=99=E8=AF=AF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ruoyi-admin/src/main/resources/application-dev.yml | 14 +++++--------- 1 file changed, 5 insertions(+), 9 deletions(-) diff --git a/ruoyi-admin/src/main/resources/application-dev.yml b/ruoyi-admin/src/main/resources/application-dev.yml index 3a2a03d64..06456dd8d 100644 --- a/ruoyi-admin/src/main/resources/application-dev.yml +++ b/ruoyi-admin/src/main/resources/application-dev.yml @@ -1,7 +1,3 @@ ---- -server: - port: 8081 ---- # 数据源配置 spring: datasource: @@ -10,9 +6,9 @@ spring: druid: # 主库数据源 master: - url: jdbc:mysql://39.101.143.184:3306/ruoyi-vue?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=true&serverTimezone=GMT%2B8&autoReconnect=true - username: ruoyi-vue - password: ryvue + url: jdbc:mysql://localhost:3306/ry-vue?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=true&serverTimezone=GMT%2B8&autoReconnect=true + username: root + password: root # 从库数据源 slave: # 从数据源开关/默认关闭 @@ -62,13 +58,13 @@ spring: # redis 配置 redis: # 地址 - host: 39.101.143.184 + host: localhost # 端口,默认为6379 port: 6379 # 数据库索引 database: 0 # 密码 - password: ryvue + password: # 连接超时时间 timeout: 10s lettuce: From df8a6bbaa217aea24df60e233ddbd67ce566b368 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E7=96=AF=E7=8B=82=E7=9A=84=E7=8B=AE=E5=AD=90li?= <15040126243@163.com> Date: Tue, 25 May 2021 14:32:41 +0800 Subject: [PATCH 06/41] =?UTF-8?q?remove=20=E5=88=A0=E9=99=A4=E6=8F=90?= =?UTF-8?q?=E4=BA=A4=E9=94=99=E8=AF=AF=E6=96=87=E4=BB=B6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../src/main/java/com/ruoyi/common/utils/ExceptionUtil.java | 0 1 file changed, 0 insertions(+), 0 deletions(-) delete mode 100644 ruoyi-common/src/main/java/com/ruoyi/common/utils/ExceptionUtil.java diff --git a/ruoyi-common/src/main/java/com/ruoyi/common/utils/ExceptionUtil.java b/ruoyi-common/src/main/java/com/ruoyi/common/utils/ExceptionUtil.java deleted file mode 100644 index e69de29bb..000000000 From 3aaa219d5ebfe680ebeb9aa57f2dc137e6048115 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E7=96=AF=E7=8B=82=E7=9A=84=E7=8B=AE=E5=AD=90li?= <15040126243@163.com> Date: Wed, 26 May 2021 09:23:56 +0800 Subject: [PATCH 07/41] =?UTF-8?q?fix=20=E4=BF=AE=E5=A4=8Dsql=E7=AC=A6?= =?UTF-8?q?=E5=8F=B7=E9=94=99=E8=AF=AF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../ruoyi/system/service/impl/SysConfigServiceImpl.java | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) 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 fbf6ec814..7c76c5713 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 @@ -55,10 +55,10 @@ public class SysConfigServiceImpl extends ServiceImpl= date_format(#{0},'%y%m%d')", + "date_format(create_time,'%y%m%d') >= date_format({0},'%y%m%d')", params.get("beginTime")) .apply(Validator.isNotEmpty(params.get("endTime")), - "date_format(create_time,'%y%m%d') <= date_format(#{0},'%y%m%d')", + "date_format(create_time,'%y%m%d') <= date_format({0},'%y%m%d')", params.get("endTime")); return PageUtils.buildDataInfo(page(PageUtils.buildPage(), lqw)); } @@ -110,10 +110,10 @@ public class SysConfigServiceImpl extends ServiceImpl= date_format(#{0},'%y%m%d')", + "date_format(create_time,'%y%m%d') >= date_format({0},'%y%m%d')", params.get("beginTime")) .apply(Validator.isNotEmpty(params.get("endTime")), - "date_format(create_time,'%y%m%d') >= date_format(#{0},'%y%m%d')", + "date_format(create_time,'%y%m%d') <= date_format({0},'%y%m%d')", params.get("endTime")); return baseMapper.selectList(lqw); } From 080770a4937ee186a7394fe3971f73cdfce36381 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E7=96=AF=E7=8B=82=E7=9A=84=E7=8B=AE=E5=AD=90li?= <15040126243@163.com> Date: Wed, 26 May 2021 16:44:59 +0800 Subject: [PATCH 08/41] =?UTF-8?q?update=20=E6=96=87=E6=A1=A3=E5=A2=9E?= =?UTF-8?q?=E5=8A=A0=E6=BC=94=E7=A4=BA=E5=9B=BE=E4=BE=8B?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- README.md | 41 +++++++++++++++++++++++++++++++++++++++++ pom.xml | 8 ++++++++ 2 files changed, 49 insertions(+) diff --git a/README.md b/README.md index 796d57fba..778346524 100644 --- a/README.md +++ b/README.md @@ -100,6 +100,47 @@ 17. 在线构建器:拖动表单元素生成相应的HTML代码。 18. 连接池监视:监视当前系统数据库连接池状态,可进行分析SQL找出系统性能瓶颈。 +## 演示图例 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+

+
+ ## 在线体验 - admin/admin123 diff --git a/pom.xml b/pom.xml index a197fd391..43c0aead1 100644 --- a/pom.xml +++ b/pom.xml @@ -248,6 +248,14 @@ + + local + + + local + debug + + dev From 01d2b6ded9c93a34d38f363f0252505ee024fe0a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E7=96=AF=E7=8B=82=E7=9A=84=E7=8B=AE=E5=AD=90li?= <15040126243@163.com> Date: Thu, 27 May 2021 22:06:36 +0800 Subject: [PATCH 09/41] =?UTF-8?q?update=20=E4=BC=98=E5=8C=96dataScope?= =?UTF-8?q?=E5=8F=82=E6=95=B0=E9=98=B2=E6=AD=A2=E6=B3=A8=E5=85=A5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../framework/aspectj/DataScopeAspect.java | 41 +++++++++++++------ 1 file changed, 29 insertions(+), 12 deletions(-) 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 4d2f9bbd1..ce23af09e 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 @@ -68,6 +68,7 @@ public class DataScopeAspect @Before("dataScopePointCut()") public void doBefore(JoinPoint point) throws Throwable { + clearDataScope(point); handleDataScope(point); } @@ -144,18 +145,8 @@ public class DataScopeAspect if (StrUtil.isNotBlank(sqlString.toString())) { - Object params = joinPoint.getArgs()[0]; - if (Validator.isNotNull(params)) - { - try { - Method getParams = params.getClass().getDeclaredMethod("getParams", null); - Map invoke = (Map) getParams.invoke(params, null); - invoke.put(DATA_SCOPE, " AND (" + sqlString.substring(4) + ")"); - } catch (Exception e) { - e.printStackTrace(); - } - } - } + putDataScope(joinPoint, " AND (" + sqlString.substring(4) + ")"); + } } /** @@ -173,4 +164,30 @@ public class DataScopeAspect } return null; } + + /** + * 拼接权限sql前先清空params.dataScope参数防止注入 + */ + private void clearDataScope(final JoinPoint joinPoint) + { + Object params = joinPoint.getArgs()[0]; + if (Validator.isNotNull(params)) + { + putDataScope(joinPoint, ""); + } + } + + private static void putDataScope(JoinPoint joinPoint, String sql) { + Object params = joinPoint.getArgs()[0]; + if (Validator.isNotNull(params)) + { + try { + Method getParams = params.getClass().getDeclaredMethod("getParams", null); + Map invoke = (Map) getParams.invoke(params, null); + invoke.put(DATA_SCOPE, sql); + } catch (Exception e) { + // 方法未找到 不处理 + } + } + } } From 38d2a975821bf4cbf5986840cd34f410adf0b6a3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E7=96=AF=E7=8B=82=E7=9A=84=E7=8B=AE=E5=AD=90li?= <15040126243@163.com> Date: Fri, 28 May 2021 10:30:11 +0800 Subject: [PATCH 10/41] =?UTF-8?q?update=20=E4=BC=98=E5=8C=96=E5=8F=82?= =?UTF-8?q?=E6=95=B0&=E5=AD=97=E5=85=B8=E7=BC=93=E5=AD=98=E6=93=8D?= =?UTF-8?q?=E4=BD=9C?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../system/mapper/SysDictDataMapper.java | 10 + .../service/impl/SysDictDataServiceImpl.java | 184 ++++----- .../service/impl/SysDictTypeServiceImpl.java | 374 +++++++++--------- 3 files changed, 295 insertions(+), 273 deletions(-) diff --git a/ruoyi-system/src/main/java/com/ruoyi/system/mapper/SysDictDataMapper.java b/ruoyi-system/src/main/java/com/ruoyi/system/mapper/SysDictDataMapper.java index 7f09d7c70..3d8971d69 100644 --- a/ruoyi-system/src/main/java/com/ruoyi/system/mapper/SysDictDataMapper.java +++ b/ruoyi-system/src/main/java/com/ruoyi/system/mapper/SysDictDataMapper.java @@ -1,8 +1,11 @@ package com.ruoyi.system.mapper; +import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; import com.ruoyi.common.core.domain.entity.SysDictData; import com.ruoyi.common.core.page.BaseMapperPlus; +import java.util.List; + /** * 字典表 数据层 * @@ -10,4 +13,11 @@ import com.ruoyi.common.core.page.BaseMapperPlus; */ public interface SysDictDataMapper extends BaseMapperPlus { + default List selectDictDataByType(String dictType) { + return selectList( + new LambdaQueryWrapper() + .eq(SysDictData::getStatus, "0") + .eq(SysDictData::getDictType, dictType) + .orderByAsc(SysDictData::getDictSort)); + } } 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 faae4aab5..70385659b 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,7 +11,6 @@ import com.ruoyi.system.mapper.SysDictDataMapper; import com.ruoyi.system.service.ISysDictDataService; import org.springframework.stereotype.Service; -import java.util.Arrays; import java.util.List; /** @@ -22,100 +21,103 @@ import java.util.List; @Service public class SysDictDataServiceImpl extends ServiceImpl implements ISysDictDataService { - @Override - public TableDataInfo selectPageDictDataList(SysDictData dictData) { - LambdaQueryWrapper lqw = new LambdaQueryWrapper() - .eq(StrUtil.isNotBlank(dictData.getDictType()), SysDictData::getDictType, dictData.getDictType()) - .like(StrUtil.isNotBlank(dictData.getDictLabel()), SysDictData::getDictLabel, dictData.getDictLabel()) - .eq(StrUtil.isNotBlank(dictData.getStatus()), SysDictData::getStatus, dictData.getStatus()) - .orderByAsc(SysDictData::getDictSort); - return PageUtils.buildDataInfo(page(PageUtils.buildPage(),lqw)); - } + @Override + public TableDataInfo selectPageDictDataList(SysDictData dictData) { + LambdaQueryWrapper lqw = new LambdaQueryWrapper() + .eq(StrUtil.isNotBlank(dictData.getDictType()), SysDictData::getDictType, dictData.getDictType()) + .like(StrUtil.isNotBlank(dictData.getDictLabel()), SysDictData::getDictLabel, dictData.getDictLabel()) + .eq(StrUtil.isNotBlank(dictData.getStatus()), SysDictData::getStatus, dictData.getStatus()) + .orderByAsc(SysDictData::getDictSort); + return PageUtils.buildDataInfo(page(PageUtils.buildPage(), lqw)); + } - /** - * 根据条件分页查询字典数据 - * - * @param dictData 字典数据信息 - * @return 字典数据集合信息 - */ - @Override - public List selectDictDataList(SysDictData dictData) { - return list(new LambdaQueryWrapper() - .eq(StrUtil.isNotBlank(dictData.getDictType()), SysDictData::getDictType, dictData.getDictType()) - .like(StrUtil.isNotBlank(dictData.getDictLabel()), SysDictData::getDictLabel, dictData.getDictLabel()) - .eq(StrUtil.isNotBlank(dictData.getStatus()), SysDictData::getStatus, dictData.getStatus()) - .orderByAsc(SysDictData::getDictSort)); - } + /** + * 根据条件分页查询字典数据 + * + * @param dictData 字典数据信息 + * @return 字典数据集合信息 + */ + @Override + public List selectDictDataList(SysDictData dictData) { + return list(new LambdaQueryWrapper() + .eq(StrUtil.isNotBlank(dictData.getDictType()), SysDictData::getDictType, dictData.getDictType()) + .like(StrUtil.isNotBlank(dictData.getDictLabel()), SysDictData::getDictLabel, dictData.getDictLabel()) + .eq(StrUtil.isNotBlank(dictData.getStatus()), SysDictData::getStatus, dictData.getStatus()) + .orderByAsc(SysDictData::getDictSort)); + } - /** - * 根据字典类型和字典键值查询字典数据信息 - * - * @param dictType 字典类型 - * @param dictValue 字典键值 - * @return 字典标签 - */ - @Override - public String selectDictLabel(String dictType, String dictValue) { - return getOne(new LambdaQueryWrapper() - .select(SysDictData::getDictLabel) - .eq(SysDictData::getDictType, dictType) - .eq(SysDictData::getDictValue, dictValue)) - .getDictLabel(); - } + /** + * 根据字典类型和字典键值查询字典数据信息 + * + * @param dictType 字典类型 + * @param dictValue 字典键值 + * @return 字典标签 + */ + @Override + public String selectDictLabel(String dictType, String dictValue) { + return getOne(new LambdaQueryWrapper() + .select(SysDictData::getDictLabel) + .eq(SysDictData::getDictType, dictType) + .eq(SysDictData::getDictValue, dictValue)) + .getDictLabel(); + } - /** - * 根据字典数据ID查询信息 - * - * @param dictCode 字典数据ID - * @return 字典数据 - */ - @Override - public SysDictData selectDictDataById(Long dictCode) { - return getById(dictCode); - } + /** + * 根据字典数据ID查询信息 + * + * @param dictCode 字典数据ID + * @return 字典数据 + */ + @Override + public SysDictData selectDictDataById(Long dictCode) { + return getById(dictCode); + } - /** - * 批量删除字典数据信息 - * - * @param dictCodes 需要删除的字典数据ID - * @return 结果 - */ - @Override - public int deleteDictDataByIds(Long[] dictCodes) { - int row = baseMapper.deleteBatchIds(Arrays.asList(dictCodes)); - if (row > 0) { - DictUtils.clearDictCache(); - } - return row; - } + /** + * 批量删除字典数据信息 + * + * @param dictCodes 需要删除的字典数据ID + * @return 结果 + */ + @Override + public void deleteDictDataByIds(Long[] dictCodes) { + for (Long dictCode : dictCodes) { + SysDictData data = selectDictDataById(dictCode); + baseMapper.deleteById(dictCode); + List dictDatas = baseMapper.selectDictDataByType(data.getDictType()); + DictUtils.setDictCache(data.getDictType(), dictDatas); + } + } - /** - * 新增保存字典数据信息 - * - * @param dictData 字典数据信息 - * @return 结果 - */ - @Override - public int insertDictData(SysDictData dictData) { - int row = baseMapper.insert(dictData); - if (row > 0) { - DictUtils.clearDictCache(); - } - return row; - } + /** + * 新增保存字典数据信息 + * + * @param data 字典数据信息 + * @return 结果 + */ + @Override + public int insertDictData(SysDictData data) { + int row = baseMapper.insert(data); + if (row > 0) { + List dictDatas = baseMapper.selectDictDataByType(data.getDictType()); + DictUtils.setDictCache(data.getDictType(), dictDatas); + } + return row; + } - /** - * 修改保存字典数据信息 - * - * @param dictData 字典数据信息 - * @return 结果 - */ - @Override - public int updateDictData(SysDictData dictData) { - int row = baseMapper.updateById(dictData); - if (row > 0) { - DictUtils.clearDictCache(); - } - return row; - } + /** + * 修改保存字典数据信息 + * + * @param data 字典数据信息 + * @return 结果 + */ + @Override + public int updateDictData(SysDictData data) { + int row = baseMapper.updateById(data); + if (row > 0) { + List dictDatas = baseMapper.selectDictDataByType(data.getDictType()); + DictUtils.setDictCache(data.getDictType(), dictDatas); + } + return row; + } } 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 87acff4fc..79a4036ed 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,7 +21,6 @@ import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Transactional; import javax.annotation.PostConstruct; -import java.util.Arrays; import java.util.List; import java.util.Map; @@ -33,197 +32,208 @@ import java.util.Map; @Service public class SysDictTypeServiceImpl extends ServiceImpl implements ISysDictTypeService { - @Autowired - private SysDictDataMapper dictDataMapper; + @Autowired + private SysDictTypeMapper dictTypeMapper; - /** - * 项目启动时,初始化字典到缓存 - */ - @PostConstruct - public void init() { - List dictTypeList = list(); - for (SysDictType dictType : dictTypeList) { - List dictDatas = dictDataMapper.selectList( - new LambdaQueryWrapper() - .eq(SysDictData::getStatus, 0) - .eq(SysDictData::getDictType, dictType.getDictType()) - .orderByAsc(SysDictData::getDictSort)); - DictUtils.setDictCache(dictType.getDictType(), dictDatas); - } - } + @Autowired + private SysDictDataMapper dictDataMapper; - @Override - public TableDataInfo selectPageDictTypeList(SysDictType dictType) { - Map params = dictType.getParams(); - LambdaQueryWrapper lqw = new LambdaQueryWrapper() - .like(StrUtil.isNotBlank(dictType.getDictName()), SysDictType::getDictName, dictType.getDictName()) - .eq(StrUtil.isNotBlank(dictType.getStatus()), SysDictType::getStatus, dictType.getStatus()) - .like(StrUtil.isNotBlank(dictType.getDictType()), SysDictType::getDictType, dictType.getDictType()) - .apply(Validator.isNotEmpty(params.get("beginTime")), - "date_format(create_time,'%y%m%d') >= date_format({0},'%y%m%d')", - params.get("beginTime")) - .apply(Validator.isNotEmpty(params.get("endTime")), - "date_format(create_time,'%y%m%d') <= date_format({0},'%y%m%d')", - params.get("endTime")); - return PageUtils.buildDataInfo(page(PageUtils.buildPage(),lqw)); - } + /** + * 项目启动时,初始化字典到缓存 + */ + @PostConstruct + public void init() { + loadingDictCache(); + } - /** - * 根据条件分页查询字典类型 - * - * @param dictType 字典类型信息 - * @return 字典类型集合信息 - */ - @Override - public List selectDictTypeList(SysDictType dictType) { - Map params = dictType.getParams(); - return list(new LambdaQueryWrapper() - .like(StrUtil.isNotBlank(dictType.getDictName()),SysDictType::getDictName, dictType.getDictName()) - .eq(StrUtil.isNotBlank(dictType.getStatus()),SysDictType::getStatus, dictType.getStatus()) - .like(StrUtil.isNotBlank(dictType.getDictType()),SysDictType::getDictType, dictType.getDictType()) - .apply(Validator.isNotEmpty(params.get("beginTime")), - "date_format(create_time,'%y%m%d') >= date_format({0},'%y%m%d')", - params.get("beginTime")) - .apply(Validator.isNotEmpty(params.get("endTime")), - "date_format(create_time,'%y%m%d') <= date_format({0},'%y%m%d')", - params.get("endTime"))); - } + @Override + public TableDataInfo selectPageDictTypeList(SysDictType dictType) { + Map params = dictType.getParams(); + LambdaQueryWrapper lqw = new LambdaQueryWrapper() + .like(StrUtil.isNotBlank(dictType.getDictName()), SysDictType::getDictName, dictType.getDictName()) + .eq(StrUtil.isNotBlank(dictType.getStatus()), SysDictType::getStatus, dictType.getStatus()) + .like(StrUtil.isNotBlank(dictType.getDictType()), SysDictType::getDictType, dictType.getDictType()) + .apply(Validator.isNotEmpty(params.get("beginTime")), + "date_format(create_time,'%y%m%d') >= date_format({0},'%y%m%d')", + params.get("beginTime")) + .apply(Validator.isNotEmpty(params.get("endTime")), + "date_format(create_time,'%y%m%d') <= date_format({0},'%y%m%d')", + params.get("endTime")); + return PageUtils.buildDataInfo(page(PageUtils.buildPage(), lqw)); + } - /** - * 根据所有字典类型 - * - * @return 字典类型集合信息 - */ - @Override - public List selectDictTypeAll() { - return list(); - } + /** + * 根据条件分页查询字典类型 + * + * @param dictType 字典类型信息 + * @return 字典类型集合信息 + */ + @Override + public List selectDictTypeList(SysDictType dictType) { + Map params = dictType.getParams(); + return list(new LambdaQueryWrapper() + .like(StrUtil.isNotBlank(dictType.getDictName()), SysDictType::getDictName, dictType.getDictName()) + .eq(StrUtil.isNotBlank(dictType.getStatus()), SysDictType::getStatus, dictType.getStatus()) + .like(StrUtil.isNotBlank(dictType.getDictType()), SysDictType::getDictType, dictType.getDictType()) + .apply(Validator.isNotEmpty(params.get("beginTime")), + "date_format(create_time,'%y%m%d') >= date_format({0},'%y%m%d')", + params.get("beginTime")) + .apply(Validator.isNotEmpty(params.get("endTime")), + "date_format(create_time,'%y%m%d') <= date_format({0},'%y%m%d')", + params.get("endTime"))); + } - /** - * 根据字典类型查询字典数据 - * - * @param dictType 字典类型 - * @return 字典数据集合信息 - */ - @Override - public List selectDictDataByType(String dictType) { - List dictDatas = DictUtils.getDictCache(dictType); - if (CollUtil.isNotEmpty(dictDatas)) { - return dictDatas; - } - dictDatas = dictDataMapper.selectList(new LambdaQueryWrapper() - .eq(SysDictData::getStatus, 0) - .eq(SysDictData::getDictType, dictType) - .orderByAsc(SysDictData::getDictSort)); - if (CollUtil.isNotEmpty(dictDatas)) { - DictUtils.setDictCache(dictType, dictDatas); - return dictDatas; - } - return null; - } + /** + * 根据所有字典类型 + * + * @return 字典类型集合信息 + */ + @Override + public List selectDictTypeAll() { + return list(); + } - /** - * 根据字典类型ID查询信息 - * - * @param dictId 字典类型ID - * @return 字典类型 - */ - @Override - public SysDictType selectDictTypeById(Long dictId) { - return getById(dictId); - } + /** + * 根据字典类型查询字典数据 + * + * @param dictType 字典类型 + * @return 字典数据集合信息 + */ + @Override + public List selectDictDataByType(String dictType) { + List dictDatas = DictUtils.getDictCache(dictType); + if (CollUtil.isNotEmpty(dictDatas)) { + return dictDatas; + } + dictDatas = dictDataMapper.selectDictDataByType(dictType); + if (CollUtil.isNotEmpty(dictDatas)) { + DictUtils.setDictCache(dictType, dictDatas); + return dictDatas; + } + return null; + } - /** - * 根据字典类型查询信息 - * - * @param dictType 字典类型 - * @return 字典类型 - */ - @Override - public SysDictType selectDictTypeByType(String dictType) { - return getOne(new LambdaQueryWrapper().eq(SysDictType::getDictType, dictType)); - } + /** + * 根据字典类型ID查询信息 + * + * @param dictId 字典类型ID + * @return 字典类型 + */ + @Override + public SysDictType selectDictTypeById(Long dictId) { + return getById(dictId); + } - /** - * 批量删除字典类型信息 - * - * @param dictIds 需要删除的字典ID - * @return 结果 - */ - @Override - public int deleteDictTypeByIds(Long[] dictIds) { - for (Long dictId : dictIds) { - SysDictType dictType = selectDictTypeById(dictId); - if (dictDataMapper.selectCount(new LambdaQueryWrapper() - .eq(SysDictData::getDictType, dictType.getDictType())) > 0) { - throw new CustomException(String.format("%1$s已分配,不能删除", dictType.getDictName())); - } - } - int count = baseMapper.deleteBatchIds(Arrays.asList(dictIds)); - if (count > 0) { - DictUtils.clearDictCache(); - } - return count; - } + /** + * 根据字典类型查询信息 + * + * @param dictType 字典类型 + * @return 字典类型 + */ + @Override + public SysDictType selectDictTypeByType(String dictType) { + return getOne(new LambdaQueryWrapper().eq(SysDictType::getDictType, dictType)); + } - /** - * 清空缓存数据 - */ - @Override - public void clearCache() { - DictUtils.clearDictCache(); - } + /** + * 批量删除字典类型信息 + * + * @param dictIds 需要删除的字典ID + * @return 结果 + */ + @Override + public void deleteDictTypeByIds(Long[] dictIds) { + for (Long dictId : dictIds) { + SysDictType dictType = selectDictTypeById(dictId); + if (dictDataMapper.selectCount(new LambdaQueryWrapper() + .eq(SysDictData::getDictType, dictType.getDictType())) > 0) { + throw new CustomException(String.format("%1$s已分配,不能删除", dictType.getDictName())); + } + dictTypeMapper.deleteById(dictId); + DictUtils.removeDictCache(dictType.getDictType()); + } + } - /** - * 新增保存字典类型信息 - * - * @param dictType 字典类型信息 - * @return 结果 - */ - @Override - public int insertDictType(SysDictType dictType) { - int row = baseMapper.insert(dictType); - if (row > 0) { - DictUtils.clearDictCache(); - } - return row; - } + /** + * 加载字典缓存数据 + */ + @Override + public void loadingDictCache() { + List dictTypeList = list(); + for (SysDictType dictType : dictTypeList) { + List dictDatas = dictDataMapper.selectDictDataByType(dictType.getDictType()); + DictUtils.setDictCache(dictType.getDictType(), dictDatas); + } + } - /** - * 修改保存字典类型信息 - * - * @param dictType 字典类型信息 - * @return 结果 - */ - @Override - @Transactional - public int updateDictType(SysDictType dictType) { - SysDictType oldDict = getById(dictType.getDictId()); - dictDataMapper.update(null, new LambdaUpdateWrapper() - .set(SysDictData::getDictType, dictType.getDictType()) - .eq(SysDictData::getDictType, oldDict.getDictType())); - int row = baseMapper.updateById(dictType); - if (row > 0) { - DictUtils.clearDictCache(); - } - return row; - } + /** + * 清空字典缓存数据 + */ + @Override + public void clearDictCache() { + DictUtils.clearDictCache(); + } - /** - * 校验字典类型称是否唯一 - * - * @param dict 字典类型 - * @return 结果 - */ - @Override - public String checkDictTypeUnique(SysDictType dict) { - Long dictId = Validator.isNull(dict.getDictId()) ? -1L : dict.getDictId(); - SysDictType dictType = getOne(new LambdaQueryWrapper() - .eq(SysDictType::getDictType, dict.getDictType()) - .last("limit 1")); - if (Validator.isNotNull(dictType) && dictType.getDictId().longValue() != dictId.longValue()) { - return UserConstants.NOT_UNIQUE; - } - return UserConstants.UNIQUE; - } + /** + * 重置字典缓存数据 + */ + @Override + public void resetDictCache() { + clearDictCache(); + loadingDictCache(); + } + + /** + * 新增保存字典类型信息 + * + * @param dict 字典类型信息 + * @return 结果 + */ + @Override + public int insertDictType(SysDictType dict) { + int row = baseMapper.insert(dict); + if (row > 0) { + DictUtils.setDictCache(dict.getDictType(), null); + } + return row; + } + + /** + * 修改保存字典类型信息 + * + * @param dict 字典类型信息 + * @return 结果 + */ + @Override + @Transactional + public int updateDictType(SysDictType dict) { + SysDictType oldDict = getById(dict.getDictId()); + dictDataMapper.update(null, new LambdaUpdateWrapper() + .set(SysDictData::getDictType, dict.getDictType()) + .eq(SysDictData::getDictType, oldDict.getDictType())); + int row = baseMapper.updateById(dict); + if (row > 0) { + List dictDatas = dictDataMapper.selectDictDataByType(dict.getDictType()); + DictUtils.setDictCache(dict.getDictType(), dictDatas); + } + return row; + } + + /** + * 校验字典类型称是否唯一 + * + * @param dict 字典类型 + * @return 结果 + */ + @Override + public String checkDictTypeUnique(SysDictType dict) { + Long dictId = Validator.isNull(dict.getDictId()) ? -1L : dict.getDictId(); + SysDictType dictType = getOne(new LambdaQueryWrapper() + .eq(SysDictType::getDictType, dict.getDictType()) + .last("limit 1")); + if (Validator.isNotNull(dictType) && dictType.getDictId().longValue() != dictId.longValue()) { + return UserConstants.NOT_UNIQUE; + } + return UserConstants.UNIQUE; + } } From e523764b0f300e5055d6f4bc680aa40d2590504f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E7=96=AF=E7=8B=82=E7=9A=84=E7=8B=AE=E5=AD=90li?= <15040126243@163.com> Date: Sat, 29 May 2021 19:14:45 +0800 Subject: [PATCH 11/41] =?UTF-8?q?=E5=8F=91=E5=B8=83=202.2.1?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- README.md | 46 +++ pom.xml | 10 +- .../system/SysConfigController.java | 13 +- .../system/SysDictDataController.java | 5 +- .../system/SysDictTypeController.java | 13 +- .../src/main/resources/application-dev.yml | 14 +- .../com/ruoyi/common/utils/DictUtils.java | 10 + .../framework/aspectj/DataScopeAspect.java | 41 +- .../system/mapper/SysDictDataMapper.java | 10 + .../system/service/ISysConfigService.java | 16 +- .../system/service/ISysDictDataService.java | 2 +- .../system/service/ISysDictTypeService.java | 16 +- .../service/impl/SysConfigServiceImpl.java | 337 ++++++++-------- .../service/impl/SysDictDataServiceImpl.java | 184 ++++----- .../service/impl/SysDictTypeServiceImpl.java | 374 +++++++++--------- .../resources/mapper/system/SysDeptMapper.xml | 13 +- .../resources/mapper/system/SysRoleMapper.xml | 10 +- .../resources/mapper/system/SysUserMapper.xml | 10 +- ruoyi-ui/package.json | 2 +- ruoyi-ui/src/api/system/config.js | 6 +- ruoyi-ui/src/api/system/dict/type.js | 6 +- ruoyi-ui/src/views/index.vue | 13 +- ruoyi-ui/src/views/system/config/index.vue | 14 +- ruoyi-ui/src/views/system/dict/index.vue | 14 +- 24 files changed, 668 insertions(+), 511 deletions(-) diff --git a/README.md b/README.md index 796d57fba..2a58722aa 100644 --- a/README.md +++ b/README.md @@ -79,6 +79,11 @@ 关于vue与boot整合部署 * [前端静态资源如何整合到后端访问](https://doc.ruoyi.vip/ruoyi-vue/other/faq.html#前端静态资源如何整合到后端访问) +关于修改包名 +* 将文件夹全部修改为 com.xxx +* 使用IDEA全局替换 com.ruoyi 替换为 com.xxx +* 严禁手动修改 + ## 内置功能 1. 用户管理:用户是系统操作者,该功能主要完成系统用户配置。 @@ -100,6 +105,47 @@ 17. 在线构建器:拖动表单元素生成相应的HTML代码。 18. 连接池监视:监视当前系统数据库连接池状态,可进行分析SQL找出系统性能瓶颈。 +## 演示图例 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+

+
+ ## 在线体验 - admin/admin123 diff --git a/pom.xml b/pom.xml index a197fd391..6d52bf68b 100644 --- a/pom.xml +++ b/pom.xml @@ -13,7 +13,7 @@ RuoYi-Vue-Plus后台管理系统 - 2.2.0 + 2.2.1 2.3.11.RELEASE UTF-8 UTF-8 @@ -248,6 +248,14 @@ + + local + + + local + debug + + dev diff --git a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/system/SysConfigController.java b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/system/SysConfigController.java index d26de0ad8..c8e919194 100644 --- a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/system/SysConfigController.java +++ b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/system/SysConfigController.java @@ -20,7 +20,7 @@ import java.util.List; /** * 参数配置 信息操作处理 - * + * * @author ruoyi */ @RestController @@ -110,18 +110,19 @@ public class SysConfigController extends BaseController @DeleteMapping("/{configIds}") public AjaxResult remove(@PathVariable Long[] configIds) { - return toAjax(configService.deleteConfigByIds(configIds)); + configService.deleteConfigByIds(configIds); + return success(); } /** - * 清空缓存 + * 刷新参数缓存 */ @PreAuthorize("@ss.hasPermi('system:config:remove')") @Log(title = "参数管理", businessType = BusinessType.CLEAN) - @DeleteMapping("/clearCache") - public AjaxResult clearCache() + @DeleteMapping("/refreshCache") + public AjaxResult refreshCache() { - configService.clearCache(); + configService.resetConfigCache(); return AjaxResult.success(); } } diff --git a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/system/SysDictDataController.java b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/system/SysDictDataController.java index 157030fbd..a272a6e97 100644 --- a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/system/SysDictDataController.java +++ b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/system/SysDictDataController.java @@ -21,7 +21,7 @@ import java.util.List; /** * 数据字典信息 - * + * * @author ruoyi */ @RestController @@ -107,6 +107,7 @@ public class SysDictDataController extends BaseController @DeleteMapping("/{dictCodes}") public AjaxResult remove(@PathVariable Long[] dictCodes) { - return toAjax(dictDataService.deleteDictDataByIds(dictCodes)); + dictDataService.deleteDictDataByIds(dictCodes); + return success(); } } diff --git a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/system/SysDictTypeController.java b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/system/SysDictTypeController.java index 306b6f2b0..e2e06253e 100644 --- a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/system/SysDictTypeController.java +++ b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/system/SysDictTypeController.java @@ -19,7 +19,7 @@ import java.util.List; /** * 数据字典信息 - * + * * @author ruoyi */ @RestController @@ -96,18 +96,19 @@ public class SysDictTypeController extends BaseController @DeleteMapping("/{dictIds}") public AjaxResult remove(@PathVariable Long[] dictIds) { - return toAjax(dictTypeService.deleteDictTypeByIds(dictIds)); + dictTypeService.deleteDictTypeByIds(dictIds); + return success(); } /** - * 清空缓存 + * 刷新字典缓存 */ @PreAuthorize("@ss.hasPermi('system:dict:remove')") @Log(title = "字典类型", businessType = BusinessType.CLEAN) - @DeleteMapping("/clearCache") - public AjaxResult clearCache() + @DeleteMapping("/refreshCache") + public AjaxResult refreshCache() { - dictTypeService.clearCache(); + dictTypeService.resetDictCache(); return AjaxResult.success(); } diff --git a/ruoyi-admin/src/main/resources/application-dev.yml b/ruoyi-admin/src/main/resources/application-dev.yml index 3a2a03d64..06456dd8d 100644 --- a/ruoyi-admin/src/main/resources/application-dev.yml +++ b/ruoyi-admin/src/main/resources/application-dev.yml @@ -1,7 +1,3 @@ ---- -server: - port: 8081 ---- # 数据源配置 spring: datasource: @@ -10,9 +6,9 @@ spring: druid: # 主库数据源 master: - url: jdbc:mysql://39.101.143.184:3306/ruoyi-vue?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=true&serverTimezone=GMT%2B8&autoReconnect=true - username: ruoyi-vue - password: ryvue + url: jdbc:mysql://localhost:3306/ry-vue?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=true&serverTimezone=GMT%2B8&autoReconnect=true + username: root + password: root # 从库数据源 slave: # 从数据源开关/默认关闭 @@ -62,13 +58,13 @@ spring: # redis 配置 redis: # 地址 - host: 39.101.143.184 + host: localhost # 端口,默认为6379 port: 6379 # 数据库索引 database: 0 # 密码 - password: ryvue + password: # 连接超时时间 timeout: 10s lettuce: diff --git a/ruoyi-common/src/main/java/com/ruoyi/common/utils/DictUtils.java b/ruoyi-common/src/main/java/com/ruoyi/common/utils/DictUtils.java index 45addb3cb..7da0c6699 100644 --- a/ruoyi-common/src/main/java/com/ruoyi/common/utils/DictUtils.java +++ b/ruoyi-common/src/main/java/com/ruoyi/common/utils/DictUtils.java @@ -155,6 +155,16 @@ public class DictUtils return StrUtil.strip(propertyString.toString(), null, separator); } + /** + * 删除指定字典缓存 + * + * @param key 字典键 + */ + public static void removeDictCache(String key) + { + SpringUtils.getBean(RedisCache.class).deleteObject(getCacheKey(key)); + } + /** * 清空字典缓存 */ 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 4d2f9bbd1..0a766e53f 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 @@ -68,6 +68,7 @@ public class DataScopeAspect @Before("dataScopePointCut()") public void doBefore(JoinPoint point) throws Throwable { + clearDataScope(point); handleDataScope(point); } @@ -144,18 +145,8 @@ public class DataScopeAspect if (StrUtil.isNotBlank(sqlString.toString())) { - Object params = joinPoint.getArgs()[0]; - if (Validator.isNotNull(params)) - { - try { - Method getParams = params.getClass().getDeclaredMethod("getParams", null); - Map invoke = (Map) getParams.invoke(params, null); - invoke.put(DATA_SCOPE, " AND (" + sqlString.substring(4) + ")"); - } catch (Exception e) { - e.printStackTrace(); - } - } - } + putDataScope(joinPoint, sqlString.substring(4)); + } } /** @@ -173,4 +164,30 @@ public class DataScopeAspect } return null; } + + /** + * 拼接权限sql前先清空params.dataScope参数防止注入 + */ + private void clearDataScope(final JoinPoint joinPoint) + { + Object params = joinPoint.getArgs()[0]; + if (Validator.isNotNull(params)) + { + putDataScope(joinPoint, ""); + } + } + + private static void putDataScope(JoinPoint joinPoint, String sql) { + Object params = joinPoint.getArgs()[0]; + if (Validator.isNotNull(params)) + { + try { + Method getParams = params.getClass().getDeclaredMethod("getParams", null); + Map invoke = (Map) getParams.invoke(params, null); + invoke.put(DATA_SCOPE, sql); + } catch (Exception e) { + // 方法未找到 不处理 + } + } + } } diff --git a/ruoyi-system/src/main/java/com/ruoyi/system/mapper/SysDictDataMapper.java b/ruoyi-system/src/main/java/com/ruoyi/system/mapper/SysDictDataMapper.java index 7f09d7c70..3d8971d69 100644 --- a/ruoyi-system/src/main/java/com/ruoyi/system/mapper/SysDictDataMapper.java +++ b/ruoyi-system/src/main/java/com/ruoyi/system/mapper/SysDictDataMapper.java @@ -1,8 +1,11 @@ package com.ruoyi.system.mapper; +import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; import com.ruoyi.common.core.domain.entity.SysDictData; import com.ruoyi.common.core.page.BaseMapperPlus; +import java.util.List; + /** * 字典表 数据层 * @@ -10,4 +13,11 @@ import com.ruoyi.common.core.page.BaseMapperPlus; */ public interface SysDictDataMapper extends BaseMapperPlus { + default List selectDictDataByType(String dictType) { + return selectList( + new LambdaQueryWrapper() + .eq(SysDictData::getStatus, "0") + .eq(SysDictData::getDictType, dictType) + .orderByAsc(SysDictData::getDictSort)); + } } diff --git a/ruoyi-system/src/main/java/com/ruoyi/system/service/ISysConfigService.java b/ruoyi-system/src/main/java/com/ruoyi/system/service/ISysConfigService.java index 83846275b..569ecf969 100644 --- a/ruoyi-system/src/main/java/com/ruoyi/system/service/ISysConfigService.java +++ b/ruoyi-system/src/main/java/com/ruoyi/system/service/ISysConfigService.java @@ -62,12 +62,22 @@ public interface ISysConfigService extends IServicePlus { * @param configIds 需要删除的参数ID * @return 结果 */ - public int deleteConfigByIds(Long[] configIds); + public void deleteConfigByIds(Long[] configIds); /** - * 清空缓存数据 + * 加载参数缓存数据 */ - public void clearCache(); + public void loadingConfigCache(); + + /** + * 清空参数缓存数据 + */ + public void clearConfigCache(); + + /** + * 重置参数缓存数据 + */ + public void resetConfigCache(); /** * 校验参数键名是否唯一 diff --git a/ruoyi-system/src/main/java/com/ruoyi/system/service/ISysDictDataService.java b/ruoyi-system/src/main/java/com/ruoyi/system/service/ISysDictDataService.java index 7cf20f028..5a19aa798 100644 --- a/ruoyi-system/src/main/java/com/ruoyi/system/service/ISysDictDataService.java +++ b/ruoyi-system/src/main/java/com/ruoyi/system/service/ISysDictDataService.java @@ -47,7 +47,7 @@ public interface ISysDictDataService extends IServicePlus { * @param dictCodes 需要删除的字典数据ID * @return 结果 */ - public int deleteDictDataByIds(Long[] dictCodes); + public void deleteDictDataByIds(Long[] dictCodes); /** * 新增保存字典数据信息 diff --git a/ruoyi-system/src/main/java/com/ruoyi/system/service/ISysDictTypeService.java b/ruoyi-system/src/main/java/com/ruoyi/system/service/ISysDictTypeService.java index 87b3c8843..a806cbd6c 100644 --- a/ruoyi-system/src/main/java/com/ruoyi/system/service/ISysDictTypeService.java +++ b/ruoyi-system/src/main/java/com/ruoyi/system/service/ISysDictTypeService.java @@ -62,12 +62,22 @@ public interface ISysDictTypeService extends IServicePlus { * @param dictIds 需要删除的字典ID * @return 结果 */ - public int deleteDictTypeByIds(Long[] dictIds); + public void deleteDictTypeByIds(Long[] dictIds); /** - * 清空缓存数据 + * 加载字典缓存数据 */ - public void clearCache(); + public void loadingDictCache(); + + /** + * 清空字典缓存数据 + */ + public void clearDictCache(); + + /** + * 重置字典缓存数据 + */ + public void resetDictCache(); /** * 新增保存字典类型信息 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 fbf6ec814..2376d8b57 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,7 +20,6 @@ import org.springframework.beans.factory.annotation.Autowired; 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; @@ -33,175 +32,191 @@ import java.util.Map; @Service public class SysConfigServiceImpl extends ServiceImpl implements ISysConfigService { - @Autowired - private RedisCache redisCache; + @Autowired + private SysConfigMapper configMapper; - /** - * 项目启动时,初始化参数到缓存 - */ - @PostConstruct - public void init() { - List configsList = baseMapper.selectList(new LambdaQueryWrapper<>()); - for (SysConfig config : configsList) { - redisCache.setCacheObject(getCacheKey(config.getConfigKey()), config.getConfigValue()); - } - } + @Autowired + private RedisCache redisCache; - @Override - public TableDataInfo selectPageConfigList(SysConfig config) { - Map params = config.getParams(); - LambdaQueryWrapper lqw = new LambdaQueryWrapper() - .like(StrUtil.isNotBlank(config.getConfigName()), SysConfig::getConfigName, config.getConfigName()) - .eq(StrUtil.isNotBlank(config.getConfigType()), SysConfig::getConfigType, config.getConfigType()) - .like(StrUtil.isNotBlank(config.getConfigKey()), SysConfig::getConfigKey, config.getConfigKey()) - .apply(Validator.isNotEmpty(params.get("beginTime")), - "date_format(create_time,'%y%m%d') >= date_format(#{0},'%y%m%d')", - params.get("beginTime")) - .apply(Validator.isNotEmpty(params.get("endTime")), - "date_format(create_time,'%y%m%d') <= date_format(#{0},'%y%m%d')", - params.get("endTime")); - return PageUtils.buildDataInfo(page(PageUtils.buildPage(), lqw)); - } + /** + * 项目启动时,初始化参数到缓存 + */ + @PostConstruct + public void init() { + loadingConfigCache(); + } - /** - * 查询参数配置信息 - * - * @param configId 参数配置ID - * @return 参数配置信息 - */ - @Override - @DataSource(DataSourceType.MASTER) - public SysConfig selectConfigById(Long configId) { - return baseMapper.selectById(configId); - } + @Override + public TableDataInfo selectPageConfigList(SysConfig config) { + Map params = config.getParams(); + LambdaQueryWrapper lqw = new LambdaQueryWrapper() + .like(StrUtil.isNotBlank(config.getConfigName()), SysConfig::getConfigName, config.getConfigName()) + .eq(StrUtil.isNotBlank(config.getConfigType()), SysConfig::getConfigType, config.getConfigType()) + .like(StrUtil.isNotBlank(config.getConfigKey()), SysConfig::getConfigKey, config.getConfigKey()) + .apply(Validator.isNotEmpty(params.get("beginTime")), + "date_format(create_time,'%y%m%d') >= date_format({0},'%y%m%d')", + params.get("beginTime")) + .apply(Validator.isNotEmpty(params.get("endTime")), + "date_format(create_time,'%y%m%d') <= date_format({0},'%y%m%d')", + params.get("endTime")); + return PageUtils.buildDataInfo(page(PageUtils.buildPage(), lqw)); + } - /** - * 根据键名查询参数配置信息 - * - * @param configKey 参数key - * @return 参数键值 - */ - @Override - public String selectConfigByKey(String configKey) { - String configValue = Convert.toStr(redisCache.getCacheObject(getCacheKey(configKey))); - if (Validator.isNotEmpty(configValue)) { - return configValue; - } - SysConfig retConfig = baseMapper.selectOne(new LambdaQueryWrapper() - .eq(SysConfig::getConfigKey, configKey)); - if (Validator.isNotNull(retConfig)) { - redisCache.setCacheObject(getCacheKey(configKey), retConfig.getConfigValue()); - return retConfig.getConfigValue(); - } - return StrUtil.EMPTY; - } + /** + * 查询参数配置信息 + * + * @param configId 参数配置ID + * @return 参数配置信息 + */ + @Override + @DataSource(DataSourceType.MASTER) + public SysConfig selectConfigById(Long configId) { + return baseMapper.selectById(configId); + } - /** - * 查询参数配置列表 - * - * @param config 参数配置信息 - * @return 参数配置集合 - */ - @Override - public List selectConfigList(SysConfig config) { - Map params = config.getParams(); - LambdaQueryWrapper lqw = new LambdaQueryWrapper() - .like(StrUtil.isNotBlank(config.getConfigName()), SysConfig::getConfigName, config.getConfigName()) - .eq(StrUtil.isNotBlank(config.getConfigType()), SysConfig::getConfigType, config.getConfigType()) - .like(StrUtil.isNotBlank(config.getConfigKey()), SysConfig::getConfigKey, config.getConfigKey()) - .apply(Validator.isNotEmpty(params.get("beginTime")), - "date_format(create_time,'%y%m%d') >= date_format(#{0},'%y%m%d')", - params.get("beginTime")) - .apply(Validator.isNotEmpty(params.get("endTime")), - "date_format(create_time,'%y%m%d') >= date_format(#{0},'%y%m%d')", - params.get("endTime")); - return baseMapper.selectList(lqw); - } + /** + * 根据键名查询参数配置信息 + * + * @param configKey 参数key + * @return 参数键值 + */ + @Override + public String selectConfigByKey(String configKey) { + String configValue = Convert.toStr(redisCache.getCacheObject(getCacheKey(configKey))); + if (Validator.isNotEmpty(configValue)) { + return configValue; + } + SysConfig retConfig = baseMapper.selectOne(new LambdaQueryWrapper() + .eq(SysConfig::getConfigKey, configKey)); + if (Validator.isNotNull(retConfig)) { + redisCache.setCacheObject(getCacheKey(configKey), retConfig.getConfigValue()); + return retConfig.getConfigValue(); + } + return StrUtil.EMPTY; + } - /** - * 新增参数配置 - * - * @param config 参数配置信息 - * @return 结果 - */ - @Override - public int insertConfig(SysConfig config) { - int row = baseMapper.insert(config); - if (row > 0) { - redisCache.setCacheObject(getCacheKey(config.getConfigKey()), config.getConfigValue()); - } - return row; - } + /** + * 查询参数配置列表 + * + * @param config 参数配置信息 + * @return 参数配置集合 + */ + @Override + public List selectConfigList(SysConfig config) { + Map params = config.getParams(); + LambdaQueryWrapper lqw = new LambdaQueryWrapper() + .like(StrUtil.isNotBlank(config.getConfigName()), SysConfig::getConfigName, config.getConfigName()) + .eq(StrUtil.isNotBlank(config.getConfigType()), SysConfig::getConfigType, config.getConfigType()) + .like(StrUtil.isNotBlank(config.getConfigKey()), SysConfig::getConfigKey, config.getConfigKey()) + .apply(Validator.isNotEmpty(params.get("beginTime")), + "date_format(create_time,'%y%m%d') >= date_format({0},'%y%m%d')", + params.get("beginTime")) + .apply(Validator.isNotEmpty(params.get("endTime")), + "date_format(create_time,'%y%m%d') <= date_format({0},'%y%m%d')", + params.get("endTime")); + return baseMapper.selectList(lqw); + } - /** - * 修改参数配置 - * - * @param config 参数配置信息 - * @return 结果 - */ - @Override - public int updateConfig(SysConfig config) { - int row = baseMapper.updateById(config); - if (row > 0) { - redisCache.setCacheObject(getCacheKey(config.getConfigKey()), config.getConfigValue()); - } - return row; - } + /** + * 新增参数配置 + * + * @param config 参数配置信息 + * @return 结果 + */ + @Override + public int insertConfig(SysConfig config) { + int row = baseMapper.insert(config); + if (row > 0) { + redisCache.setCacheObject(getCacheKey(config.getConfigKey()), config.getConfigValue()); + } + return row; + } - /** - * 批量删除参数信息 - * - * @param configIds 需要删除的参数ID - * @return 结果 - */ - @Override - public int deleteConfigByIds(Long[] configIds) { - for (Long configId : configIds) { - SysConfig config = selectConfigById(configId); - if (StrUtil.equals(UserConstants.YES, config.getConfigType())) { - throw new CustomException(String.format("内置参数【%1$s】不能删除 ", config.getConfigKey())); - } - } - int count = baseMapper.deleteBatchIds(Arrays.asList(configIds)); - if (count > 0) { - Collection keys = redisCache.keys(Constants.SYS_CONFIG_KEY + "*"); - redisCache.deleteObject(keys); - } - return count; - } + /** + * 修改参数配置 + * + * @param config 参数配置信息 + * @return 结果 + */ + @Override + public int updateConfig(SysConfig config) { + int row = baseMapper.updateById(config); + if (row > 0) { + redisCache.setCacheObject(getCacheKey(config.getConfigKey()), config.getConfigValue()); + } + return row; + } - /** - * 清空缓存数据 - */ - @Override - public void clearCache() { - Collection keys = redisCache.keys(Constants.SYS_CONFIG_KEY + "*"); - redisCache.deleteObject(keys); - } + /** + * 批量删除参数信息 + * + * @param configIds 需要删除的参数ID + * @return 结果 + */ + @Override + public void deleteConfigByIds(Long[] configIds) { + for (Long configId : configIds) { + SysConfig config = selectConfigById(configId); + if (StrUtil.equals(UserConstants.YES, config.getConfigType())) { + throw new CustomException(String.format("内置参数【%1$s】不能删除 ", config.getConfigKey())); + } + configMapper.deleteById(configId); + redisCache.deleteObject(getCacheKey(config.getConfigKey())); + } + } - /** - * 校验参数键名是否唯一 - * - * @param config 参数配置信息 - * @return 结果 - */ - @Override - public String checkConfigKeyUnique(SysConfig config) { - Long configId = Validator.isNull(config.getConfigId()) ? -1L : config.getConfigId(); - SysConfig info = baseMapper.selectOne(new LambdaQueryWrapper().eq(SysConfig::getConfigKey, config.getConfigKey())); - if (Validator.isNotNull(info) && info.getConfigId().longValue() != configId.longValue()) { - return UserConstants.NOT_UNIQUE; - } - return UserConstants.UNIQUE; - } + /** + * 加载参数缓存数据 + */ + @Override + public void loadingConfigCache() { + List configsList = selectConfigList(new SysConfig()); + for (SysConfig config : configsList) { + redisCache.setCacheObject(getCacheKey(config.getConfigKey()), config.getConfigValue()); + } + } - /** - * 设置cache key - * - * @param configKey 参数键 - * @return 缓存键key - */ - private String getCacheKey(String configKey) { - return Constants.SYS_CONFIG_KEY + configKey; - } + /** + * 清空参数缓存数据 + */ + @Override + public void clearConfigCache() { + Collection keys = redisCache.keys(Constants.SYS_CONFIG_KEY + "*"); + redisCache.deleteObject(keys); + } + + /** + * 重置参数缓存数据 + */ + @Override + public void resetConfigCache() { + clearConfigCache(); + loadingConfigCache(); + } + + /** + * 校验参数键名是否唯一 + * + * @param config 参数配置信息 + * @return 结果 + */ + @Override + public String checkConfigKeyUnique(SysConfig config) { + Long configId = Validator.isNull(config.getConfigId()) ? -1L : config.getConfigId(); + SysConfig info = baseMapper.selectOne(new LambdaQueryWrapper().eq(SysConfig::getConfigKey, config.getConfigKey())); + if (Validator.isNotNull(info) && info.getConfigId().longValue() != configId.longValue()) { + return UserConstants.NOT_UNIQUE; + } + return UserConstants.UNIQUE; + } + + /** + * 设置cache key + * + * @param configKey 参数键 + * @return 缓存键key + */ + private String getCacheKey(String configKey) { + return Constants.SYS_CONFIG_KEY + configKey; + } } 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 faae4aab5..70385659b 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,7 +11,6 @@ import com.ruoyi.system.mapper.SysDictDataMapper; import com.ruoyi.system.service.ISysDictDataService; import org.springframework.stereotype.Service; -import java.util.Arrays; import java.util.List; /** @@ -22,100 +21,103 @@ import java.util.List; @Service public class SysDictDataServiceImpl extends ServiceImpl implements ISysDictDataService { - @Override - public TableDataInfo selectPageDictDataList(SysDictData dictData) { - LambdaQueryWrapper lqw = new LambdaQueryWrapper() - .eq(StrUtil.isNotBlank(dictData.getDictType()), SysDictData::getDictType, dictData.getDictType()) - .like(StrUtil.isNotBlank(dictData.getDictLabel()), SysDictData::getDictLabel, dictData.getDictLabel()) - .eq(StrUtil.isNotBlank(dictData.getStatus()), SysDictData::getStatus, dictData.getStatus()) - .orderByAsc(SysDictData::getDictSort); - return PageUtils.buildDataInfo(page(PageUtils.buildPage(),lqw)); - } + @Override + public TableDataInfo selectPageDictDataList(SysDictData dictData) { + LambdaQueryWrapper lqw = new LambdaQueryWrapper() + .eq(StrUtil.isNotBlank(dictData.getDictType()), SysDictData::getDictType, dictData.getDictType()) + .like(StrUtil.isNotBlank(dictData.getDictLabel()), SysDictData::getDictLabel, dictData.getDictLabel()) + .eq(StrUtil.isNotBlank(dictData.getStatus()), SysDictData::getStatus, dictData.getStatus()) + .orderByAsc(SysDictData::getDictSort); + return PageUtils.buildDataInfo(page(PageUtils.buildPage(), lqw)); + } - /** - * 根据条件分页查询字典数据 - * - * @param dictData 字典数据信息 - * @return 字典数据集合信息 - */ - @Override - public List selectDictDataList(SysDictData dictData) { - return list(new LambdaQueryWrapper() - .eq(StrUtil.isNotBlank(dictData.getDictType()), SysDictData::getDictType, dictData.getDictType()) - .like(StrUtil.isNotBlank(dictData.getDictLabel()), SysDictData::getDictLabel, dictData.getDictLabel()) - .eq(StrUtil.isNotBlank(dictData.getStatus()), SysDictData::getStatus, dictData.getStatus()) - .orderByAsc(SysDictData::getDictSort)); - } + /** + * 根据条件分页查询字典数据 + * + * @param dictData 字典数据信息 + * @return 字典数据集合信息 + */ + @Override + public List selectDictDataList(SysDictData dictData) { + return list(new LambdaQueryWrapper() + .eq(StrUtil.isNotBlank(dictData.getDictType()), SysDictData::getDictType, dictData.getDictType()) + .like(StrUtil.isNotBlank(dictData.getDictLabel()), SysDictData::getDictLabel, dictData.getDictLabel()) + .eq(StrUtil.isNotBlank(dictData.getStatus()), SysDictData::getStatus, dictData.getStatus()) + .orderByAsc(SysDictData::getDictSort)); + } - /** - * 根据字典类型和字典键值查询字典数据信息 - * - * @param dictType 字典类型 - * @param dictValue 字典键值 - * @return 字典标签 - */ - @Override - public String selectDictLabel(String dictType, String dictValue) { - return getOne(new LambdaQueryWrapper() - .select(SysDictData::getDictLabel) - .eq(SysDictData::getDictType, dictType) - .eq(SysDictData::getDictValue, dictValue)) - .getDictLabel(); - } + /** + * 根据字典类型和字典键值查询字典数据信息 + * + * @param dictType 字典类型 + * @param dictValue 字典键值 + * @return 字典标签 + */ + @Override + public String selectDictLabel(String dictType, String dictValue) { + return getOne(new LambdaQueryWrapper() + .select(SysDictData::getDictLabel) + .eq(SysDictData::getDictType, dictType) + .eq(SysDictData::getDictValue, dictValue)) + .getDictLabel(); + } - /** - * 根据字典数据ID查询信息 - * - * @param dictCode 字典数据ID - * @return 字典数据 - */ - @Override - public SysDictData selectDictDataById(Long dictCode) { - return getById(dictCode); - } + /** + * 根据字典数据ID查询信息 + * + * @param dictCode 字典数据ID + * @return 字典数据 + */ + @Override + public SysDictData selectDictDataById(Long dictCode) { + return getById(dictCode); + } - /** - * 批量删除字典数据信息 - * - * @param dictCodes 需要删除的字典数据ID - * @return 结果 - */ - @Override - public int deleteDictDataByIds(Long[] dictCodes) { - int row = baseMapper.deleteBatchIds(Arrays.asList(dictCodes)); - if (row > 0) { - DictUtils.clearDictCache(); - } - return row; - } + /** + * 批量删除字典数据信息 + * + * @param dictCodes 需要删除的字典数据ID + * @return 结果 + */ + @Override + public void deleteDictDataByIds(Long[] dictCodes) { + for (Long dictCode : dictCodes) { + SysDictData data = selectDictDataById(dictCode); + baseMapper.deleteById(dictCode); + List dictDatas = baseMapper.selectDictDataByType(data.getDictType()); + DictUtils.setDictCache(data.getDictType(), dictDatas); + } + } - /** - * 新增保存字典数据信息 - * - * @param dictData 字典数据信息 - * @return 结果 - */ - @Override - public int insertDictData(SysDictData dictData) { - int row = baseMapper.insert(dictData); - if (row > 0) { - DictUtils.clearDictCache(); - } - return row; - } + /** + * 新增保存字典数据信息 + * + * @param data 字典数据信息 + * @return 结果 + */ + @Override + public int insertDictData(SysDictData data) { + int row = baseMapper.insert(data); + if (row > 0) { + List dictDatas = baseMapper.selectDictDataByType(data.getDictType()); + DictUtils.setDictCache(data.getDictType(), dictDatas); + } + return row; + } - /** - * 修改保存字典数据信息 - * - * @param dictData 字典数据信息 - * @return 结果 - */ - @Override - public int updateDictData(SysDictData dictData) { - int row = baseMapper.updateById(dictData); - if (row > 0) { - DictUtils.clearDictCache(); - } - return row; - } + /** + * 修改保存字典数据信息 + * + * @param data 字典数据信息 + * @return 结果 + */ + @Override + public int updateDictData(SysDictData data) { + int row = baseMapper.updateById(data); + if (row > 0) { + List dictDatas = baseMapper.selectDictDataByType(data.getDictType()); + DictUtils.setDictCache(data.getDictType(), dictDatas); + } + return row; + } } 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 87acff4fc..79a4036ed 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,7 +21,6 @@ import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Transactional; import javax.annotation.PostConstruct; -import java.util.Arrays; import java.util.List; import java.util.Map; @@ -33,197 +32,208 @@ import java.util.Map; @Service public class SysDictTypeServiceImpl extends ServiceImpl implements ISysDictTypeService { - @Autowired - private SysDictDataMapper dictDataMapper; + @Autowired + private SysDictTypeMapper dictTypeMapper; - /** - * 项目启动时,初始化字典到缓存 - */ - @PostConstruct - public void init() { - List dictTypeList = list(); - for (SysDictType dictType : dictTypeList) { - List dictDatas = dictDataMapper.selectList( - new LambdaQueryWrapper() - .eq(SysDictData::getStatus, 0) - .eq(SysDictData::getDictType, dictType.getDictType()) - .orderByAsc(SysDictData::getDictSort)); - DictUtils.setDictCache(dictType.getDictType(), dictDatas); - } - } + @Autowired + private SysDictDataMapper dictDataMapper; - @Override - public TableDataInfo selectPageDictTypeList(SysDictType dictType) { - Map params = dictType.getParams(); - LambdaQueryWrapper lqw = new LambdaQueryWrapper() - .like(StrUtil.isNotBlank(dictType.getDictName()), SysDictType::getDictName, dictType.getDictName()) - .eq(StrUtil.isNotBlank(dictType.getStatus()), SysDictType::getStatus, dictType.getStatus()) - .like(StrUtil.isNotBlank(dictType.getDictType()), SysDictType::getDictType, dictType.getDictType()) - .apply(Validator.isNotEmpty(params.get("beginTime")), - "date_format(create_time,'%y%m%d') >= date_format({0},'%y%m%d')", - params.get("beginTime")) - .apply(Validator.isNotEmpty(params.get("endTime")), - "date_format(create_time,'%y%m%d') <= date_format({0},'%y%m%d')", - params.get("endTime")); - return PageUtils.buildDataInfo(page(PageUtils.buildPage(),lqw)); - } + /** + * 项目启动时,初始化字典到缓存 + */ + @PostConstruct + public void init() { + loadingDictCache(); + } - /** - * 根据条件分页查询字典类型 - * - * @param dictType 字典类型信息 - * @return 字典类型集合信息 - */ - @Override - public List selectDictTypeList(SysDictType dictType) { - Map params = dictType.getParams(); - return list(new LambdaQueryWrapper() - .like(StrUtil.isNotBlank(dictType.getDictName()),SysDictType::getDictName, dictType.getDictName()) - .eq(StrUtil.isNotBlank(dictType.getStatus()),SysDictType::getStatus, dictType.getStatus()) - .like(StrUtil.isNotBlank(dictType.getDictType()),SysDictType::getDictType, dictType.getDictType()) - .apply(Validator.isNotEmpty(params.get("beginTime")), - "date_format(create_time,'%y%m%d') >= date_format({0},'%y%m%d')", - params.get("beginTime")) - .apply(Validator.isNotEmpty(params.get("endTime")), - "date_format(create_time,'%y%m%d') <= date_format({0},'%y%m%d')", - params.get("endTime"))); - } + @Override + public TableDataInfo selectPageDictTypeList(SysDictType dictType) { + Map params = dictType.getParams(); + LambdaQueryWrapper lqw = new LambdaQueryWrapper() + .like(StrUtil.isNotBlank(dictType.getDictName()), SysDictType::getDictName, dictType.getDictName()) + .eq(StrUtil.isNotBlank(dictType.getStatus()), SysDictType::getStatus, dictType.getStatus()) + .like(StrUtil.isNotBlank(dictType.getDictType()), SysDictType::getDictType, dictType.getDictType()) + .apply(Validator.isNotEmpty(params.get("beginTime")), + "date_format(create_time,'%y%m%d') >= date_format({0},'%y%m%d')", + params.get("beginTime")) + .apply(Validator.isNotEmpty(params.get("endTime")), + "date_format(create_time,'%y%m%d') <= date_format({0},'%y%m%d')", + params.get("endTime")); + return PageUtils.buildDataInfo(page(PageUtils.buildPage(), lqw)); + } - /** - * 根据所有字典类型 - * - * @return 字典类型集合信息 - */ - @Override - public List selectDictTypeAll() { - return list(); - } + /** + * 根据条件分页查询字典类型 + * + * @param dictType 字典类型信息 + * @return 字典类型集合信息 + */ + @Override + public List selectDictTypeList(SysDictType dictType) { + Map params = dictType.getParams(); + return list(new LambdaQueryWrapper() + .like(StrUtil.isNotBlank(dictType.getDictName()), SysDictType::getDictName, dictType.getDictName()) + .eq(StrUtil.isNotBlank(dictType.getStatus()), SysDictType::getStatus, dictType.getStatus()) + .like(StrUtil.isNotBlank(dictType.getDictType()), SysDictType::getDictType, dictType.getDictType()) + .apply(Validator.isNotEmpty(params.get("beginTime")), + "date_format(create_time,'%y%m%d') >= date_format({0},'%y%m%d')", + params.get("beginTime")) + .apply(Validator.isNotEmpty(params.get("endTime")), + "date_format(create_time,'%y%m%d') <= date_format({0},'%y%m%d')", + params.get("endTime"))); + } - /** - * 根据字典类型查询字典数据 - * - * @param dictType 字典类型 - * @return 字典数据集合信息 - */ - @Override - public List selectDictDataByType(String dictType) { - List dictDatas = DictUtils.getDictCache(dictType); - if (CollUtil.isNotEmpty(dictDatas)) { - return dictDatas; - } - dictDatas = dictDataMapper.selectList(new LambdaQueryWrapper() - .eq(SysDictData::getStatus, 0) - .eq(SysDictData::getDictType, dictType) - .orderByAsc(SysDictData::getDictSort)); - if (CollUtil.isNotEmpty(dictDatas)) { - DictUtils.setDictCache(dictType, dictDatas); - return dictDatas; - } - return null; - } + /** + * 根据所有字典类型 + * + * @return 字典类型集合信息 + */ + @Override + public List selectDictTypeAll() { + return list(); + } - /** - * 根据字典类型ID查询信息 - * - * @param dictId 字典类型ID - * @return 字典类型 - */ - @Override - public SysDictType selectDictTypeById(Long dictId) { - return getById(dictId); - } + /** + * 根据字典类型查询字典数据 + * + * @param dictType 字典类型 + * @return 字典数据集合信息 + */ + @Override + public List selectDictDataByType(String dictType) { + List dictDatas = DictUtils.getDictCache(dictType); + if (CollUtil.isNotEmpty(dictDatas)) { + return dictDatas; + } + dictDatas = dictDataMapper.selectDictDataByType(dictType); + if (CollUtil.isNotEmpty(dictDatas)) { + DictUtils.setDictCache(dictType, dictDatas); + return dictDatas; + } + return null; + } - /** - * 根据字典类型查询信息 - * - * @param dictType 字典类型 - * @return 字典类型 - */ - @Override - public SysDictType selectDictTypeByType(String dictType) { - return getOne(new LambdaQueryWrapper().eq(SysDictType::getDictType, dictType)); - } + /** + * 根据字典类型ID查询信息 + * + * @param dictId 字典类型ID + * @return 字典类型 + */ + @Override + public SysDictType selectDictTypeById(Long dictId) { + return getById(dictId); + } - /** - * 批量删除字典类型信息 - * - * @param dictIds 需要删除的字典ID - * @return 结果 - */ - @Override - public int deleteDictTypeByIds(Long[] dictIds) { - for (Long dictId : dictIds) { - SysDictType dictType = selectDictTypeById(dictId); - if (dictDataMapper.selectCount(new LambdaQueryWrapper() - .eq(SysDictData::getDictType, dictType.getDictType())) > 0) { - throw new CustomException(String.format("%1$s已分配,不能删除", dictType.getDictName())); - } - } - int count = baseMapper.deleteBatchIds(Arrays.asList(dictIds)); - if (count > 0) { - DictUtils.clearDictCache(); - } - return count; - } + /** + * 根据字典类型查询信息 + * + * @param dictType 字典类型 + * @return 字典类型 + */ + @Override + public SysDictType selectDictTypeByType(String dictType) { + return getOne(new LambdaQueryWrapper().eq(SysDictType::getDictType, dictType)); + } - /** - * 清空缓存数据 - */ - @Override - public void clearCache() { - DictUtils.clearDictCache(); - } + /** + * 批量删除字典类型信息 + * + * @param dictIds 需要删除的字典ID + * @return 结果 + */ + @Override + public void deleteDictTypeByIds(Long[] dictIds) { + for (Long dictId : dictIds) { + SysDictType dictType = selectDictTypeById(dictId); + if (dictDataMapper.selectCount(new LambdaQueryWrapper() + .eq(SysDictData::getDictType, dictType.getDictType())) > 0) { + throw new CustomException(String.format("%1$s已分配,不能删除", dictType.getDictName())); + } + dictTypeMapper.deleteById(dictId); + DictUtils.removeDictCache(dictType.getDictType()); + } + } - /** - * 新增保存字典类型信息 - * - * @param dictType 字典类型信息 - * @return 结果 - */ - @Override - public int insertDictType(SysDictType dictType) { - int row = baseMapper.insert(dictType); - if (row > 0) { - DictUtils.clearDictCache(); - } - return row; - } + /** + * 加载字典缓存数据 + */ + @Override + public void loadingDictCache() { + List dictTypeList = list(); + for (SysDictType dictType : dictTypeList) { + List dictDatas = dictDataMapper.selectDictDataByType(dictType.getDictType()); + DictUtils.setDictCache(dictType.getDictType(), dictDatas); + } + } - /** - * 修改保存字典类型信息 - * - * @param dictType 字典类型信息 - * @return 结果 - */ - @Override - @Transactional - public int updateDictType(SysDictType dictType) { - SysDictType oldDict = getById(dictType.getDictId()); - dictDataMapper.update(null, new LambdaUpdateWrapper() - .set(SysDictData::getDictType, dictType.getDictType()) - .eq(SysDictData::getDictType, oldDict.getDictType())); - int row = baseMapper.updateById(dictType); - if (row > 0) { - DictUtils.clearDictCache(); - } - return row; - } + /** + * 清空字典缓存数据 + */ + @Override + public void clearDictCache() { + DictUtils.clearDictCache(); + } - /** - * 校验字典类型称是否唯一 - * - * @param dict 字典类型 - * @return 结果 - */ - @Override - public String checkDictTypeUnique(SysDictType dict) { - Long dictId = Validator.isNull(dict.getDictId()) ? -1L : dict.getDictId(); - SysDictType dictType = getOne(new LambdaQueryWrapper() - .eq(SysDictType::getDictType, dict.getDictType()) - .last("limit 1")); - if (Validator.isNotNull(dictType) && dictType.getDictId().longValue() != dictId.longValue()) { - return UserConstants.NOT_UNIQUE; - } - return UserConstants.UNIQUE; - } + /** + * 重置字典缓存数据 + */ + @Override + public void resetDictCache() { + clearDictCache(); + loadingDictCache(); + } + + /** + * 新增保存字典类型信息 + * + * @param dict 字典类型信息 + * @return 结果 + */ + @Override + public int insertDictType(SysDictType dict) { + int row = baseMapper.insert(dict); + if (row > 0) { + DictUtils.setDictCache(dict.getDictType(), null); + } + return row; + } + + /** + * 修改保存字典类型信息 + * + * @param dict 字典类型信息 + * @return 结果 + */ + @Override + @Transactional + public int updateDictType(SysDictType dict) { + SysDictType oldDict = getById(dict.getDictId()); + dictDataMapper.update(null, new LambdaUpdateWrapper() + .set(SysDictData::getDictType, dict.getDictType()) + .eq(SysDictData::getDictType, oldDict.getDictType())); + int row = baseMapper.updateById(dict); + if (row > 0) { + List dictDatas = dictDataMapper.selectDictDataByType(dict.getDictType()); + DictUtils.setDictCache(dict.getDictType(), dictDatas); + } + return row; + } + + /** + * 校验字典类型称是否唯一 + * + * @param dict 字典类型 + * @return 结果 + */ + @Override + public String checkDictTypeUnique(SysDictType dict) { + Long dictId = Validator.isNull(dict.getDictId()) ? -1L : dict.getDictId(); + SysDictType dictType = getOne(new LambdaQueryWrapper() + .eq(SysDictType::getDictType, dict.getDictType()) + .last("limit 1")); + if (Validator.isNotNull(dictType) && dictType.getDictId().longValue() != dictId.longValue()) { + return UserConstants.NOT_UNIQUE; + } + return UserConstants.UNIQUE; + } } diff --git a/ruoyi-system/src/main/resources/mapper/system/SysDeptMapper.xml b/ruoyi-system/src/main/resources/mapper/system/SysDeptMapper.xml index 0f9967100..21f68541d 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} - ${params.dataScope} + + AND ( ${params.dataScope} ) + order by d.parent_id, d.order_num @@ -49,11 +51,10 @@ from sys_dept d left join sys_role_dept rd on d.dept_id = rd.dept_id where rd.role_id = #{roleId} - - and d.dept_id not in (select d.parent_id from sys_dept d inner join sys_role_dept rd on d.dept_id = - rd.dept_id and rd.role_id = #{roleId}) - + + and d.dept_id not in (select d.parent_id from sys_dept d inner join sys_role_dept rd on d.dept_id = rd.dept_id and rd.role_id = #{roleId}) + order by d.parent_id, d.order_num - \ No newline at end of file + diff --git a/ruoyi-system/src/main/resources/mapper/system/SysRoleMapper.xml b/ruoyi-system/src/main/resources/mapper/system/SysRoleMapper.xml index 2e7162f3a..1a542f830 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') - ${role.params.dataScope} + + AND ( ${role.params.dataScope} ) + order by r.role_sort @@ -81,7 +83,9 @@ and date_format(r.create_time,'%y%m%d') <= date_format(#{params.endTime},'%y%m%d') - ${params.dataScope} + + AND ( ${params.dataScope} ) + order by r.role_sort @@ -103,4 +107,4 @@ WHERE r.del_flag = '0' and u.user_name = #{userName} - \ No newline at end of file + diff --git a/ruoyi-system/src/main/resources/mapper/system/SysUserMapper.xml b/ruoyi-system/src/main/resources/mapper/system/SysUserMapper.xml index 1135dee93..df59332b3 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) )) - ${user.params.dataScope} + + AND ( ${user.params.dataScope} ) + - \ No newline at end of file + diff --git a/ruoyi-ui/package.json b/ruoyi-ui/package.json index 4bdce363d..e951b8d64 100644 --- a/ruoyi-ui/package.json +++ b/ruoyi-ui/package.json @@ -1,6 +1,6 @@ { "name": "ruoyi-vue-plus", - "version": "2.2.0", + "version": "2.2.1", "description": "RuoYi-Vue-Plus后台管理系统", "author": "LionLi", "license": "MIT", diff --git a/ruoyi-ui/src/api/system/config.js b/ruoyi-ui/src/api/system/config.js index aff093d43..4c5cb6b8d 100644 --- a/ruoyi-ui/src/api/system/config.js +++ b/ruoyi-ui/src/api/system/config.js @@ -51,10 +51,10 @@ export function delConfig(configId) { }) } -// 清理参数缓存 -export function clearCache() { +// 刷新参数缓存 +export function refreshCache() { return request({ - url: '/system/config/clearCache', + url: '/system/config/refreshCache', method: 'delete' }) } diff --git a/ruoyi-ui/src/api/system/dict/type.js b/ruoyi-ui/src/api/system/dict/type.js index 37034d2fc..2f0532da7 100644 --- a/ruoyi-ui/src/api/system/dict/type.js +++ b/ruoyi-ui/src/api/system/dict/type.js @@ -43,10 +43,10 @@ export function delType(dictId) { }) } -// 清理参数缓存 -export function clearCache() { +// 刷新字典缓存 +export function refreshCache() { return request({ - url: '/system/dict/type/clearCache', + url: '/system/dict/type/refreshCache', method: 'delete' }) } diff --git a/ruoyi-ui/src/views/index.vue b/ruoyi-ui/src/views/index.vue index 9e07ee96c..8dc506003 100644 --- a/ruoyi-ui/src/views/index.vue +++ b/ruoyi-ui/src/views/index.vue @@ -80,6 +80,17 @@ 更新日志 + +
    +
  1. add 增加 security 权限框架 @Async 异步注解配置
  2. +
  3. update 优化数据权限sql 解决MP apply注入附带 AND 语法问题
  4. +
  5. update 优化dataScope参数防止注入
  6. +
  7. update 优化参数&字典缓存操作
  8. +
  9. update 增加修改包名文档
  10. +
  11. update 文档增加演示图例
  12. +
  13. fix 修复部门类sql符号错误
  14. +
+
  1. 同步升级 RuoYi-Vue 3.5.0
  2. @@ -180,7 +191,7 @@ export default { data() { return { // 版本号 - version: "2.2.0", + version: "2.2.1", }; }, methods: { diff --git a/ruoyi-ui/src/views/system/config/index.vue b/ruoyi-ui/src/views/system/config/index.vue index 5198b0033..4d6f7ae62 100644 --- a/ruoyi-ui/src/views/system/config/index.vue +++ b/ruoyi-ui/src/views/system/config/index.vue @@ -99,9 +99,9 @@ plain icon="el-icon-refresh" size="mini" - @click="handleClearCache" + @click="handleRefreshCache" v-hasPermi="['system:config:remove']" - >清理缓存 + >刷新缓存 @@ -181,7 +181,7 @@ 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 000000000..897e54e8d --- /dev/null +++ b/ruoyi-ui/src/views/demo/test/index.vue @@ -0,0 +1,361 @@ + + + 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 000000000..ddf767777 --- /dev/null +++ b/ruoyi-ui/src/views/demo/tree/index.vue @@ -0,0 +1,282 @@ + + + diff --git a/ruoyi-ui/src/views/index.vue b/ruoyi-ui/src/views/index.vue index 91beb8445..c246ac97e 100644 --- a/ruoyi-ui/src/views/index.vue +++ b/ruoyi-ui/src/views/index.vue @@ -80,6 +80,16 @@ 更新日志 + +
      +
    1. add 升级 luttuce 为 redisson 性能更强 工具更全
    2. +
    3. add 增加测试数据sql文件
    4. +
    5. add 增加demo模块 单表演示案例(包含数据权限)
    6. +
    7. update 完美修复 数据权限功能(支持单表多表过滤)
    8. +
    9. update 优化代码生成模板
    10. +
    11. update 优化 system 模块 批量操作性能
    12. +
    +
    1. add 增加 security 权限框架 @Async 异步注解配置
    2. diff --git a/ry.bat b/ry.bat new file mode 100644 index 000000000..a6ba5a533 --- /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ͨjpspid +: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 ݽIDkill + 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 ecf7a5f35..d296c55c8 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 start() 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 000000000..b7003ce20 --- /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 '父id', + 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); From 54d97b53deca699c9bfc17232453b9d2caf4f224 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E7=96=AF=E7=8B=82=E7=9A=84=E7=8B=AE=E5=AD=90li?= <15040126243@163.com> Date: Tue, 1 Jun 2021 10:54:23 +0800 Subject: [PATCH 15/41] =?UTF-8?q?=E5=8F=91=E5=B8=83=20v2.3.0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ruoyi-ui/src/views/index.vue | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ruoyi-ui/src/views/index.vue b/ruoyi-ui/src/views/index.vue index c246ac97e..29d4dbb5c 100644 --- a/ruoyi-ui/src/views/index.vue +++ b/ruoyi-ui/src/views/index.vue @@ -200,7 +200,7 @@ export default { data() { return { // 版本号 - version: "2.2.1", + version: "2.3.0", }; }, methods: { From 0bc71e28a156e17fad99a6be53586615fcc7b46e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E7=96=AF=E7=8B=82=E7=9A=84=E7=8B=AE=E5=AD=90li?= <15040126243@163.com> Date: Tue, 1 Jun 2021 23:14:42 +0800 Subject: [PATCH 16/41] =?UTF-8?q?update=20=E4=BC=98=E5=8C=96=E4=BB=A3?= =?UTF-8?q?=E7=A0=81=E4=B9=A6=E5=86=99=E6=A0=BC=E5=BC=8F=20=E5=8E=BB?= =?UTF-8?q?=E9=99=A4=E8=AD=A6=E5=91=8A?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../java/com/ruoyi/framework/aspectj/DataScopeAspect.java | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) 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 e8ef10185..383f4b64d 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 @@ -159,6 +159,7 @@ public class DataScopeAspect { } } + @SuppressWarnings("unchecked") private static void putDataScope(JoinPoint joinPoint, String sql) { Object params = joinPoint.getArgs()[0]; if (Validator.isNotNull(params)) { @@ -167,8 +168,8 @@ public class DataScopeAspect { baseEntity.getParams().put(DATA_SCOPE, sql); } else { try { - Method getParams = params.getClass().getDeclaredMethod("getParams", null); - Map invoke = (Map) getParams.invoke(params, null); + Method getParams = params.getClass().getDeclaredMethod("getParams"); + Map invoke = (Map) getParams.invoke(params); invoke.put(DATA_SCOPE, sql); } catch (Exception e) { // 方法未找到 不处理 From a287599c8fd748de97856fd504cdbba210fa8fa9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E7=96=AF=E7=8B=82=E7=9A=84=E7=8B=AE=E5=AD=90li?= <15040126243@163.com> Date: Wed, 2 Jun 2021 09:41:12 +0800 Subject: [PATCH 17/41] =?UTF-8?q?update=20=E5=A2=9E=E5=8A=A0redis=E7=A9=BA?= =?UTF-8?q?=E5=AF=86=E7=A0=81=E5=85=BC=E5=AE=B9=E6=80=A7?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../src/main/java/com/ruoyi/framework/config/RedisConfig.java | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) 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 b86872985..e86f5bc03 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,5 +1,6 @@ package com.ruoyi.framework.config; +import cn.hutool.core.util.StrUtil; import com.ruoyi.framework.config.properties.RedissonProperties; import org.redisson.Redisson; import org.redisson.api.RedissonClient; @@ -52,7 +53,7 @@ public class RedisConfig extends CachingConfigurerSupport { .setAddress(prefix + redisProperties.getHost() + ":" + redisProperties.getPort()) .setConnectTimeout(((Long) redisProperties.getTimeout().toMillis()).intValue()) .setDatabase(redisProperties.getDatabase()) - .setPassword(redisProperties.getPassword()) + .setPassword(StrUtil.isNotBlank(redisProperties.getPassword()) ? redisProperties.getPassword() : null) .setTimeout(singleServerConfig.getTimeout()) .setRetryAttempts(singleServerConfig.getRetryAttempts()) .setRetryInterval(singleServerConfig.getRetryInterval()) From 5c40c4b9586aff0dbfa11de2ad5d0d45600bec4a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E7=96=AF=E7=8B=82=E7=9A=84=E7=8B=AE=E5=AD=90li?= <15040126243@163.com> Date: Wed, 2 Jun 2021 09:49:16 +0800 Subject: [PATCH 18/41] =?UTF-8?q?update=20=E6=96=87=E6=A1=A3=E5=A2=9E?= =?UTF-8?q?=E5=8A=A0=20Oracle=20=E5=88=86=E6=94=AF=E8=B7=AF=E5=BE=84?= =?UTF-8?q?=E9=85=8D=E7=BD=AE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- README.md | 1 + 1 file changed, 1 insertion(+) diff --git a/README.md b/README.md index ce17def9d..7aac0bf1d 100644 --- a/README.md +++ b/README.md @@ -45,6 +45,7 @@ * 同步升级 RuoYi-Vue 3.5.0 * 单模块 fast 分支 [RuoYi-Vue-Plus-fast](https://gitee.com/JavaLionLi/RuoYi-Vue-Plus/tree/fast/) +* Oracle 模块 oracle 分支 [RuoYi-Vue-Plus-oracle](https://gitee.com/JavaLionLi/RuoYi-Vue-Plus/tree/oracle/) ## 关注作者(扫码请备注: "加群") From 19924cd184908cbca2f7e8670ed5a5dfb88aac01 Mon Sep 17 00:00:00 2001 From: RuoYi Date: Thu, 3 Jun 2021 13:24:29 +0800 Subject: [PATCH 19/41] =?UTF-8?q?=E4=BF=AE=E5=A4=8D=E5=85=B3=E9=97=ADconfi?= =?UTF-8?q?rm=E6=8F=90=E7=A4=BA=E6=A1=86=E6=8E=A7=E5=88=B6=E5=8F=B0?= =?UTF-8?q?=E6=8A=A5=E9=94=99=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ruoyi-generator/src/main/resources/vm/vue/index-tree.vue.vm | 2 +- ruoyi-generator/src/main/resources/vm/vue/index.vue.vm | 4 ++-- ruoyi-ui/src/layout/components/Navbar.vue | 2 +- ruoyi-ui/src/utils/request.js | 2 +- ruoyi-ui/src/views/monitor/job/index.vue | 6 +++--- ruoyi-ui/src/views/monitor/job/log.vue | 6 +++--- ruoyi-ui/src/views/monitor/logininfor/index.vue | 6 +++--- ruoyi-ui/src/views/monitor/online/index.vue | 2 +- ruoyi-ui/src/views/monitor/operlog/index.vue | 6 +++--- ruoyi-ui/src/views/system/config/index.vue | 4 ++-- ruoyi-ui/src/views/system/dept/index.vue | 2 +- ruoyi-ui/src/views/system/dict/data.vue | 4 ++-- ruoyi-ui/src/views/system/dict/index.vue | 4 ++-- ruoyi-ui/src/views/system/menu/index.vue | 4 ++-- ruoyi-ui/src/views/system/notice/index.vue | 2 +- ruoyi-ui/src/views/system/post/index.vue | 4 ++-- ruoyi-ui/src/views/system/role/index.vue | 4 ++-- ruoyi-ui/src/views/system/user/index.vue | 4 ++-- ruoyi-ui/src/views/tool/gen/index.vue | 4 ++-- 19 files changed, 36 insertions(+), 36 deletions(-) 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 6d67c2e0d..ab8706818 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 @@ -532,7 +532,7 @@ export default { }).then(() => { 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 501f2f634..9fd6adf5f 100644 --- a/ruoyi-generator/src/main/resources/vm/vue/index.vue.vm +++ b/ruoyi-generator/src/main/resources/vm/vue/index.vue.vm @@ -590,7 +590,7 @@ export default { }).then(() => { this.getList(); this.msgSuccess("删除成功"); - }) + }).catch(() => {}); }, #if($table.sub) /** ${subTable.functionName}序号 */ @@ -639,7 +639,7 @@ export default { }).then(response => { this.download(response.msg); this.exportLoading = false; - }) + }).catch(() => {}); } } }; diff --git a/ruoyi-ui/src/layout/components/Navbar.vue b/ruoyi-ui/src/layout/components/Navbar.vue index 18c89a0ea..67a53ab67 100644 --- a/ruoyi-ui/src/layout/components/Navbar.vue +++ b/ruoyi-ui/src/layout/components/Navbar.vue @@ -104,7 +104,7 @@ export default { 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 ae89f24de..a510d2daf 100644 --- a/ruoyi-ui/src/utils/request.js +++ b/ruoyi-ui/src/utils/request.js @@ -63,7 +63,7 @@ service.interceptors.response.use(res => { store.dispatch('LogOut').then(() => { location.href = '/index'; }) - }) + }).catch(() => {}); } else if (code === 500) { Message({ message: msg, diff --git a/ruoyi-ui/src/views/monitor/job/index.vue b/ruoyi-ui/src/views/monitor/job/index.vue index 30115e336..c8fcd6dcc 100644 --- a/ruoyi-ui/src/views/monitor/job/index.vue +++ b/ruoyi-ui/src/views/monitor/job/index.vue @@ -410,7 +410,7 @@ export default { return runJob(row.jobId, row.jobGroup); }).then(() => { this.msgSuccess("执行成功"); - }) + }).catch(() => {}); }, /** 任务详细信息 */ handleView(row) { @@ -471,7 +471,7 @@ export default { }).then(() => { this.getList(); this.msgSuccess("删除成功"); - }) + }).catch(() => {}); }, /** 导出按钮操作 */ handleExport() { @@ -486,7 +486,7 @@ export default { }).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 121dde828..fa5976fea 100644 --- a/ruoyi-ui/src/views/monitor/job/log.vue +++ b/ruoyi-ui/src/views/monitor/job/log.vue @@ -269,7 +269,7 @@ export default { }).then(() => { this.getList(); this.msgSuccess("删除成功"); - }) + }).catch(() => {}); }, /** 清空按钮操作 */ handleClean() { @@ -282,7 +282,7 @@ export default { }).then(() => { this.getList(); this.msgSuccess("清空成功"); - }) + }).catch(() => {}); }, /** 导出按钮操作 */ handleExport() { @@ -297,7 +297,7 @@ export default { }).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 4ac9a78d9..c6b38c747 100644 --- a/ruoyi-ui/src/views/monitor/logininfor/index.vue +++ b/ruoyi-ui/src/views/monitor/logininfor/index.vue @@ -202,7 +202,7 @@ export default { }).then(() => { this.getList(); this.msgSuccess("删除成功"); - }) + }).catch(() => {}); }, /** 清空按钮操作 */ handleClean() { @@ -215,7 +215,7 @@ export default { }).then(() => { this.getList(); this.msgSuccess("清空成功"); - }) + }).catch(() => {}); }, /** 导出按钮操作 */ handleExport() { @@ -230,7 +230,7 @@ export default { }).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 4233de5c6..baec6e0b4 100644 --- a/ruoyi-ui/src/views/monitor/online/index.vue +++ b/ruoyi-ui/src/views/monitor/online/index.vue @@ -120,7 +120,7 @@ export default { }).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 d1505c663..7909c8514 100644 --- a/ruoyi-ui/src/views/monitor/operlog/index.vue +++ b/ruoyi-ui/src/views/monitor/operlog/index.vue @@ -290,7 +290,7 @@ export default { }).then(() => { this.getList(); this.msgSuccess("删除成功"); - }) + }).catch(() => {}); }, /** 清空按钮操作 */ handleClean() { @@ -303,7 +303,7 @@ export default { }).then(() => { this.getList(); this.msgSuccess("清空成功"); - }) + }).catch(() => {}); }, /** 导出按钮操作 */ handleExport() { @@ -318,7 +318,7 @@ export default { }).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 d6275f532..d942f8ff1 100644 --- a/ruoyi-ui/src/views/system/config/index.vue +++ b/ruoyi-ui/src/views/system/config/index.vue @@ -338,7 +338,7 @@ export default { }).then(() => { this.getList(); this.msgSuccess("删除成功"); - }) + }).catch(() => {}); }, /** 导出按钮操作 */ handleExport() { @@ -353,7 +353,7 @@ export default { }).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 98d57fb3e..2d58f6424 100644 --- a/ruoyi-ui/src/views/system/dept/index.vue +++ b/ruoyi-ui/src/views/system/dept/index.vue @@ -310,7 +310,7 @@ export default { }).then(() => { this.getList(); this.msgSuccess("删除成功"); - }) + }).catch(() => {}); } } }; diff --git a/ruoyi-ui/src/views/system/dict/data.vue b/ruoyi-ui/src/views/system/dict/data.vue index 720ed7e7a..4b5dd29e2 100644 --- a/ruoyi-ui/src/views/system/dict/data.vue +++ b/ruoyi-ui/src/views/system/dict/data.vue @@ -337,7 +337,7 @@ export default { }).then(() => { this.getList(); this.msgSuccess("删除成功"); - }) + }).catch(() => {}); }, /** 导出按钮操作 */ handleExport() { @@ -352,7 +352,7 @@ export default { }).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 545912a2e..a52df7bf6 100644 --- a/ruoyi-ui/src/views/system/dict/index.vue +++ b/ruoyi-ui/src/views/system/dict/index.vue @@ -342,7 +342,7 @@ export default { }).then(() => { this.getList(); this.msgSuccess("删除成功"); - }) + }).catch(() => {}); }, /** 导出按钮操作 */ handleExport() { @@ -357,7 +357,7 @@ export default { }).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 cee61b737..507ae509a 100644 --- a/ruoyi-ui/src/views/system/menu/index.vue +++ b/ruoyi-ui/src/views/system/menu/index.vue @@ -163,7 +163,7 @@ - + @@ -393,7 +393,7 @@ export default { }).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 7da479804..6dbbfcb0a 100644 --- a/ruoyi-ui/src/views/system/notice/index.vue +++ b/ruoyi-ui/src/views/system/notice/index.vue @@ -336,7 +336,7 @@ export default { }).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 ce48b03b2..0b10126bb 100644 --- a/ruoyi-ui/src/views/system/post/index.vue +++ b/ruoyi-ui/src/views/system/post/index.vue @@ -309,7 +309,7 @@ export default { }).then(() => { this.getList(); this.msgSuccess("删除成功"); - }) + }).catch(() => {}); }, /** 导出按钮操作 */ handleExport() { @@ -324,7 +324,7 @@ export default { }).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 4892615c3..8f0d43330 100644 --- a/ruoyi-ui/src/views/system/role/index.vue +++ b/ruoyi-ui/src/views/system/role/index.vue @@ -593,7 +593,7 @@ export default { }).then(() => { this.getList(); this.msgSuccess("删除成功"); - }) + }).catch(() => {}); }, /** 导出按钮操作 */ handleExport() { @@ -608,7 +608,7 @@ export default { }).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 2e55120cd..471a66cc4 100644 --- a/ruoyi-ui/src/views/system/user/index.vue +++ b/ruoyi-ui/src/views/system/user/index.vue @@ -631,7 +631,7 @@ export default { }).then(() => { this.getList(); this.msgSuccess("删除成功"); - }) + }).catch(() => {}); }, /** 导出按钮操作 */ handleExport() { @@ -646,7 +646,7 @@ export default { }).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 113f35405..348543e2d 100644 --- a/ruoyi-ui/src/views/tool/gen/index.vue +++ b/ruoyi-ui/src/views/tool/gen/index.vue @@ -283,7 +283,7 @@ export default { return synchDb(tableName); }).then(() => { this.msgSuccess("同步成功"); - }) + }).catch(() => {}); }, /** 打开导入表弹窗 */ openImportTable() { @@ -333,7 +333,7 @@ export default { }).then(() => { this.getList(); this.msgSuccess("删除成功"); - }) + }).catch(() => {}); } } }; From b7446f8d0ffd282d7f22d775e896d066219856a4 Mon Sep 17 00:00:00 2001 From: RuoYi Date: Thu, 3 Jun 2021 13:26:09 +0800 Subject: [PATCH 20/41] =?UTF-8?q?=E5=AF=8C=E6=96=87=E6=9C=AC=E5=B7=A5?= =?UTF-8?q?=E5=85=B7=E6=A0=8F=E9=85=8D=E7=BD=AE=E8=A7=86=E9=A2=91?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ruoyi-ui/src/components/Editor/index.vue | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/ruoyi-ui/src/components/Editor/index.vue b/ruoyi-ui/src/components/Editor/index.vue index 640049ca0..ad4da7eee 100644 --- a/ruoyi-ui/src/components/Editor/index.vue +++ b/ruoyi-ui/src/components/Editor/index.vue @@ -75,7 +75,7 @@ export default { [{ color: [] }, { background: [] }], // 字体颜色、字体背景颜色 [{ align: [] }], // 对齐方式 ["clean"], // 清除文本格式 - ["link", "image"] // 链接、图片 + ["link", "image", "video"] // 链接、图片、视频 ], }, placeholder: "请输入内容", @@ -158,6 +158,7 @@ export default { }); }, handleUploadSuccess(res, file) { + console.info(file); // 获取富文本组件实例 let quill = this.Quill; // 如果上传成功 From 428a6ed71b6cb571585f69fd6f4ac6868c5d7ab8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E7=96=AF=E7=8B=82=E7=9A=84=E7=8B=AE=E5=AD=90li?= <15040126243@163.com> Date: Fri, 4 Jun 2021 16:46:28 +0800 Subject: [PATCH 21/41] =?UTF-8?q?update=20=E4=BC=98=E5=8C=96=20=E9=94=81?= =?UTF-8?q?=E5=88=87=E9=9D=A2=E4=BB=A3=E7=A0=81=20key=E5=88=B0=E5=B8=B8?= =?UTF-8?q?=E9=87=8F=E7=B1=BB?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../java/com/ruoyi/common/constant/Constants.java | 7 ++++++- .../ruoyi/framework/aspectj/RedisLockAspect.java | 13 +++++-------- 2 files changed, 11 insertions(+), 9 deletions(-) diff --git a/ruoyi-common/src/main/java/com/ruoyi/common/constant/Constants.java b/ruoyi-common/src/main/java/com/ruoyi/common/constant/Constants.java index 534291991..137969a8b 100644 --- a/ruoyi-common/src/main/java/com/ruoyi/common/constant/Constants.java +++ b/ruoyi-common/src/main/java/com/ruoyi/common/constant/Constants.java @@ -2,7 +2,7 @@ package com.ruoyi.common.constant; /** * 通用常量信息 - * + * * @author ruoyi */ public class Constants @@ -126,4 +126,9 @@ public class Constants * 资源映射路径 前缀 */ public static final String RESOURCE_PREFIX = "/profile"; + + /** + * 资源映射路径 前缀 + */ + public static final String REDIS_LOCK_KEY = "redis_lock:"; } 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 0ff695f8b..0af3844ff 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 @@ -2,6 +2,7 @@ package com.ruoyi.framework.aspectj; import com.ruoyi.common.annotation.RedisLock; +import com.ruoyi.common.constant.Constants; import lombok.extern.slf4j.Slf4j; import org.aspectj.lang.ProceedingJoinPoint; import org.aspectj.lang.annotation.Around; @@ -34,8 +35,6 @@ public class RedisLockAspect { @Autowired private RedissonClient redissonClient; - private static final String LOCK_TITLE = "RedisLock_"; - @Pointcut("@annotation(com.ruoyi.common.annotation.RedisLock)") public void annotationPointcut() { } @@ -67,6 +66,8 @@ public class RedisLockAspect { throw new RuntimeException("redis分布式锁注解参数异常", e); } + // 声明锁名称 + key = Constants.REDIS_LOCK_KEY + key; Object res; try { if (acquire(key, expireTime, TimeUnit.SECONDS)) { @@ -136,8 +137,6 @@ public class RedisLockAspect { * 加锁(RLock)带超时时间的 */ private boolean acquire(String key, long expire, TimeUnit expireUnit) { - //声明key对象 - key = LOCK_TITLE + key; try { //获取锁对象 RLock mylock = redissonClient.getLock(key); @@ -155,13 +154,11 @@ public class RedisLockAspect { * 锁的释放 */ private void release(String lockName) { - //必须是和加锁时的同一个key - String key = LOCK_TITLE + lockName; //获取所对象 - RLock mylock = redissonClient.getLock(key); + RLock mylock = redissonClient.getLock(lockName); //释放锁(解锁) mylock.unlock(); - log.info("unlock => key : " + key + " , ThreadName : " + Thread.currentThread().getName()); + log.info("unlock => key : " + lockName + " , ThreadName : " + Thread.currentThread().getName()); } } From 9a792e601e0c63eef6fee9f2dc81b3edd5d471b8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E7=96=AF=E7=8B=82=E7=9A=84=E7=8B=AE=E5=AD=90li?= <15040126243@163.com> Date: Fri, 4 Jun 2021 18:11:46 +0800 Subject: [PATCH 22/41] =?UTF-8?q?fix=20=E4=BF=AE=E5=A4=8D=E7=9B=B8?= =?UTF-8?q?=E5=AF=B9=E8=B7=AF=E5=BE=84=E4=B8=8A=E4=BC=A0=E5=BC=82=E5=B8=B8?= =?UTF-8?q?=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../java/com/ruoyi/common/utils/file/FileUploadUtils.java | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/ruoyi-common/src/main/java/com/ruoyi/common/utils/file/FileUploadUtils.java b/ruoyi-common/src/main/java/com/ruoyi/common/utils/file/FileUploadUtils.java index cb4a225fb..22d53c7fa 100644 --- a/ruoyi-common/src/main/java/com/ruoyi/common/utils/file/FileUploadUtils.java +++ b/ruoyi-common/src/main/java/com/ruoyi/common/utils/file/FileUploadUtils.java @@ -1,5 +1,6 @@ package com.ruoyi.common.utils.file; +import cn.hutool.core.io.FileUtil; import cn.hutool.core.lang.Validator; import cn.hutool.core.util.IdUtil; import cn.hutool.core.util.StrUtil; @@ -113,7 +114,8 @@ public class FileUploadUtils String fileName = extractFilename(file); File desc = getAbsoluteFile(baseDir, fileName); - file.transferTo(desc); + desc = FileUtil.touch(desc); + FileUtil.writeFromStream(file.getInputStream(), desc); String pathFileName = getPathFileName(baseDir, fileName); return pathFileName; } From fd33fe869dfad2364503f13bc90a239fccba5dc3 Mon Sep 17 00:00:00 2001 From: RuoYi Date: Tue, 8 Jun 2021 16:27:24 +0800 Subject: [PATCH 23/41] =?UTF-8?q?=E4=BF=AE=E5=A4=8D=E5=AF=BC=E5=87=BA?= =?UTF-8?q?=E8=A7=92=E8=89=B2=E6=95=B0=E6=8D=AE=E8=8C=83=E5=9B=B4=E7=BF=BB?= =?UTF-8?q?=E8=AF=91=E7=BC=BA=E5=B0=91=E4=BB=85=E6=9C=AC=E4=BA=BA?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../java/com/ruoyi/common/core/domain/entity/SysRole.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) 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 b122538b6..f28a063a6 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 @@ -33,8 +33,8 @@ public class SysRole extends BaseEntity @Excel(name = "角色排序") 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:父子互相关联显示) */ From c16ee7fc2c6cbda1cc8e87f21f1c29b2cb5948cd Mon Sep 17 00:00:00 2001 From: RuoYi Date: Tue, 8 Jun 2021 16:34:36 +0800 Subject: [PATCH 24/41] =?UTF-8?q?=E5=8D=87=E7=BA=A7swagger=E5=88=B0?= =?UTF-8?q?=E6=9C=80=E6=96=B0=E7=89=88=E6=9C=ACv3.0.0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- pom.xml | 41 +++++++------------ ruoyi-admin/pom.xml | 20 ++------- .../ruoyi/web/core/config/SwaggerConfig.java | 12 +++--- ruoyi-ui/src/components/Editor/index.vue | 1 - ruoyi-ui/src/views/tool/swagger/index.vue | 2 +- 5 files changed, 25 insertions(+), 51 deletions(-) diff --git a/pom.xml b/pom.xml index 640387a12..ebf3f28f6 100644 --- a/pom.xml +++ b/pom.xml @@ -20,7 +20,7 @@ 3.1.1 1.2.6 1.21 - 2.9.2 + 3.0.0 2.3.2 2.1.4 1.3.0 @@ -48,7 +48,7 @@ import - + com.alibaba druid-spring-boot-starter @@ -95,38 +95,25 @@ ${jna.version} - + io.springfox - springfox-swagger2 - ${swagger.version} - - - io.swagger - swagger-annotations - - - io.swagger - swagger-models - - + springfox-boot-starter + 3.0.0 + + io.swagger + swagger-models + - - - io.springfox - springfox-swagger-ui - ${swagger.version} - - - + commons-io commons-io ${commons.io.version} - + commons-fileupload commons-fileupload @@ -140,7 +127,7 @@ ${poi.version} - + org.apache.velocity velocity @@ -167,14 +154,14 @@ ${fastjson.version} - + io.jsonwebtoken jjwt ${jwt.version} - + com.github.penggle kaptcha diff --git a/ruoyi-admin/pom.xml b/ruoyi-admin/pom.xml index d58ad5bdf..25016b056 100644 --- a/ruoyi-admin/pom.xml +++ b/ruoyi-admin/pom.xml @@ -24,29 +24,17 @@ true - + io.springfox - springfox-swagger2 - - - - - io.swagger - swagger-annotations - 1.5.21 + springfox-boot-starter + io.swagger swagger-models - 1.5.21 - - - - - io.springfox - springfox-swagger-ui + 1.6.2 diff --git a/ruoyi-admin/src/main/java/com/ruoyi/web/core/config/SwaggerConfig.java b/ruoyi-admin/src/main/java/com/ruoyi/web/core/config/SwaggerConfig.java index 86acc3f0b..02227fd27 100644 --- a/ruoyi-admin/src/main/java/com/ruoyi/web/core/config/SwaggerConfig.java +++ b/ruoyi-admin/src/main/java/com/ruoyi/web/core/config/SwaggerConfig.java @@ -8,6 +8,7 @@ import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Configuration; import com.ruoyi.common.config.RuoYiConfig; import io.swagger.annotations.ApiOperation; +import io.swagger.models.auth.In; import springfox.documentation.builders.ApiInfoBuilder; import springfox.documentation.builders.PathSelectors; import springfox.documentation.builders.RequestHandlerSelectors; @@ -16,10 +17,10 @@ import springfox.documentation.service.ApiKey; import springfox.documentation.service.AuthorizationScope; import springfox.documentation.service.Contact; import springfox.documentation.service.SecurityReference; +import springfox.documentation.service.SecurityScheme; 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; /** * Swagger2的接口配置 @@ -27,7 +28,6 @@ import springfox.documentation.swagger2.annotations.EnableSwagger2; * @author ruoyi */ @Configuration -@EnableSwagger2 public class SwaggerConfig { /** 系统基础配置 */ @@ -71,10 +71,10 @@ public class SwaggerConfig /** * 安全模式,这里指定token通过Authorization头请求头传递 */ - private List securitySchemes() + private List securitySchemes() { - List apiKeyList = new ArrayList(); - apiKeyList.add(new ApiKey("Authorization", "Authorization", "header")); + List apiKeyList = new ArrayList(); + apiKeyList.add(new ApiKey("Authorization", "Authorization", In.HEADER.toValue())); return apiKeyList; } @@ -87,7 +87,7 @@ public class SwaggerConfig securityContexts.add( SecurityContext.builder() .securityReferences(defaultAuth()) - .forPaths(PathSelectors.regex("^(?!auth).*$")) + .operationSelector(o -> o.requestMappingPattern().matches("/.*")) .build()); return securityContexts; } diff --git a/ruoyi-ui/src/components/Editor/index.vue b/ruoyi-ui/src/components/Editor/index.vue index ad4da7eee..d63a48d12 100644 --- a/ruoyi-ui/src/components/Editor/index.vue +++ b/ruoyi-ui/src/components/Editor/index.vue @@ -158,7 +158,6 @@ export default { }); }, handleUploadSuccess(res, file) { - console.info(file); // 获取富文本组件实例 let quill = this.Quill; // 如果上传成功 diff --git a/ruoyi-ui/src/views/tool/swagger/index.vue b/ruoyi-ui/src/views/tool/swagger/index.vue index 624b59a2d..8db31808e 100644 --- a/ruoyi-ui/src/views/tool/swagger/index.vue +++ b/ruoyi-ui/src/views/tool/swagger/index.vue @@ -8,7 +8,7 @@ export default { name: "Swagger", data() { return { - src: process.env.VUE_APP_BASE_API + "/swagger-ui.html", + src: process.env.VUE_APP_BASE_API + "/swagger-ui/index.html", height: document.documentElement.clientHeight - 94.5 + "px;", loading: true }; From 2ace3257f95eee1f8734754f488412b6a266d928 Mon Sep 17 00:00:00 2001 From: RuoYi Date: Wed, 9 Jun 2021 20:07:36 +0800 Subject: [PATCH 25/41] =?UTF-8?q?=E5=8D=87=E7=BA=A7swagger=E5=88=B0?= =?UTF-8?q?=E6=9C=80=E6=96=B0=E7=89=88=E6=9C=ACv3.0.0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- pom.xml | 12 +++++++----- .../com/ruoyi/web/core/config/SwaggerConfig.java | 2 +- .../com/ruoyi/framework/config/ResourcesConfig.java | 3 +-- 3 files changed, 9 insertions(+), 8 deletions(-) diff --git a/pom.xml b/pom.xml index ebf3f28f6..ff0ebab75 100644 --- a/pom.xml +++ b/pom.xml @@ -99,11 +99,13 @@ io.springfox springfox-boot-starter - 3.0.0 - - io.swagger - swagger-models - + ${swagger.version} + + + io.swagger + swagger-models + + diff --git a/ruoyi-admin/src/main/java/com/ruoyi/web/core/config/SwaggerConfig.java b/ruoyi-admin/src/main/java/com/ruoyi/web/core/config/SwaggerConfig.java index 02227fd27..0b9424507 100644 --- a/ruoyi-admin/src/main/java/com/ruoyi/web/core/config/SwaggerConfig.java +++ b/ruoyi-admin/src/main/java/com/ruoyi/web/core/config/SwaggerConfig.java @@ -48,7 +48,7 @@ public class SwaggerConfig @Bean public Docket createRestApi() { - return new Docket(DocumentationType.SWAGGER_2) + return new Docket(DocumentationType.OAS_30) // 是否启用Swagger .enable(enabled) // 用来创建该API的基本信息,展示在文档的页面中(自定义展示的信息) 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 1082ea51c..9cd523e76 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 @@ -31,8 +31,7 @@ public class ResourcesConfig implements WebMvcConfigurer 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/"); } /** From f45b50a796e1db1238b1147f11c2f96c0d405e48 Mon Sep 17 00:00:00 2001 From: sxq <812980466@qq.com> Date: Tue, 8 Jun 2021 14:55:55 +0800 Subject: [PATCH 26/41] =?UTF-8?q?update=20redis=E9=94=81=E5=B7=A5=E5=85=B7?= =?UTF-8?q?=E7=B1=BB=E7=BC=96=E5=86=99?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../common/core/redis/RedisLockManager.java | 132 ++++++++++++++++++ 1 file changed, 132 insertions(+) create mode 100644 ruoyi-common/src/main/java/com/ruoyi/common/core/redis/RedisLockManager.java 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 000000000..fb665a995 --- /dev/null +++ b/ruoyi-common/src/main/java/com/ruoyi/common/core/redis/RedisLockManager.java @@ -0,0 +1,132 @@ +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 ThreadLocal threadLocal = new ThreadLocal<>(); + + /** + * 获取锁(不用设置超时时间,一直等待) + */ + public boolean getLock(String key) { + Assert.isTrue(StrUtil.isNotBlank(key), "key不能为空"); + RLock lock = redissonClient.getLock(key); + threadLocal.set(lock); + return lock.tryLock(); + } + + /** + * 设置过期时间 + * + * @param key + * @param time 过期时间 + * @param expireUnit 时间单位 + */ + public boolean getLock(String key, long time, TimeUnit expireUnit) throws InterruptedException { + Assert.isTrue(StrUtil.isNotBlank(key), "key不能为空"); + Assert.isTrue(time > 0, "过期时间必须大于0"); + Assert.isTrue(Validator.isNotEmpty(expireUnit), "时间单位不能为空"); + RLock lock = redissonClient.getLock(key); + threadLocal.set(lock); + return lock.tryLock(time, expireUnit); + } + + /** + * 设置过期时间 + * + * @param key + * @param waitTime 获取锁等待时间 + * @param leaseTime 保留锁的时间 + * @param expireUnit 时间单位 + * @throws InterruptedException + */ + public boolean getLock(String key, long waitTime, long leaseTime, TimeUnit expireUnit) throws InterruptedException { + Assert.isTrue(StrUtil.isNotBlank(key), "key不能为空"); + Assert.isTrue(waitTime > 0, "获取锁等待时间必须大于0"); + Assert.isTrue(leaseTime > 0, "保留锁的时间必须大于0"); + Assert.isTrue(Validator.isNotEmpty(expireUnit), "时间单位不能为空"); + RLock lock = redissonClient.getLock(key); + threadLocal.set(lock); + return lock.tryLock(waitTime, leaseTime, expireUnit); + } + + /** + * 获取计数器锁 + * + * @param key + * @param count countDownLatch 的数量 + */ + public RCountDownLatch countDownLatch(String key, long count) { + Assert.isTrue(StrUtil.isNotBlank(key), "key不能为空"); + 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) throws InterruptedException { + Assert.isTrue(StrUtil.isNotBlank(key), "key不能为空"); + Assert.isTrue(waitTime > 0, "获取锁等待时间必须大于0"); + Assert.isTrue(leaseTime > 0, "保留锁的时间必须大于0"); + Assert.isTrue(Validator.isNotEmpty(expireUnit), "时间单位不能为空"); + RLock lock = redissonClient.getFairLock(key); + threadLocal.set(lock); + return lock.tryLock(waitTime, leaseTime, expireUnit); + } + + /** + * 获取公平锁 + * + * @param key + * @param leaseTime 持有锁的时间 + * @param expireUnit 时间单位 + * @return + * @throws InterruptedException + */ + public boolean getFairLock(String key, long leaseTime, TimeUnit expireUnit) throws InterruptedException { + Assert.isTrue(StrUtil.isNotBlank(key), "key不能为空"); + Assert.isTrue(leaseTime > 0, "保留锁的时间必须大于0"); + Assert.isTrue(Validator.isNotEmpty(expireUnit), "时间单位不能为空"); + RLock lock = redissonClient.getFairLock(key); + threadLocal.set(lock); + return lock.tryLock(leaseTime, expireUnit); + } + + /** + * 释放锁(统一释放) + */ + public void unLock() { + RLock lock = threadLocal.get(); + lock.unlock(); + threadLocal.remove(); + } +} From a6ba7d909329b8f2262b7014c1ffc7b0dde2a56e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E7=96=AF=E7=8B=82=E7=9A=84=E7=8B=AE=E5=AD=90li?= <15040126243@163.com> Date: Wed, 9 Jun 2021 23:31:47 +0800 Subject: [PATCH 27/41] =?UTF-8?q?update=20=E4=BC=98=E5=8C=96pr=20redis?= =?UTF-8?q?=E5=B7=A5=E5=85=B7=E4=BB=A3=E7=A0=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../demo/controller/RedisLockController.java | 34 ++++++++++++++++- .../framework/aspectj/RedisLockAspect.java | 38 +++---------------- 2 files changed, 38 insertions(+), 34 deletions(-) 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 7792784a1..40019fc27 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,26 +2,35 @@ package com.ruoyi.demo.controller; 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.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RestController; +import java.util.concurrent.TimeUnit; + /** * 测试分布式锁的样例 * * @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 getLock(String key, String value) { + public AjaxResult testLock1(String key, String value) { try { // 同时请求排队 // Thread.sleep(5000); @@ -32,4 +41,25 @@ public class RedisLockController { } return AjaxResult.success("操作成功",value); } + + /** + * 测试锁工具类 + */ + @GetMapping("/testLock2") + public AjaxResult testLock(String key, Long time) { + try { + boolean flag = redisLockManager.getLock(key, time, TimeUnit.SECONDS); + if (flag) { + log.info("获取锁成功: " + key); + Thread.sleep(3000); + redisLockManager.unLock(); + log.info("释放锁成功: " + key); + } else { + log.error("获取锁失败: " + key); + } + } catch (InterruptedException e) { + log.error(e.getMessage()); + } + return AjaxResult.success(); + } } 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 0af3844ff..9d3bc8d99 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 @@ package com.ruoyi.framework.aspectj; 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; @@ -10,7 +11,6 @@ import org.aspectj.lang.annotation.Aspect; import org.aspectj.lang.annotation.Pointcut; import org.aspectj.lang.reflect.MethodSignature; import org.redisson.api.RLock; -import org.redisson.api.RedissonClient; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.core.annotation.Order; import org.springframework.stereotype.Component; @@ -33,7 +33,7 @@ import java.util.concurrent.TimeUnit; public class RedisLockAspect { @Autowired - private RedissonClient redissonClient; + private RedisLockManager redisLockManager; @Pointcut("@annotation(com.ruoyi.common.annotation.RedisLock)") public void annotationPointcut() { @@ -70,14 +70,16 @@ public class RedisLockAspect { 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(); + log.info("unlock => key : " + key + " , ThreadName : " + Thread.currentThread().getName()); } } else { throw new RuntimeException("redis分布式锁注解参数异常"); @@ -133,32 +135,4 @@ public class RedisLockAspect { return listPar; } - /** - * 加锁(RLock)带超时时间的 - */ - 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); - //释放锁(解锁) - mylock.unlock(); - log.info("unlock => key : " + lockName + " , ThreadName : " + Thread.currentThread().getName()); - } - } From ceeac476ecbfb6397afa68d46a5fed2690c0b7be Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E7=96=AF=E7=8B=82=E7=9A=84=E7=8B=AE=E5=AD=90li?= <15040126243@163.com> Date: Thu, 10 Jun 2021 00:04:19 +0800 Subject: [PATCH 28/41] =?UTF-8?q?update=20=E4=BC=98=E5=8C=96=20=E4=BB=A3?= =?UTF-8?q?=E7=A0=81=E7=94=9F=E6=88=90=E5=99=A8=20=E5=A2=9E=E5=8A=A0?= =?UTF-8?q?=E8=A1=A8=E5=8D=95=E9=98=B2=E9=87=8D=E6=B3=A8=E8=A7=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../src/main/resources/vm/java/controller.java.vm | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) 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 b40b497ad..900f51017 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.security.access.prepost.PreAuthorize; 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 @@ import io.swagger.annotations.ApiOperation; /** * ${functionName}Controller - * + * * @author ${author} * @date ${datetime} */ @@ -87,6 +88,7 @@ public class ${ClassName}Controller extends BaseController { @ApiOperation("新增${functionName}") @PreAuthorize("@ss.hasPermi('${permissionPrefix}:add')") @Log(title = "${functionName}", businessType = BusinessType.INSERT) + @RepeatSubmit @PostMapping() public AjaxResult add(@Validated @RequestBody ${ClassName}AddBo bo) { return toAjax(i${ClassName}Service.insertByAddBo(bo) ? 1 : 0); @@ -98,6 +100,7 @@ public class ${ClassName}Controller extends BaseController { @ApiOperation("修改${functionName}") @PreAuthorize("@ss.hasPermi('${permissionPrefix}:edit')") @Log(title = "${functionName}", businessType = BusinessType.UPDATE) + @RepeatSubmit @PutMapping() public AjaxResult edit(@Validated @RequestBody ${ClassName}EditBo bo) { return toAjax(i${ClassName}Service.updateByEditBo(bo) ? 1 : 0); From 524683eabdef0ec4a58e653c94063bf5d51d8e99 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E7=96=AF=E7=8B=82=E7=9A=84=E7=8B=AE=E5=AD=90li?= <15040126243@163.com> Date: Thu, 10 Jun 2021 09:57:34 +0800 Subject: [PATCH 29/41] =?UTF-8?q?update=20swagger=20=E5=8D=87=E7=BA=A7?= =?UTF-8?q?=E4=B8=BA=203.0.0=20=E4=BD=BF=E7=94=A8=20OAS=5F30=20=E5=8D=8F?= =?UTF-8?q?=E8=AE=AE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- pom.xml | 13 ------------- ruoyi-common/pom.xml | 5 ----- .../com/ruoyi/framework/config/SwaggerConfig.java | 9 ++++----- 3 files changed, 4 insertions(+), 23 deletions(-) diff --git a/pom.xml b/pom.xml index 6c2b99e6f..94ab8d5ce 100644 --- a/pom.xml +++ b/pom.xml @@ -21,7 +21,6 @@ 3.1.1 1.2.6 3.0.2 - 1.5.22 1.2.76 4.1.2 1.7 @@ -58,18 +57,6 @@ com.github.xiaoymin knife4j-spring-boot-starter ${knife4j.version} - - - swagger-annotations - io.swagger - - - - - - io.swagger - swagger-annotations - ${swagger-annotations.version} diff --git a/ruoyi-common/pom.xml b/ruoyi-common/pom.xml index 2c75fcd1b..c6275c250 100644 --- a/ruoyi-common/pom.xml +++ b/ruoyi-common/pom.xml @@ -136,11 +136,6 @@ knife4j-spring-boot-starter - - io.swagger - swagger-annotations - - org.springframework.boot spring-boot-starter-actuator 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 1a92ca088..7b5d95105 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 @@ package com.ruoyi.framework.config; 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,7 +14,6 @@ import springfox.documentation.service.*; import springfox.documentation.spi.DocumentationType; import springfox.documentation.spi.service.contexts.SecurityContext; import springfox.documentation.spring.web.plugins.Docket; -import springfox.documentation.swagger2.annotations.EnableSwagger2; import java.util.ArrayList; import java.util.List; @@ -24,7 +24,6 @@ import java.util.List; * @author Lion Li */ @Configuration -@EnableSwagger2 @EnableKnife4j public class SwaggerConfig { @@ -36,7 +35,7 @@ public class SwaggerConfig { */ @Bean public Docket createRestApi() { - return new Docket(DocumentationType.SWAGGER_2) + return new Docket(DocumentationType.OAS_30) .enable(swaggerProperties.getEnabled()) // 用来创建该API的基本信息,展示在文档的页面中(自定义展示的信息) .apiInfo(apiInfo()) @@ -60,7 +59,7 @@ public class SwaggerConfig { */ private List securitySchemes() { List apiKeyList = new ArrayList(); - apiKeyList.add(new ApiKey("Authorization", "Authorization", "header")); + apiKeyList.add(new ApiKey("Authorization", "Authorization", In.HEADER.toValue())); return apiKeyList; } @@ -72,7 +71,7 @@ public class SwaggerConfig { securityContexts.add( SecurityContext.builder() .securityReferences(defaultAuth()) - .forPaths(PathSelectors.regex("^(?!auth).*$")) + .operationSelector(o -> o.requestMappingPattern().matches("/.*")) .build()); return securityContexts; } From 1bf9dd1217ad2d62cb6e23ea40e2a56395a9f2b6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E7=96=AF=E7=8B=82=E7=9A=84=E7=8B=AE=E5=AD=90li?= <15040126243@163.com> Date: Thu, 10 Jun 2021 13:32:50 +0800 Subject: [PATCH 30/41] =?UTF-8?q?update=20=E4=BC=98=E5=8C=96redis=E9=94=81?= =?UTF-8?q?=E5=B7=A5=E5=85=B7=E4=BB=A3=E7=A0=81=E7=BB=93=E6=9E=84?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../common/core/redis/RedisLockManager.java | 109 +++++++++++++----- .../demo/controller/RedisLockController.java | 2 +- .../framework/aspectj/RedisLockAspect.java | 3 +- 3 files changed, 79 insertions(+), 35 deletions(-) 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 index fb665a995..e00f80096 100644 --- 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 @@ -22,15 +22,50 @@ public class RedisLockManager { @Autowired private RedissonClient redissonClient; - private final ThreadLocal threadLocal = new ThreadLocal<>(); + /** + * 通用锁 + */ + private final static Integer BASE_LOCK = 1; + + /** + * 公平锁 + */ + private final static Integer FAIR_LOCK = 2; + + /** + * 计数锁 + */ + private final static Integer COUNT_LOCK = 3; + + /** + * 存放当前线程获取锁的类型 + */ + private final ThreadLocal threadLocal = new ThreadLocal<>(); + + /** + * 获取锁 + */ + private T getLock(String key, Integer lockType) { + Assert.isTrue(StrUtil.isNotBlank(key), "key不能为空"); + threadLocal.set(lockType); + Object lock; + if (BASE_LOCK.equals(lockType)) { + lock = redissonClient.getLock(key); + } else if (FAIR_LOCK.equals(lockType)) { + lock = redissonClient.getFairLock(key); + } else if (COUNT_LOCK.equals(lockType)) { + lock = redissonClient.getCountDownLatch(key); + } else { + throw new RuntimeException("锁不存在!"); + } + return (T)lock; + } /** * 获取锁(不用设置超时时间,一直等待) */ public boolean getLock(String key) { - Assert.isTrue(StrUtil.isNotBlank(key), "key不能为空"); - RLock lock = redissonClient.getLock(key); - threadLocal.set(lock); + RLock lock = getLock(key, BASE_LOCK); return lock.tryLock(); } @@ -41,13 +76,16 @@ public class RedisLockManager { * @param time 过期时间 * @param expireUnit 时间单位 */ - public boolean getLock(String key, long time, TimeUnit expireUnit) throws InterruptedException { - Assert.isTrue(StrUtil.isNotBlank(key), "key不能为空"); + public boolean getLock(String key, long time, TimeUnit expireUnit) { Assert.isTrue(time > 0, "过期时间必须大于0"); Assert.isTrue(Validator.isNotEmpty(expireUnit), "时间单位不能为空"); - RLock lock = redissonClient.getLock(key); - threadLocal.set(lock); - return lock.tryLock(time, expireUnit); + RLock lock = getLock(key, BASE_LOCK); + try { + return lock.tryLock(time, expireUnit); + } catch (InterruptedException e) { + e.printStackTrace(); + return false; + } } /** @@ -57,28 +95,30 @@ public class RedisLockManager { * @param waitTime 获取锁等待时间 * @param leaseTime 保留锁的时间 * @param expireUnit 时间单位 - * @throws InterruptedException */ - public boolean getLock(String key, long waitTime, long leaseTime, TimeUnit expireUnit) throws InterruptedException { - Assert.isTrue(StrUtil.isNotBlank(key), "key不能为空"); + 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 = redissonClient.getLock(key); - threadLocal.set(lock); - return lock.tryLock(waitTime, leaseTime, 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 countDownLatch(String key, long count) { - Assert.isTrue(StrUtil.isNotBlank(key), "key不能为空"); + public RCountDownLatch getCountDownLatch(String key, long count) { Assert.isTrue(count >= 0, "count数量必须大于等于0"); - RCountDownLatch rCountDownLatch = redissonClient.getCountDownLatch(key); + RCountDownLatch rCountDownLatch = getLock(key, COUNT_LOCK); rCountDownLatch.trySetCount(count); return rCountDownLatch; } @@ -93,14 +133,17 @@ public class RedisLockManager { * @return * @throws InterruptedException */ - public boolean getFairLock(String key, long waitTime, long leaseTime, TimeUnit expireUnit) throws InterruptedException { - Assert.isTrue(StrUtil.isNotBlank(key), "key不能为空"); + 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 = redissonClient.getFairLock(key); - threadLocal.set(lock); - return lock.tryLock(waitTime, leaseTime, expireUnit); + RLock lock = getLock(key, FAIR_LOCK); + try { + return lock.tryLock(waitTime, leaseTime, expireUnit); + } catch (InterruptedException e) { + e.printStackTrace(); + return false; + } } /** @@ -109,23 +152,25 @@ public class RedisLockManager { * @param key * @param leaseTime 持有锁的时间 * @param expireUnit 时间单位 - * @return - * @throws InterruptedException */ - public boolean getFairLock(String key, long leaseTime, TimeUnit expireUnit) throws InterruptedException { - Assert.isTrue(StrUtil.isNotBlank(key), "key不能为空"); + public boolean getFairLock(String key, long leaseTime, TimeUnit expireUnit) { Assert.isTrue(leaseTime > 0, "保留锁的时间必须大于0"); Assert.isTrue(Validator.isNotEmpty(expireUnit), "时间单位不能为空"); - RLock lock = redissonClient.getFairLock(key); - threadLocal.set(lock); - return lock.tryLock(leaseTime, expireUnit); + RLock lock = getLock(key, FAIR_LOCK); + try { + return lock.tryLock(leaseTime, expireUnit); + } catch (InterruptedException e) { + e.printStackTrace(); + return false; + } } /** * 释放锁(统一释放) */ - public void unLock() { - RLock lock = threadLocal.get(); + 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 40019fc27..e80e3d6b7 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 @@ -52,7 +52,7 @@ public class RedisLockController { if (flag) { log.info("获取锁成功: " + key); Thread.sleep(3000); - redisLockManager.unLock(); + redisLockManager.unLock(key); log.info("释放锁成功: " + key); } else { log.error("获取锁失败: " + key); 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 9d3bc8d99..efe628f3c 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 @@ -10,7 +10,6 @@ import org.aspectj.lang.annotation.Around; import org.aspectj.lang.annotation.Aspect; import org.aspectj.lang.annotation.Pointcut; import org.aspectj.lang.reflect.MethodSignature; -import org.redisson.api.RLock; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.core.annotation.Order; import org.springframework.stereotype.Component; @@ -78,7 +77,7 @@ public class RedisLockAspect { } catch (Exception e) { throw new RuntimeException(e); } finally { - redisLockManager.unLock(); + redisLockManager.unLock(key); log.info("unlock => key : " + key + " , ThreadName : " + Thread.currentThread().getName()); } } else { From f6ccfe6ed3fa97d62c7fe9b10279ab0d59e80319 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E7=96=AF=E7=8B=82=E7=9A=84=E7=8B=AE=E5=AD=90li?= <15040126243@163.com> Date: Thu, 10 Jun 2021 14:04:41 +0800 Subject: [PATCH 31/41] =?UTF-8?q?update=20=E7=8B=AC=E7=AB=8B=20CountDownLa?= =?UTF-8?q?tch=20=E6=96=B9=E6=B3=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../ruoyi/common/core/redis/RedisLockManager.java | 15 ++++----------- 1 file changed, 4 insertions(+), 11 deletions(-) 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 index e00f80096..0688bb1c5 100644 --- 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 @@ -32,11 +32,6 @@ public class RedisLockManager { */ private final static Integer FAIR_LOCK = 2; - /** - * 计数锁 - */ - private final static Integer COUNT_LOCK = 3; - /** * 存放当前线程获取锁的类型 */ @@ -45,20 +40,18 @@ public class RedisLockManager { /** * 获取锁 */ - private T getLock(String key, Integer lockType) { + private RLock getLock(String key, Integer lockType) { Assert.isTrue(StrUtil.isNotBlank(key), "key不能为空"); threadLocal.set(lockType); - Object lock; + RLock lock; if (BASE_LOCK.equals(lockType)) { lock = redissonClient.getLock(key); } else if (FAIR_LOCK.equals(lockType)) { lock = redissonClient.getFairLock(key); - } else if (COUNT_LOCK.equals(lockType)) { - lock = redissonClient.getCountDownLatch(key); } else { throw new RuntimeException("锁不存在!"); } - return (T)lock; + return lock; } /** @@ -118,7 +111,7 @@ public class RedisLockManager { */ public RCountDownLatch getCountDownLatch(String key, long count) { Assert.isTrue(count >= 0, "count数量必须大于等于0"); - RCountDownLatch rCountDownLatch = getLock(key, COUNT_LOCK); + RCountDownLatch rCountDownLatch = redissonClient.getCountDownLatch(key); rCountDownLatch.trySetCount(count); return rCountDownLatch; } From 9d05d2bac5214246fd23f949f77da0ba3c882528 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E7=96=AF=E7=8B=82=E7=9A=84=E7=8B=AE=E5=AD=90li?= <15040126243@163.com> Date: Thu, 10 Jun 2021 15:42:46 +0800 Subject: [PATCH 32/41] =?UTF-8?q?remove=20=E7=A7=BB=E9=99=A4=E6=97=A0?= =?UTF-8?q?=E7=94=A8=E9=85=8D=E7=BD=AE=E6=96=87=E4=BB=B6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ruoyi-admin/src/main/resources/mybatis/mybatis-config.xml | 0 ruoyi-ui/vue.config.js | 2 +- 2 files changed, 1 insertion(+), 1 deletion(-) delete mode 100644 ruoyi-admin/src/main/resources/mybatis/mybatis-config.xml 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 e69de29bb..000000000 diff --git a/ruoyi-ui/vue.config.js b/ruoyi-ui/vue.config.js index 5eb7edd71..11cd50262 100644 --- a/ruoyi-ui/vue.config.js +++ b/ruoyi-ui/vue.config.js @@ -34,7 +34,7 @@ module.exports = { proxy: { // detail: https://cli.vuejs.org/config/#devserver-proxy [process.env.VUE_APP_BASE_API]: { - target: `http://localhost:8080`, + target: `http://localhost:8081`, changeOrigin: true, pathRewrite: { ['^' + process.env.VUE_APP_BASE_API]: '' From b561f7d90631fd95ff3f508f7eb7d557b88e2ebd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E7=96=AF=E7=8B=82=E7=9A=84=E7=8B=AE=E5=AD=90li?= <15040126243@163.com> Date: Thu, 10 Jun 2021 15:43:20 +0800 Subject: [PATCH 33/41] =?UTF-8?q?remove=20=E7=A7=BB=E9=99=A4=E6=97=A0?= =?UTF-8?q?=E7=94=A8=E9=85=8D=E7=BD=AE=E6=96=87=E4=BB=B6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ruoyi-admin/src/main/resources/mybatis/mybatis-config.xml | 0 1 file changed, 0 insertions(+), 0 deletions(-) delete mode 100644 ruoyi-admin/src/main/resources/mybatis/mybatis-config.xml 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 e69de29bb..000000000 From c5c8afe1476855f64956cfe9b1e3cd052b218471 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E7=96=AF=E7=8B=82=E7=9A=84=E7=8B=AE=E5=AD=90li?= <15040126243@163.com> Date: Thu, 10 Jun 2021 15:44:14 +0800 Subject: [PATCH 34/41] =?UTF-8?q?update=20=E8=BF=98=E5=8E=9F=E9=94=99?= =?UTF-8?q?=E8=AF=AF=E6=8F=90=E4=BA=A4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ruoyi-ui/vue.config.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ruoyi-ui/vue.config.js b/ruoyi-ui/vue.config.js index 11cd50262..5eb7edd71 100644 --- a/ruoyi-ui/vue.config.js +++ b/ruoyi-ui/vue.config.js @@ -34,7 +34,7 @@ module.exports = { proxy: { // detail: https://cli.vuejs.org/config/#devserver-proxy [process.env.VUE_APP_BASE_API]: { - target: `http://localhost:8081`, + target: `http://localhost:8080`, changeOrigin: true, pathRewrite: { ['^' + process.env.VUE_APP_BASE_API]: '' From 48d9fc10ea8111424a0315c3420384c19fa04bf4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E7=96=AF=E7=8B=82=E7=9A=84=E7=8B=AE=E5=AD=90li?= <15040126243@163.com> Date: Thu, 10 Jun 2021 16:21:44 +0800 Subject: [PATCH 35/41] =?UTF-8?q?update=20=E5=A2=9E=E5=8A=A0=E5=88=86?= =?UTF-8?q?=E9=A1=B5=E5=AF=B9=E8=B1=A1=E6=B3=A8=E9=87=8A?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../src/main/java/com/ruoyi/common/core/page/PagePlus.java | 7 +++++++ 1 file changed, 7 insertions(+) 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 812a683d6..79d889cf0 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.Arrays; import java.util.Collections; import java.util.List; +/** + * 分页 Page 增强对象 + * + * @param 数据库实体 + * @param vo实体 + * @author Lion Li + */ @Data @Accessors(chain = true) public class PagePlus implements IPage { From 427430fc4839e773648477a99d3cdf6d08715507 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E7=96=AF=E7=8B=82=E7=9A=84=E7=8B=AE=E5=AD=90li?= <15040126243@163.com> Date: Thu, 10 Jun 2021 17:11:44 +0800 Subject: [PATCH 36/41] =?UTF-8?q?update=20=E8=A1=A5=E5=85=A8=E6=B3=A8?= =?UTF-8?q?=E9=87=8A=20=E6=9B=B4=E6=96=B0=E6=96=87=E6=A1=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- README.md | 35 ++----------------- .../ruoyi/framework/config/AsyncConfig.java | 5 +++ .../ruoyi/framework/config/SwaggerConfig.java | 2 +- .../config/properties/SwaggerProperties.java | 2 +- .../properties/ThreadPoolProperties.java | 2 +- .../config/properties/TokenProperties.java | 5 +++ .../config/properties/XssProperties.java | 2 +- 7 files changed, 17 insertions(+), 36 deletions(-) diff --git a/README.md b/README.md index b877e68c4..320625763 100644 --- a/README.md +++ b/README.md @@ -18,6 +18,9 @@ * 文档框架 knife4j 美化接口文档 * 代码生成器 一键生成前后端代码 +## 参考文档 +[参考文档 Wiki](https://gitee.com/JavaLionLi/RuoYi-Vue-Plus/wikis/pages) + ## 修改RuoYi功能 ### 依赖改动 @@ -59,38 +62,6 @@ -## 重点注意事项 - -若依文档对事务注解的描述 [关于事务](https://doc.ruoyi.vip/ruoyi/document/htsc.html#%E4%BA%8B%E5%8A%A1%E7%AE%A1%E7%90%86) 以下对多数据源事务做补充: -* 同一个事务下是无法切换数据源的 -* 禁止 父方法使用 @Transactional 创建事务 子方法使用 @DataSource 切换数据源 -* 正确用法: 子方法单独创建事务 或 父方法使用 @Transactional(propagation = Propagation.REQUIRES_NEW) 为所有子方法创建新事务 - -关于如何使用Tomcat -* 查看ruoyi-framework模块的pom.xml文件,根据注释更改依赖 -* 查看ruoyi-admin模块中的application.yml文件,根据注释更改配置 - -关于如何创建新模块 -* 参考ruoyi-demo模块 -* 需要改动: 父pom 与 admin模块pom - -关于树表生成 -* 直接在mysql表中 添加 parentId orderNum 等字段(根据需要参考 TreeEntity类) -* 代码生成选择树表生成即可 - -关于数据权限 -* 创建表 需预留 dept_id 字段 如需用户权限 还需预留 user_id 字段 -* 支持 Mybatis-Plus 方式注入 参考 demo 模块用法(需导入 test.sql 文件) -* 支持 XML 方式注入 参考 system 模块用法 - -关于vue与boot整合部署 -* [前端静态资源如何整合到后端访问](https://doc.ruoyi.vip/ruoyi-vue/other/faq.html#前端静态资源如何整合到后端访问) - -关于修改包名 -* 将文件夹全部修改为 com.xxx -* 使用IDEA全局替换 com.ruoyi 替换为 com.xxx -* 严禁手动修改 - ## 内置功能 1. 用户管理:用户是系统操作者,该功能主要完成系统用户配置。 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 568260209..5c11ae67a 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.Arrays; 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/SwaggerConfig.java b/ruoyi-framework/src/main/java/com/ruoyi/framework/config/SwaggerConfig.java index 7b5d95105..2c65ac69d 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 @@ -19,7 +19,7 @@ import java.util.ArrayList; import java.util.List; /** - * Swagger2的接口配置 + * Swagger 文档配置 * * @author Lion Li */ 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 f99c3da15..ece75efef 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.boot.context.properties.ConfigurationProperties; 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 68cb09337..08b6842aa 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.boot.context.properties.ConfigurationProperties; 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 d582e5407..f695c1c62 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 lombok.Data; 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 35ae2e4ff..d8a68a86a 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.boot.context.properties.ConfigurationProperties; import org.springframework.stereotype.Component; /** - * 验证码 配置属性 + * xss过滤 配置属性 * * @author Lion Li */ From 35f607f9a541cb78d5ed695f956e22051c3ce0f1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E7=96=AF=E7=8B=82=E7=9A=84=E7=8B=AE=E5=AD=90li?= <15040126243@163.com> Date: Thu, 10 Jun 2021 18:23:59 +0800 Subject: [PATCH 37/41] =?UTF-8?q?remove=20=E5=88=A0=E9=99=A4=E6=97=A0?= =?UTF-8?q?=E7=94=A8=E6=B3=A8=E9=87=8A?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ruoyi-admin/src/main/resources/application.yml | 2 -- 1 file changed, 2 deletions(-) diff --git a/ruoyi-admin/src/main/resources/application.yml b/ruoyi-admin/src/main/resources/application.yml index 3ea04c71e..476a9333d 100644 --- a/ruoyi-admin/src/main/resources/application.yml +++ b/ruoyi-admin/src/main/resources/application.yml @@ -288,8 +288,6 @@ spring: 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 From 57df2690da79e420b8e0510895cba8d5d903d8c3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E7=96=AF=E7=8B=82=E7=9A=84=E7=8B=AE=E5=AD=90li?= <15040126243@163.com> Date: Thu, 10 Jun 2021 20:23:15 +0800 Subject: [PATCH 38/41] =?UTF-8?q?update=20spring-cache=20=E6=95=B4?= =?UTF-8?q?=E5=90=88=20redisson?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../demo/controller/RedisLockController.java | 10 ++++++++++ .../com/ruoyi/framework/config/RedisConfig.java | 16 ++++++++++++++++ 2 files changed, 26 insertions(+) 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 e80e3d6b7..c3c71efc4 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 @@ -5,6 +5,7 @@ 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; @@ -62,4 +63,13 @@ public class RedisLockController { } return AjaxResult.success(); } + + /** + * 测试spring-cache注解 + */ + @Cacheable(value = "test", key = "#key") + @GetMapping("/testCache") + public AjaxResult testCache(String key) { + return AjaxResult.success("操作成功", key); + } } 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 e86f5bc03..95c7572fd 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.Redisson; 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 @@ public class RedisConfig extends CachingConfigurerSupport { .setDnsMonitoringInterval(singleServerConfig.getDnsMonitoringInterval()); return Redisson.create(config); } + + /** + * 整合spring-cache + */ + @Bean + public CacheManager cacheManager(RedissonClient redissonClient) { + Map config = new HashMap<>(); + config.put("redissonCacheMap", new CacheConfig(30*60*1000, 10*60*1000)); + return new RedissonSpringCacheManager(redissonClient, config, JsonJacksonCodec.INSTANCE); + } + } From 24da85fea353960420d370cd6a50ee7be4d7ef32 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E7=96=AF=E7=8B=82=E7=9A=84=E7=8B=AE=E5=AD=90li?= <15040126243@163.com> Date: Thu, 10 Jun 2021 21:18:58 +0800 Subject: [PATCH 39/41] =?UTF-8?q?update=20MybatisPlus=E6=95=B4=E5=90=88Red?= =?UTF-8?q?is=E4=BA=8C=E7=BA=A7=E7=BC=93=E5=AD=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../mybatisplus/MybatisPlusRedisCache.java | 102 ++++++++++++++++++ .../com/ruoyi/demo/mapper/TestDemoMapper.java | 5 +- .../com/ruoyi/demo/mapper/TestTreeMapper.java | 5 +- .../src/main/resources/vm/java/mapper.java.vm | 3 + 4 files changed, 113 insertions(+), 2 deletions(-) create mode 100644 ruoyi-common/src/main/java/com/ruoyi/common/core/mybatisplus/MybatisPlusRedisCache.java 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 000000000..6ff6a982b --- /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) { + //由于启动期间注入失败,只能运行期间注入,这段代码可以删除 + 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 keys = redisCache.keys("*:" + this.id + "*"); + if (!CollectionUtils.isEmpty(keys)) { + redisCache.deleteObject(keys); + } + } + + @Override + public int getSize() { + RedisTemplate redisTemplate = SpringUtil.getBean("redisTemplate"); + Long size = redisTemplate.execute(RedisServerCommands::dbSize); + return size.intValue(); + } + + @Override + public ReadWriteLock getReadWriteLock() { + return this.readWriteLock; + } +} 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 2416f0efc..5cfb9f69c 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 @@ import com.ruoyi.common.core.page.BaseMapperPlus; * @author Lion Li * @date 2021-05-30 */ +@CacheNamespace(implementation = MybatisPlusRedisCache.class, eviction = MybatisPlusRedisCache.class) public interface TestDemoMapper extends BaseMapperPlus { } 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 6dd75c50d..0635ebc06 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 @@ import com.ruoyi.common.core.page.BaseMapperPlus; * @author Lion Li * @date 2021-05-30 */ +@CacheNamespace(implementation = MybatisPlusRedisCache.class, eviction = MybatisPlusRedisCache.class) public interface TestTreeMapper extends BaseMapperPlus { } 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 600841891..36a98642c 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 @@ package ${packageName}.mapper; 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 @@ import com.ruoyi.common.core.page.BaseMapperPlus; * @author ${author} * @date ${datetime} */ +@CacheNamespace(implementation = MybatisPlusRedisCache.class, eviction = MybatisPlusRedisCache.class) public interface ${ClassName}Mapper extends BaseMapperPlus<${ClassName}> { } From 346e80839fa450ff75869e9bfa39d9a1df4bebec Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E7=96=AF=E7=8B=82=E7=9A=84=E7=8B=AE=E5=AD=90Li?= <15040126243@163.com> Date: Thu, 10 Jun 2021 22:32:40 +0800 Subject: [PATCH 40/41] =?UTF-8?q?update=20spring-cache=20=E4=B8=8E=20MP?= =?UTF-8?q?=E4=BA=8C=E7=BA=A7=E7=BC=93=E5=AD=98=E7=9B=B8=E5=85=B3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- README.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/README.md b/README.md index 320625763..312f3e1fd 100644 --- a/README.md +++ b/README.md @@ -46,6 +46,8 @@ * 项目修改为 maven多环境配置 * 项目配置修改为 application.yml 统一管理 * 数据权限修改为 适配支持单表、多表 +* 使用 redisson 实现 spring-cache 整合 +* 增加 mybatis-plus 二级缓存 redis 存储 ### 其他 From bf3a88ff1a12de55e643ba79eb0daaef57680d20 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E7=96=AF=E7=8B=82=E7=9A=84=E7=8B=AE=E5=AD=90li?= <15040126243@163.com> Date: Fri, 11 Jun 2021 09:23:34 +0800 Subject: [PATCH 41/41] =?UTF-8?q?=E5=8F=91=E7=89=88=20v2.3.2?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- pom.xml | 16 ++++++++-------- ruoyi-ui/package.json | 2 +- ruoyi-ui/src/views/index.vue | 11 +++++++++++ 3 files changed, 20 insertions(+), 9 deletions(-) diff --git a/pom.xml b/pom.xml index 94ab8d5ce..4a73f1eac 100644 --- a/pom.xml +++ b/pom.xml @@ -13,7 +13,7 @@ RuoYi-Vue-Plus后台管理系统 - 2.3.1 + 2.3.2 2.3.11.RELEASE UTF-8 UTF-8 @@ -126,6 +126,13 @@ ${spring-boot-admin.version} + + + org.redisson + redisson-spring-boot-starter + ${redisson.version} + + com.ruoyi @@ -168,13 +175,6 @@ ${ruoyi-vue-plus.version} - - - org.redisson - redisson-spring-boot-starter - ${redisson.version} - - diff --git a/ruoyi-ui/package.json b/ruoyi-ui/package.json index 52551a4cc..d90fdbac6 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/views/index.vue b/ruoyi-ui/src/views/index.vue index d904f3098..5f487c914 100644 --- a/ruoyi-ui/src/views/index.vue +++ b/ruoyi-ui/src/views/index.vue @@ -80,6 +80,17 @@ 更新日志 + +
        +
      1. add redis锁工具类编写
      2. +
      3. update spring-cache 整合 redisson
      4. +
      5. update MybatisPlus整合Redis二级缓存
      6. +
      7. update swagger 升级为 3.0.0 使用 OAS_30 协议
      8. +
      9. update 优化 代码生成器 增加表单防重注解
      10. +
      11. update 优化 锁切面代码 key到常量类
      12. +
      13. fix 修复相对路径上传异常问题
      14. +
      +
      1. add 增加 redisson 分布式锁 注解与demo案例