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/27] =?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 3a2a03d6..06456dd8 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/27] =?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 e69de29b..00000000 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/27] =?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 fbf6ec81..7c76c571 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/27] =?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 796d57fb..77834652 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 a197fd39..43c0aead 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/27] =?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 3a2a03d6..06456dd8 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/27] =?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 e69de29b..00000000 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/27] =?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 fbf6ec81..7c76c571 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/27] =?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 796d57fb..77834652 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 a197fd39..43c0aead 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/27] =?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 4d2f9bbd..ce23af09 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/27] =?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 7f09d7c7..3d8971d6 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 faae4aab..70385659 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 87acff4f..79a4036e 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/27] =?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 796d57fb..2a58722a 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 a197fd39..6d52bf68 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 d26de0ad..c8e91919 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 157030fb..a272a6e9 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 306b6f2b..e2e06253 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 3a2a03d6..06456dd8 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 45addb3c..7da0c669 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 4d2f9bbd..0a766e53 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 7f09d7c7..3d8971d6 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 83846275..569ecf96 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 7cf20f02..5a19aa79 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 87b3c884..a806cbd6 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 fbf6ec81..2376d8b5 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 faae4aab..70385659 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 87acff4f..79a4036e 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 0f996710..21f68541 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 2e7162f3..1a542f83 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 1135dee9..df59332b 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 4bdce363..e951b8d6 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 aff093d4..4c5cb6b8 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 37034d2f..2f0532da 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 9e07ee96..8dc50600 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 5198b003..4d6f7ae6 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 00000000..897e54e8 --- /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 00000000..ddf76777 --- /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 91beb844..c246ac97 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 00000000..a6ba5a53 --- /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 ecf7a5f3..d296c55c 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 00000000..b7003ce2 --- /dev/null +++ b/sql/test.sql @@ -0,0 +1,171 @@ +DROP TABLE if EXISTS test_demo; +CREATE TABLE test_demo +( + id int(0) NOT NULL AUTO_INCREMENT COMMENT '主键', + dept_id int(0) NULL DEFAULT NULL COMMENT '部门id', + user_id int(0) NULL DEFAULT NULL COMMENT '用户id', + order_num int(0) NULL DEFAULT 0 COMMENT '排序号', + test_key varchar(255) NULL DEFAULT NULL COMMENT 'key键', + value varchar(255) NULL DEFAULT NULL COMMENT '值', + version int(0) NULL DEFAULT 0 COMMENT '版本', + create_time datetime(0) NULL DEFAULT NULL COMMENT '创建时间', + create_by varchar(64) NULL DEFAULT NULL COMMENT '创建人', + update_time datetime(0) NULL DEFAULT NULL COMMENT '更新时间', + update_by varchar(64) NULL DEFAULT NULL COMMENT '更新人', + del_flag int(0) NULL DEFAULT NULL COMMENT '删除标志', + PRIMARY KEY (id) USING BTREE +) ENGINE = InnoDB COMMENT = '测试单表'; + +DROP TABLE if EXISTS test_tree; +CREATE TABLE test_tree +( + id int(0) NOT NULL AUTO_INCREMENT COMMENT '主键', + parent_id int(0) NULL DEFAULT 0 COMMENT '父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/27] =?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 c246ac97..29d4dbb5 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/27] =?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 e8ef1018..383f4b64 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/27] =?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 b8687298..e86f5bc0 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/27] =?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 ce17def9..7aac0bf1 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 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 19/27] =?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 53429199..137969a8 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 0ff695f8..0af3844f 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 20/27] =?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 cb4a225f..22d53c7f 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 f48e807cee8e21917cb0fd7757f8f0f79436534b 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, 23 Jun 2021 09:51:44 +0800 Subject: [PATCH 21/27] =?UTF-8?q?remove=20=E5=88=A0=E9=99=A4=E6=97=A0?= =?UTF-8?q?=E7=94=A8=E6=B5=8B=E8=AF=95=E7=B1=BB?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../java/com/ruoyi/demo/bo/ChkjTestAddBo.java | 50 -------- .../com/ruoyi/demo/bo/ChkjTestEditBo.java | 61 ---------- .../com/ruoyi/demo/bo/ChkjTestQueryBo.java | 53 --------- .../demo/controller/ChkjTestController.java | 108 ------------------ .../java/com/ruoyi/demo/domain/ChkjTest.java | 55 --------- .../com/ruoyi/demo/mapper/ChkjTestMapper.java | 14 --- .../ruoyi/demo/service/IChkjTestService.java | 57 --------- .../service/impl/ChkjTestServiceImpl.java | 93 --------------- .../java/com/ruoyi/demo/vo/ChkjTestVo.java | 57 --------- .../resources/mapper/demo/ChkjTestMapper.xml | 19 --- ruoyi-ui/src/api/demo/test.js | 53 --------- 11 files changed, 620 deletions(-) delete mode 100644 ruoyi-demo/src/main/java/com/ruoyi/demo/bo/ChkjTestAddBo.java delete mode 100644 ruoyi-demo/src/main/java/com/ruoyi/demo/bo/ChkjTestEditBo.java delete mode 100644 ruoyi-demo/src/main/java/com/ruoyi/demo/bo/ChkjTestQueryBo.java delete mode 100644 ruoyi-demo/src/main/java/com/ruoyi/demo/controller/ChkjTestController.java delete mode 100644 ruoyi-demo/src/main/java/com/ruoyi/demo/domain/ChkjTest.java delete mode 100644 ruoyi-demo/src/main/java/com/ruoyi/demo/mapper/ChkjTestMapper.java delete mode 100644 ruoyi-demo/src/main/java/com/ruoyi/demo/service/IChkjTestService.java delete mode 100644 ruoyi-demo/src/main/java/com/ruoyi/demo/service/impl/ChkjTestServiceImpl.java delete mode 100644 ruoyi-demo/src/main/java/com/ruoyi/demo/vo/ChkjTestVo.java delete mode 100644 ruoyi-demo/src/main/resources/mapper/demo/ChkjTestMapper.xml delete mode 100644 ruoyi-ui/src/api/demo/test.js diff --git a/ruoyi-demo/src/main/java/com/ruoyi/demo/bo/ChkjTestAddBo.java b/ruoyi-demo/src/main/java/com/ruoyi/demo/bo/ChkjTestAddBo.java deleted file mode 100644 index d8c406f5..00000000 --- a/ruoyi-demo/src/main/java/com/ruoyi/demo/bo/ChkjTestAddBo.java +++ /dev/null @@ -1,50 +0,0 @@ -package com.ruoyi.demo.bo; - -import com.fasterxml.jackson.annotation.JsonFormat; -import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; -import lombok.Data; - -import javax.validation.constraints.NotBlank; -import javax.validation.constraints.NotNull; -import java.util.Date; - - - -/** - * 测试添加对象 chkj_test - * - * @author Lion Li - * @date 2021-05-14 - */ -@Data -@ApiModel("测试添加对象") -public class ChkjTestAddBo { - - /** key键 */ - @ApiModelProperty("key键") - @NotBlank(message = "key键不能为空") - private String testKey; - /** 值 */ - @ApiModelProperty("值") - @NotBlank(message = "值不能为空") - private String value; - /** 版本 */ - @ApiModelProperty("版本") - private Long version; - /** 创建时间 */ - @ApiModelProperty("创建时间") - @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") - private Date createTime; - /** 删除标志 */ - @ApiModelProperty("删除标志") - private Long deleted; - /** 父id */ - @ApiModelProperty("父id") - @NotNull(message = "父id不能为空") - private Long parentId; - /** 排序号 */ - @ApiModelProperty("排序号") - @NotNull(message = "排序号不能为空") - private Long orderNum; -} diff --git a/ruoyi-demo/src/main/java/com/ruoyi/demo/bo/ChkjTestEditBo.java b/ruoyi-demo/src/main/java/com/ruoyi/demo/bo/ChkjTestEditBo.java deleted file mode 100644 index acabd9f2..00000000 --- a/ruoyi-demo/src/main/java/com/ruoyi/demo/bo/ChkjTestEditBo.java +++ /dev/null @@ -1,61 +0,0 @@ -package com.ruoyi.demo.bo; - -import com.fasterxml.jackson.annotation.JsonFormat; -import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; -import lombok.Data; - -import javax.validation.constraints.NotBlank; -import javax.validation.constraints.NotNull; -import java.util.Date; - - -/** - * 测试编辑对象 chkj_test - * - * @author Lion Li - * @date 2021-05-14 - */ -@Data -@ApiModel("测试编辑对象") -public class ChkjTestEditBo { - - - /** 主键 */ - @ApiModelProperty("主键") - @NotNull(message = "主键不能为空") - private Long id; - - /** key键 */ - @ApiModelProperty("key键") - @NotBlank(message = "key键不能为空") - private String testKey; - - /** 值 */ - @ApiModelProperty("值") - @NotBlank(message = "值不能为空") - private String value; - - /** 版本 */ - @ApiModelProperty("版本") - private Long version; - - /** 创建时间 */ - @ApiModelProperty("创建时间") - @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") - private Date createTime; - - /** 删除标志 */ - @ApiModelProperty("删除标志") - private Long deleted; - - /** 父id */ - @ApiModelProperty("父id") - @NotNull(message = "父id不能为空") - private Long parentId; - - /** 排序号 */ - @ApiModelProperty("排序号") - @NotNull(message = "排序号不能为空") - private Long orderNum; -} diff --git a/ruoyi-demo/src/main/java/com/ruoyi/demo/bo/ChkjTestQueryBo.java b/ruoyi-demo/src/main/java/com/ruoyi/demo/bo/ChkjTestQueryBo.java deleted file mode 100644 index bc71509d..00000000 --- a/ruoyi-demo/src/main/java/com/ruoyi/demo/bo/ChkjTestQueryBo.java +++ /dev/null @@ -1,53 +0,0 @@ -package com.ruoyi.demo.bo; - -import com.ruoyi.common.core.domain.BaseEntity; -import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; -import lombok.Data; -import lombok.EqualsAndHashCode; - -/** - * 测试分页查询对象 chkj_test - * - * @author Lion Li - * @date 2021-05-14 - */ -@Data -@EqualsAndHashCode(callSuper = true) -@ApiModel("测试分页查询对象") -public class ChkjTestQueryBo extends BaseEntity { - - /** 分页大小 */ - @ApiModelProperty("分页大小") - private Integer pageSize; - /** 当前页数 */ - @ApiModelProperty("当前页数") - private Integer pageNum; - /** 排序列 */ - @ApiModelProperty("排序列") - private String orderByColumn; - /** 排序的方向desc或者asc */ - @ApiModelProperty(value = "排序的方向", example = "asc,desc") - private String isAsc; - - - /** key键 */ - @ApiModelProperty("key键") - private String testKey; - /** 值 */ - @ApiModelProperty("值") - private String value; - /** 版本 */ - @ApiModelProperty("版本") - private Long version; - /** 删除标志 */ - @ApiModelProperty("删除标志") - private Long deleted; - /** 父id */ - @ApiModelProperty("父id") - private Long parentId; - /** 排序号 */ - @ApiModelProperty("排序号") - private Long orderNum; - -} diff --git a/ruoyi-demo/src/main/java/com/ruoyi/demo/controller/ChkjTestController.java b/ruoyi-demo/src/main/java/com/ruoyi/demo/controller/ChkjTestController.java deleted file mode 100644 index 429db8fa..00000000 --- a/ruoyi-demo/src/main/java/com/ruoyi/demo/controller/ChkjTestController.java +++ /dev/null @@ -1,108 +0,0 @@ -package com.ruoyi.demo.controller; - -import com.ruoyi.common.annotation.Log; -import com.ruoyi.common.core.controller.BaseController; -import com.ruoyi.common.core.domain.AjaxResult; -import com.ruoyi.common.core.page.TableDataInfo; -import com.ruoyi.common.enums.BusinessType; -import com.ruoyi.common.utils.poi.ExcelUtil; -import com.ruoyi.demo.bo.ChkjTestAddBo; -import com.ruoyi.demo.bo.ChkjTestEditBo; -import com.ruoyi.demo.bo.ChkjTestQueryBo; -import com.ruoyi.demo.service.IChkjTestService; -import com.ruoyi.demo.vo.ChkjTestVo; -import io.swagger.annotations.Api; -import io.swagger.annotations.ApiOperation; -import lombok.RequiredArgsConstructor; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.security.access.prepost.PreAuthorize; -import org.springframework.validation.annotation.Validated; -import org.springframework.web.bind.annotation.*; - -import javax.validation.constraints.NotEmpty; -import javax.validation.constraints.NotNull; -import java.util.Arrays; -import java.util.List; - -/** - * 测试Controller - * - * @author Lion Li - * @date 2021-05-14 - */ -@Api(value = "测试控制器", tags = {"测试管理"}) -@RequiredArgsConstructor(onConstructor_ = @Autowired) -@RestController -@RequestMapping("/demo/test") -public class ChkjTestController extends BaseController { - - private final IChkjTestService iChkjTestService; - - /** - * 查询测试列表 - */ - @ApiOperation("查询测试列表") - @PreAuthorize("@ss.hasPermi('demo:test:list')") - @GetMapping("/list") - public TableDataInfo list(@Validated ChkjTestQueryBo bo) { - return iChkjTestService.queryPageList(bo); - } - - /** - * 导出测试列表 - */ - @ApiOperation("导出测试列表") - @PreAuthorize("@ss.hasPermi('demo:test:export')") - @Log(title = "测试", businessType = BusinessType.EXPORT) - @GetMapping("/export") - public AjaxResult export(@Validated ChkjTestQueryBo bo) { - List list = iChkjTestService.queryList(bo); - ExcelUtil util = new ExcelUtil(ChkjTestVo.class); - return util.exportExcel(list, "测试"); - } - - /** - * 获取测试详细信息 - */ - @ApiOperation("获取测试详细信息") - @PreAuthorize("@ss.hasPermi('demo:test:query')") - @GetMapping("/{id}") - public AjaxResult getInfo(@NotNull(message = "主键不能为空") - @PathVariable("id") Long id) { - return AjaxResult.success(iChkjTestService.queryById(id)); - } - - /** - * 新增测试 - */ - @ApiOperation("新增测试") - @PreAuthorize("@ss.hasPermi('demo:test:add')") - @Log(title = "测试", businessType = BusinessType.INSERT) - @PostMapping() - public AjaxResult add(@Validated @RequestBody ChkjTestAddBo bo) { - return toAjax(iChkjTestService.insertByAddBo(bo) ? 1 : 0); - } - - /** - * 修改测试 - */ - @ApiOperation("修改测试") - @PreAuthorize("@ss.hasPermi('demo:test:edit')") - @Log(title = "测试", businessType = BusinessType.UPDATE) - @PutMapping() - public AjaxResult edit(@Validated @RequestBody ChkjTestEditBo bo) { - return toAjax(iChkjTestService.updateByEditBo(bo) ? 1 : 0); - } - - /** - * 删除测试 - */ - @ApiOperation("删除测试") - @PreAuthorize("@ss.hasPermi('demo:test:remove')") - @Log(title = "测试" , businessType = BusinessType.DELETE) - @DeleteMapping("/{ids}") - public AjaxResult remove(@NotEmpty(message = "主键不能为空") - @PathVariable Long[] ids) { - return toAjax(iChkjTestService.deleteWithValidByIds(Arrays.asList(ids), true) ? 1 : 0); - } -} diff --git a/ruoyi-demo/src/main/java/com/ruoyi/demo/domain/ChkjTest.java b/ruoyi-demo/src/main/java/com/ruoyi/demo/domain/ChkjTest.java deleted file mode 100644 index ca46d5b6..00000000 --- a/ruoyi-demo/src/main/java/com/ruoyi/demo/domain/ChkjTest.java +++ /dev/null @@ -1,55 +0,0 @@ -package com.ruoyi.demo.domain; - -import com.baomidou.mybatisplus.annotation.FieldFill; -import com.baomidou.mybatisplus.annotation.TableField; -import com.baomidou.mybatisplus.annotation.TableId; -import com.baomidou.mybatisplus.annotation.TableName; -import lombok.Data; -import lombok.NoArgsConstructor; -import lombok.experimental.Accessors; - -import java.io.Serializable; -import java.util.Date; - -/** - * 测试对象 chkj_test - * - * @author Lion Li - * @date 2021-05-14 - */ -@Data -@NoArgsConstructor -@Accessors(chain = true) -@TableName("chkj_test") -public class ChkjTest implements Serializable { - -private static final long serialVersionUID=1L; - - - /** 主键 */ - @TableId(value = "id") - private Long id; - - /** key键 */ - private String testKey; - - /** 值 */ - private String value; - - /** 版本 */ - private Long version; - - /** 创建时间 */ - @TableField(fill = FieldFill.INSERT) - private Date createTime; - - /** 删除标志 */ - private Long deleted; - - /** 父id */ - private Long parentId; - - /** 排序号 */ - private Long orderNum; - -} diff --git a/ruoyi-demo/src/main/java/com/ruoyi/demo/mapper/ChkjTestMapper.java b/ruoyi-demo/src/main/java/com/ruoyi/demo/mapper/ChkjTestMapper.java deleted file mode 100644 index 87422971..00000000 --- a/ruoyi-demo/src/main/java/com/ruoyi/demo/mapper/ChkjTestMapper.java +++ /dev/null @@ -1,14 +0,0 @@ -package com.ruoyi.demo.mapper; - -import com.ruoyi.demo.domain.ChkjTest; -import com.ruoyi.common.core.page.BaseMapperPlus; - -/** - * 测试Mapper接口 - * - * @author Lion Li - * @date 2021-05-14 - */ -public interface ChkjTestMapper extends BaseMapperPlus { - -} diff --git a/ruoyi-demo/src/main/java/com/ruoyi/demo/service/IChkjTestService.java b/ruoyi-demo/src/main/java/com/ruoyi/demo/service/IChkjTestService.java deleted file mode 100644 index 8896714b..00000000 --- a/ruoyi-demo/src/main/java/com/ruoyi/demo/service/IChkjTestService.java +++ /dev/null @@ -1,57 +0,0 @@ -package com.ruoyi.demo.service; - -import com.ruoyi.demo.domain.ChkjTest; -import com.ruoyi.demo.vo.ChkjTestVo; -import com.ruoyi.demo.bo.ChkjTestQueryBo; -import com.ruoyi.demo.bo.ChkjTestAddBo; -import com.ruoyi.demo.bo.ChkjTestEditBo; -import com.ruoyi.common.core.page.IServicePlus; -import com.ruoyi.common.core.page.TableDataInfo; - -import java.util.Collection; -import java.util.List; - -/** - * 测试Service接口 - * - * @author Lion Li - * @date 2021-05-14 - */ -public interface IChkjTestService extends IServicePlus { - /** - * 查询单个 - * @return - */ - ChkjTestVo queryById(Long id); - - /** - * 查询列表 - */ - TableDataInfo queryPageList(ChkjTestQueryBo bo); - /** - * 查询列表 - */ - List queryList(ChkjTestQueryBo bo); - - /** - * 根据新增业务对象插入测试 - * @param bo 测试新增业务对象 - * @return - */ - Boolean insertByAddBo(ChkjTestAddBo bo); - - /** - * 根据编辑业务对象修改测试 - * @param bo 测试编辑业务对象 - * @return - */ - Boolean updateByEditBo(ChkjTestEditBo bo); - - /** - * 校验并删除数据 - * @param ids 主键集合 - * @param isValid 是否校验,true-删除前校验,false-不校验 - * @return - */ - Boolean deleteWithValidByIds(Collection ids, Boolean isValid); -} diff --git a/ruoyi-demo/src/main/java/com/ruoyi/demo/service/impl/ChkjTestServiceImpl.java b/ruoyi-demo/src/main/java/com/ruoyi/demo/service/impl/ChkjTestServiceImpl.java deleted file mode 100644 index 9808d27a..00000000 --- a/ruoyi-demo/src/main/java/com/ruoyi/demo/service/impl/ChkjTestServiceImpl.java +++ /dev/null @@ -1,93 +0,0 @@ -package com.ruoyi.demo.service.impl; - -import cn.hutool.core.bean.BeanUtil; -import cn.hutool.core.util.StrUtil; -import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; -import com.baomidou.mybatisplus.core.toolkit.Wrappers; -import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; -import com.ruoyi.common.core.page.PagePlus; -import com.ruoyi.common.core.page.TableDataInfo; -import com.ruoyi.common.utils.PageUtils; -import com.ruoyi.demo.bo.ChkjTestAddBo; -import com.ruoyi.demo.bo.ChkjTestEditBo; -import com.ruoyi.demo.bo.ChkjTestQueryBo; -import com.ruoyi.demo.domain.ChkjTest; -import com.ruoyi.demo.mapper.ChkjTestMapper; -import com.ruoyi.demo.service.IChkjTestService; -import com.ruoyi.demo.vo.ChkjTestVo; -import org.springframework.stereotype.Service; - -import java.util.Collection; -import java.util.List; -import java.util.Map; - -/** - * 测试Service业务层处理 - * - * @author Lion Li - * @date 2021-05-14 - */ -@Service -public class ChkjTestServiceImpl extends ServiceImpl implements IChkjTestService { - - @Override - public ChkjTestVo queryById(Long id){ - return getVoById(id, obj -> BeanUtil.toBean(obj, ChkjTestVo.class)); - } - - @Override - public TableDataInfo queryPageList(ChkjTestQueryBo bo) { - PagePlus result = pageVo(PageUtils.buildPagePlus(), buildQueryWrapper(bo), ChkjTestVo.class); - return PageUtils.buildDataInfo(result); - } - - @Override - public List queryList(ChkjTestQueryBo bo) { - return listVo(buildQueryWrapper(bo), ChkjTestVo.class); - } - - private LambdaQueryWrapper buildQueryWrapper(ChkjTestQueryBo bo) { - Map params = bo.getParams(); - LambdaQueryWrapper lqw = Wrappers.lambdaQuery(); - lqw.like(StrUtil.isNotBlank(bo.getTestKey()), ChkjTest::getTestKey, bo.getTestKey()); - lqw.eq(StrUtil.isNotBlank(bo.getValue()), ChkjTest::getValue, bo.getValue()); - lqw.eq(bo.getVersion() != null, ChkjTest::getVersion, bo.getVersion()); - lqw.between(params.get("beginCreateTime") != null && params.get("endCreateTime") != null, - ChkjTest::getCreateTime ,params.get("beginCreateTime"), params.get("endCreateTime")); - lqw.eq(bo.getDeleted() != null, ChkjTest::getDeleted, bo.getDeleted()); - lqw.eq(bo.getParentId() != null, ChkjTest::getParentId, bo.getParentId()); - lqw.eq(bo.getOrderNum() != null, ChkjTest::getOrderNum, bo.getOrderNum()); - return lqw; - } - - @Override - public Boolean insertByAddBo(ChkjTestAddBo bo) { - ChkjTest add = BeanUtil.toBean(bo, ChkjTest.class); - validEntityBeforeSave(add); - return save(add); - } - - @Override - public Boolean updateByEditBo(ChkjTestEditBo bo) { - ChkjTest update = BeanUtil.toBean(bo, ChkjTest.class); - validEntityBeforeSave(update); - return updateById(update); - } - - /** - * 保存前的数据校验 - * - * @param entity 实体类数据 - */ - private void validEntityBeforeSave(ChkjTest entity){ - //TODO 做一些数据校验,如唯一约束 - } - - @Override - public Boolean deleteWithValidByIds(Collection ids, Boolean isValid) { - if(isValid){ - //TODO 做一些业务上的校验,判断是否需要校验 - } - return removeByIds(ids); - } -} diff --git a/ruoyi-demo/src/main/java/com/ruoyi/demo/vo/ChkjTestVo.java b/ruoyi-demo/src/main/java/com/ruoyi/demo/vo/ChkjTestVo.java deleted file mode 100644 index e283a811..00000000 --- a/ruoyi-demo/src/main/java/com/ruoyi/demo/vo/ChkjTestVo.java +++ /dev/null @@ -1,57 +0,0 @@ -package com.ruoyi.demo.vo; - -import com.ruoyi.common.annotation.Excel; -import com.fasterxml.jackson.annotation.JsonFormat; -import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; -import lombok.Data; -import java.util.Date; - - - -/** - * 测试视图对象 mall_package - * - * @author Lion Li - * @date 2021-05-14 - */ -@Data -@ApiModel("测试视图对象") -public class ChkjTestVo { - private static final long serialVersionUID = 1L; - - /** 主键 */ - @ApiModelProperty("主键") - private Long id; - - /** key键 */ - @Excel(name = "key键") - @ApiModelProperty("key键") - private String testKey; - /** 值 */ - @Excel(name = "值") - @ApiModelProperty("值") - private String value; - /** 版本 */ - @Excel(name = "版本") - @ApiModelProperty("版本") - private Long version; - /** 创建时间 */ - @Excel(name = "创建时间" , width = 30, dateFormat = "yyyy-MM-dd") - @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") - @ApiModelProperty("创建时间") - private Date createTime; - /** 删除标志 */ - @Excel(name = "删除标志") - @ApiModelProperty("删除标志") - private Long deleted; - /** 父id */ - @Excel(name = "父id") - @ApiModelProperty("父id") - private Long parentId; - /** 排序号 */ - @Excel(name = "排序号") - @ApiModelProperty("排序号") - private Long orderNum; - -} diff --git a/ruoyi-demo/src/main/resources/mapper/demo/ChkjTestMapper.xml b/ruoyi-demo/src/main/resources/mapper/demo/ChkjTestMapper.xml deleted file mode 100644 index 2b59b3fb..00000000 --- a/ruoyi-demo/src/main/resources/mapper/demo/ChkjTestMapper.xml +++ /dev/null @@ -1,19 +0,0 @@ - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/ruoyi-ui/src/api/demo/test.js b/ruoyi-ui/src/api/demo/test.js deleted file mode 100644 index f4c64211..00000000 --- a/ruoyi-ui/src/api/demo/test.js +++ /dev/null @@ -1,53 +0,0 @@ -import request from '@/utils/request' - -// 查询测试列表 -export function listTest(query) { - return request({ - url: '/demo/test/list', - method: 'get', - params: query - }) -} - -// 查询测试详细 -export function getTest(id) { - return request({ - url: '/demo/test/' + id, - method: 'get' - }) -} - -// 新增测试 -export function addTest(data) { - return request({ - url: '/demo/test', - method: 'post', - data: data - }) -} - -// 修改测试 -export function updateTest(data) { - return request({ - url: '/demo/test', - method: 'put', - data: data - }) -} - -// 删除测试 -export function delTest(id) { - return request({ - url: '/demo/test/' + id, - method: 'delete' - }) -} - -// 导出测试 -export function exportTest(query) { - return request({ - url: '/demo/test/export', - method: 'get', - params: query - }) -} \ No newline at end of file From dfd7f594b521fee05a09874496c762be17ddff28 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, 24 Jun 2021 09:39:14 +0800 Subject: [PATCH 22/27] =?UTF-8?q?update=20=E6=9B=B4=E6=96=B0=E6=96=87?= =?UTF-8?q?=E6=A1=A3=E7=89=88=E6=9C=AC?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index cd4863db..3a24d047 100644 --- a/README.md +++ b/README.md @@ -4,7 +4,7 @@ [![License](https://img.shields.io/badge/License-MIT-blue.svg)](https://gitee.com/JavaLionLi/RuoYi-Vue-Plus/blob/master/LICENSE) [![使用IntelliJ IDEA开发维护](https://img.shields.io/badge/IntelliJ%20IDEA-提供支持-blue.svg)](https://www.jetbrains.com/?from=RuoYi-Vue-Plus)
      -[![RuoYi-Vue-Plus](https://img.shields.io/badge/RuoYi_Vue_Plus-2.3.2-success.svg)](https://gitee.com/JavaLionLi/RuoYi-Vue-Plus) +[![RuoYi-Vue-Plus](https://img.shields.io/badge/RuoYi_Vue_Plus-2.4.0-success.svg)](https://gitee.com/JavaLionLi/RuoYi-Vue-Plus) [![Spring Boot](https://img.shields.io/badge/Spring%20Boot-2.4-blue.svg)]() [![JDK-8+](https://img.shields.io/badge/JDK-8+-green.svg)]() [![JDK-11](https://img.shields.io/badge/JDK-11-green.svg)]() From cc2fbc7b89c0d88ff8dfb2f6ab663840e8610767 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, 24 Jun 2021 15:41:16 +0800 Subject: [PATCH 23/27] =?UTF-8?q?fix=20=E7=9B=B8=E5=AF=B9=E8=B7=AF?= =?UTF-8?q?=E5=BE=84=E4=B8=8B=E8=BD=BD=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../ruoyi/web/controller/common/CommonController.java | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/common/CommonController.java b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/common/CommonController.java index 38913f50..d61f99f2 100644 --- a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/common/CommonController.java +++ b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/common/CommonController.java @@ -18,6 +18,7 @@ import org.springframework.web.multipart.MultipartFile; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; +import java.io.File; import java.util.HashMap; import java.util.Map; @@ -51,13 +52,13 @@ public class CommonController } String realFileName = System.currentTimeMillis() + fileName.substring(fileName.indexOf("_") + 1); String filePath = RuoYiConfig.getDownloadPath() + fileName; - + File file = new File(filePath); response.setContentType(MediaType.APPLICATION_OCTET_STREAM_VALUE); FileUtils.setAttachmentResponseHeader(response, realFileName); - FileUtils.writeToStream(filePath, response.getOutputStream()); + FileUtils.writeToStream(file, response.getOutputStream()); if (delete) { - FileUtils.del(filePath); + FileUtils.del(file); } } catch (Exception e) @@ -110,8 +111,9 @@ public class CommonController // 下载名称 String downloadName = StrUtil.subAfter(downloadPath, "/",true); response.setContentType(MediaType.APPLICATION_OCTET_STREAM_VALUE); + File file = new File(downloadPath); FileUtils.setAttachmentResponseHeader(response, downloadName); - FileUtils.writeToStream(downloadPath, response.getOutputStream()); + FileUtils.writeToStream(file, response.getOutputStream()); } catch (Exception e) { From f6dd60c05144f6a5307a9729d9fe22de16a2a0fe Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9C=B1=E6=9D=B0?= <693337446@qq.com> Date: Thu, 24 Jun 2021 16:49:04 +0800 Subject: [PATCH 24/27] =?UTF-8?q?update=20=E4=BF=AE=E6=94=B9readme?= =?UTF-8?q?=E5=8A=A0=E5=85=A5=E6=8F=90=E9=97=AE=E5=9B=9B=E9=83=A8=E6=9B=B2?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- README.md | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index 3a24d047..f6aba400 100644 --- a/README.md +++ b/README.md @@ -35,9 +35,25 @@ [初始化项目 必看](https://gitee.com/JavaLionLi/RuoYi-Vue-Plus/wikis/关于初始化项目?sort_id=4164117)
      [参考文档 Wiki](https://gitee.com/JavaLionLi/RuoYi-Vue-Plus/wikis/pages) +## 提问四部曲 +### 一、查阅wiki +优先在`wiki->重点事项`,查找是否有相关问题及解决方案,尤其是框架更新后产生的问题,多会在wiki中提及 +> [参考文档 Wiki](https://gitee.com/JavaLionLi/RuoYi-Vue-Plus/wikis/pages) +### 二、借助issues +尝试issues中搜索问题关键字(记得选择已完成),看看是否有其他人提出相同问题 +- `如果有`那么依据评论中的解决方案自行尝试解决 +- `如果没有`那么提交一个新的issues描述清楚你的问题,需要包含以下内容(优质的issues,能够帮助作则更高效的帮你解决问题): + - 出现问题的模块或功能或类,总之你要说清楚在哪出的问题 + - 描述产生问题的相关操作流程,以便复现快速解决 + - 报错的日志截图,一定是截图,不要复制一堆报错的文本 +> [issues](https://gitee.com/JavaLionLi/RuoYi-Vue-Plus/issues) +### 三、百度 +大家都懂,不多描述,将关键的报错信息CC->CV到百度中看看大佬们怎么解决的 +> [百度](http://www.baidu.com) +### 四、加群 +以上三点已经能解决大家绝大部分问题了,如果还有问题没能通过这几种方式解决,那么加群,大家一起在群里探讨一下 ## 修改RuoYi功能 - ### 依赖改动 * ORM框架 使用 Mybatis-Plus 简化CRUD (不支持主子表) From 5ddfd5bf11a225098c6994647df58dabc0202c00 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, 24 Jun 2021 17:10:03 +0800 Subject: [PATCH 25/27] =?UTF-8?q?update=20=E6=9B=B4=E6=96=B0=E6=96=87?= =?UTF-8?q?=E6=A1=A3=20=E6=8F=90=E9=97=AE=E5=9B=9B=E9=83=A8=E6=9B=B2?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- README.md | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index f6aba400..d1606232 100644 --- a/README.md +++ b/README.md @@ -32,27 +32,32 @@ 使用框架前请仔细阅读文档重点注意事项
      -[初始化项目 必看](https://gitee.com/JavaLionLi/RuoYi-Vue-Plus/wikis/关于初始化项目?sort_id=4164117) +>[初始化项目 必看](https://gitee.com/JavaLionLi/RuoYi-Vue-Plus/wikis/关于初始化项目?sort_id=4164117)
      -[参考文档 Wiki](https://gitee.com/JavaLionLi/RuoYi-Vue-Plus/wikis/pages) +>[参考文档 Wiki](https://gitee.com/JavaLionLi/RuoYi-Vue-Plus/wikis/pages) + ## 提问四部曲 ### 一、查阅wiki 优先在`wiki->重点事项`,查找是否有相关问题及解决方案,尤其是框架更新后产生的问题,多会在wiki中提及 > [参考文档 Wiki](https://gitee.com/JavaLionLi/RuoYi-Vue-Plus/wikis/pages) + ### 二、借助issues 尝试issues中搜索问题关键字(记得选择已完成),看看是否有其他人提出相同问题 - `如果有`那么依据评论中的解决方案自行尝试解决 -- `如果没有`那么提交一个新的issues描述清楚你的问题,需要包含以下内容(优质的issues,能够帮助作则更高效的帮你解决问题): +- `如果没有`那么提交一个新的issues描述清楚你的问题,需要包含以下内容(优质的issues,能够帮助作者更高效的帮你解决问题): - 出现问题的模块或功能或类,总之你要说清楚在哪出的问题 - 描述产生问题的相关操作流程,以便复现快速解决 - 报错的日志截图,一定是截图,不要复制一堆报错的文本 > [issues](https://gitee.com/JavaLionLi/RuoYi-Vue-Plus/issues) + ### 三、百度 大家都懂,不多描述,将关键的报错信息CC->CV到百度中看看大佬们怎么解决的 > [百度](http://www.baidu.com) + ### 四、加群 以上三点已经能解决大家绝大部分问题了,如果还有问题没能通过这几种方式解决,那么加群,大家一起在群里探讨一下 + ## 修改RuoYi功能 ### 依赖改动 From 31487810452b14e2a62ca07fe696f640e22db64e 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, 24 Jun 2021 17:12:48 +0800 Subject: [PATCH 26/27] =?UTF-8?q?update=20=E6=9B=B4=E6=96=B0=E6=96=87?= =?UTF-8?q?=E6=A1=A3=20=E6=8F=90=E9=97=AE=E5=9B=9B=E9=83=A8=E6=9B=B2?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index d1606232..688da088 100644 --- a/README.md +++ b/README.md @@ -33,7 +33,7 @@ 使用框架前请仔细阅读文档重点注意事项
      >[初始化项目 必看](https://gitee.com/JavaLionLi/RuoYi-Vue-Plus/wikis/关于初始化项目?sort_id=4164117) -
      +> >[参考文档 Wiki](https://gitee.com/JavaLionLi/RuoYi-Vue-Plus/wikis/pages) ## 提问四部曲 From b51b8b1b41d4a402028e00a15c17dd60c4c4ff06 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, 25 Jun 2021 08:00:38 +0000 Subject: [PATCH 27/27] update README.md. --- README.md | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index 688da088..5fc29ab7 100644 --- a/README.md +++ b/README.md @@ -95,9 +95,8 @@ * 单模块 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/) -## 关注作者(扫码请备注: "加群") - -![作者图片](https://images.gitee.com/uploads/images/2021/0508/235345_5503356a_1766278.jpeg) +## 扫码加群 一起交流 +![输入图片说明](https://images.gitee.com/uploads/images/2021/0625/160026_11d949aa_1766278.jpeg "07f7121fab14e57e03e5f6a35eff6ce.jpg") ## 捐献作者 作者为兼职做开源,平时还需要工作,如果帮到了您可以请作者吃个盒饭