From 79be99d3e1b233bcbd2f4a28e08b250f9e459ab8 Mon Sep 17 00:00:00 2001 From: 1332987 <13329870472@163.com> Date: Wed, 20 Apr 2022 17:21:54 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E5=A4=8Didea=20=20=E6=AD=A3=E5=88=99?= =?UTF-8?q?=E5=86=97=E4=BD=99=E5=92=8Csql=E6=A0=87=E7=AD=BE=E9=97=AE?= =?UTF-8?q?=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../common/core/utils/file/FileUtils.java | 2 +- .../ruoyi/common/core/utils/sql/SqlUtil.java | 2 +- .../config/SwaggerAutoConfiguration.java | 1 - .../ruoyi/gen/controller/GenController.java | 2 +- .../mapper/generator/GenTableColumnMapper.xml | 2 +- .../job/controller/SysJobLogController.java | 4 +- .../resources/mapper/system/SysDeptMapper.xml | 307 ++++++++++-------- 7 files changed, 174 insertions(+), 146 deletions(-) diff --git a/ruoyi-common/ruoyi-common-core/src/main/java/com/ruoyi/common/core/utils/file/FileUtils.java b/ruoyi-common/ruoyi-common-core/src/main/java/com/ruoyi/common/core/utils/file/FileUtils.java index 1da01947..2d8bc00f 100644 --- a/ruoyi-common/ruoyi-common-core/src/main/java/com/ruoyi/common/core/utils/file/FileUtils.java +++ b/ruoyi-common/ruoyi-common-core/src/main/java/com/ruoyi/common/core/utils/file/FileUtils.java @@ -25,7 +25,7 @@ public class FileUtils { */ public static final char BACKSLASH = '\\'; - public static String FILENAME_PATTERN = "[a-zA-Z0-9_\\-\\|\\.\\u4e00-\\u9fa5]+"; + public static String FILENAME_PATTERN = "[a-zA-Z0-9_\\-|.\\u4e00-\\u9fa5]+"; /** * 输出指定文件的byte数组 diff --git a/ruoyi-common/ruoyi-common-core/src/main/java/com/ruoyi/common/core/utils/sql/SqlUtil.java b/ruoyi-common/ruoyi-common-core/src/main/java/com/ruoyi/common/core/utils/sql/SqlUtil.java index 53bbfc67..54e9d131 100644 --- a/ruoyi-common/ruoyi-common-core/src/main/java/com/ruoyi/common/core/utils/sql/SqlUtil.java +++ b/ruoyi-common/ruoyi-common-core/src/main/java/com/ruoyi/common/core/utils/sql/SqlUtil.java @@ -17,7 +17,7 @@ public class SqlUtil { /** * 仅支持字母、数字、下划线、空格、逗号、小数点(支持多个字段排序) */ - public static String SQL_PATTERN = "[a-zA-Z0-9_\\ \\,\\.]+"; + public static String SQL_PATTERN = "[a-zA-Z0-9_ ,.]+"; /** * 检查字符,防止注入绕过 diff --git a/ruoyi-common/ruoyi-common-swagger/src/main/java/com/ruoyi/common/swagger/config/SwaggerAutoConfiguration.java b/ruoyi-common/ruoyi-common-swagger/src/main/java/com/ruoyi/common/swagger/config/SwaggerAutoConfiguration.java index d8121b2f..40861559 100644 --- a/ruoyi-common/ruoyi-common-swagger/src/main/java/com/ruoyi/common/swagger/config/SwaggerAutoConfiguration.java +++ b/ruoyi-common/ruoyi-common-swagger/src/main/java/com/ruoyi/common/swagger/config/SwaggerAutoConfiguration.java @@ -47,7 +47,6 @@ public class SwaggerAutoConfiguration { if (swaggerProperties.getBasePath().isEmpty()) { swaggerProperties.getBasePath().add(BASE_PATH); } - // noinspection unchecked List> basePath = new ArrayList>(); swaggerProperties.getBasePath().forEach(path -> basePath.add(PathSelectors.ant(path))); diff --git a/ruoyi-modules/ruoyi-gen/src/main/java/com/ruoyi/gen/controller/GenController.java b/ruoyi-modules/ruoyi-gen/src/main/java/com/ruoyi/gen/controller/GenController.java index efd9ce28..aeecb950 100644 --- a/ruoyi-modules/ruoyi-gen/src/main/java/com/ruoyi/gen/controller/GenController.java +++ b/ruoyi-modules/ruoyi-gen/src/main/java/com/ruoyi/gen/controller/GenController.java @@ -78,7 +78,7 @@ public class GenController extends BaseController { * 查询数据表字段列表 */ @GetMapping(value = "/column/{tableId}") - public TableDataInfo columnList(Long tableId) { + public TableDataInfo columnList(@PathVariable Long tableId) { TableDataInfo dataInfo = new TableDataInfo(); List list = genTableColumnService.selectGenTableColumnListByTableId(tableId); dataInfo.setRows(list); diff --git a/ruoyi-modules/ruoyi-gen/src/main/resources/mapper/generator/GenTableColumnMapper.xml b/ruoyi-modules/ruoyi-gen/src/main/resources/mapper/generator/GenTableColumnMapper.xml index 83565467..cf19cfad 100644 --- a/ruoyi-modules/ruoyi-gen/src/main/resources/mapper/generator/GenTableColumnMapper.xml +++ b/ruoyi-modules/ruoyi-gen/src/main/resources/mapper/generator/GenTableColumnMapper.xml @@ -40,7 +40,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" diff --git a/ruoyi-modules/ruoyi-job/src/main/java/com/ruoyi/job/controller/SysJobLogController.java b/ruoyi-modules/ruoyi-job/src/main/java/com/ruoyi/job/controller/SysJobLogController.java index d04c229d..7365324c 100644 --- a/ruoyi-modules/ruoyi-job/src/main/java/com/ruoyi/job/controller/SysJobLogController.java +++ b/ruoyi-modules/ruoyi-job/src/main/java/com/ruoyi/job/controller/SysJobLogController.java @@ -54,8 +54,8 @@ public class SysJobLogController extends BaseController { */ @RequiresPermissions("monitor:job:query") @GetMapping(value = "/{configId}") - public AjaxResult getInfo(@PathVariable Long jobLogId) { - return AjaxResult.success(jobLogService.selectJobLogById(jobLogId)); + public AjaxResult getInfo(@PathVariable Long configId) { + return AjaxResult.success(jobLogService.selectJobLogById(configId)); } /** diff --git a/ruoyi-modules/ruoyi-system/src/main/resources/mapper/system/SysDeptMapper.xml b/ruoyi-modules/ruoyi-system/src/main/resources/mapper/system/SysDeptMapper.xml index 3f40fb1b..be8382af 100644 --- a/ruoyi-modules/ruoyi-system/src/main/resources/mapper/system/SysDeptMapper.xml +++ b/ruoyi-modules/ruoyi-system/src/main/resources/mapper/system/SysDeptMapper.xml @@ -1,157 +1,186 @@ + PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" + "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> - - - - - - - - - - - - - - - - - - - - select d.dept_id, d.parent_id, d.ancestors, d.dept_name, d.order_num, d.leader, d.phone, d.email, d.status, d.del_flag, d.create_by, d.create_time + + + + + + + + + + + + + + + + + + + + select d.dept_id, + d.parent_id, + d.ancestors, + d.dept_name, + d.order_num, + d.leader, + d.phone, + d.email, + d.status, + d.del_flag, + d.create_by, + d.create_time from sys_dept d - - where d.del_flag = '0' - - AND dept_id = #{deptId} - + + AND dept_id = #{deptId} + - AND parent_id = #{parentId} - - - AND dept_name like concat('%', #{deptName}, '%') - - - AND status = #{status} - - - ${params.dataScope} - order by d.parent_id, d.order_num + AND parent_id = #{parentId} + + + AND dept_name like concat('%', #{deptName}, '%') + + + AND status = #{status} + + + ${params.dataScope} + order by d.parent_id, d.order_num - + - + + 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 + + - + + where dept_id = #{deptId} + + - - - - - - - - - + select count(1) + from sys_user + where dept_id = #{deptId} + and del_flag = '0' + + + + + + + + + + - insert into sys_dept( - dept_id, - parent_id, - dept_name, - ancestors, - order_num, - leader, - phone, - email, - status, - create_by, - create_time - )values( - #{deptId}, - #{parentId}, - #{deptName}, - #{ancestors}, - #{orderNum}, - #{leader}, - #{phone}, - #{email}, - #{status}, - #{createBy}, - sysdate() - ) - - - - update sys_dept - - parent_id = #{parentId}, - dept_name = #{deptName}, - ancestors = #{ancestors}, - order_num = #{orderNum}, - leader = #{leader}, - phone = #{phone}, - email = #{email}, - status = #{status}, - update_by = #{updateBy}, - update_time = sysdate() - - where dept_id = #{deptId} - - - - update sys_dept set ancestors = - - when #{item.deptId} then #{item.ancestors} - - where dept_id in - - #{item.deptId} - - - - - update sys_dept set status = '0' where dept_id in - - #{deptId} + insert into sys_dept( + dept_id, + parent_id, + dept_name, + ancestors, + order_num, + leader, + phone, + email, + status, + create_by, + create_time + )values( + #{deptId}, + #{parentId}, + #{deptName}, + #{ancestors}, + #{orderNum}, + #{leader}, + #{phone}, + #{email}, + #{status}, + #{createBy}, + sysdate() + ) + + + + update sys_dept + + parent_id = #{parentId}, + dept_name = #{deptName}, + ancestors = #{ancestors}, + order_num = #{orderNum}, + leader = #{leader}, + phone = #{phone}, + email = #{email}, + status = #{status}, + update_by = #{updateBy}, + update_time = sysdate() + + where dept_id = #{deptId} + + + + update sys_dept + + ancestors = + + when #{item.deptId} then #{item.ancestors} + + + where dept_id in + + #{item.deptId} - - - - update sys_dept set del_flag = '2' where dept_id = #{deptId} - + + + + update sys_dept set status = '0' where dept_id in + + #{deptId} + + + + + update sys_dept + set del_flag = '2' + where dept_id = #{deptId} + \ No newline at end of file