diff --git a/pom.xml b/pom.xml index 403d891cf..8e9d4a41f 100644 --- a/pom.xml +++ b/pom.xml @@ -22,14 +22,14 @@ 1.2.6 1.21 2.3.2 - 2.9.2 + 3.0.0 2.1.4 1.3.0 1.2.76 - 5.6.0 - 5.7.0 - 2.5 - 1.3.3 + 5.7.4 + 5.8.0 + 2.10.0 + 1.4 4.1.2 1.7 @@ -47,21 +47,21 @@ import - + com.alibaba druid-spring-boot-starter ${druid.version} - + com.github.penggle kaptcha ${kaptcha.version} - + org.apache.shiro shiro-core @@ -129,16 +129,12 @@ ${jna.version} - + io.springfox - springfox-swagger2 + springfox-boot-starter ${swagger.version} - - io.swagger - swagger-annotations - io.swagger swagger-models @@ -146,21 +142,14 @@ - - - io.springfox - springfox-swagger-ui - ${swagger.version} - - - + commons-io commons-io ${commons.io.version} - + commons-fileupload commons-fileupload @@ -174,7 +163,7 @@ ${poi.version} - + org.apache.velocity velocity diff --git a/ruoyi-admin/pom.xml b/ruoyi-admin/pom.xml index 5dbd4ce2d..fa9b21d73 100644 --- a/ruoyi-admin/pom.xml +++ b/ruoyi-admin/pom.xml @@ -30,29 +30,17 @@ true - + io.springfox - springfox-swagger2 - - - - - io.swagger - swagger-annotations - 1.5.21 + springfox-boot-starter + io.swagger swagger-models - 1.5.21 - - - - - io.springfox - springfox-swagger-ui + 1.6.2 diff --git a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/demo/controller/DemoTableController.java b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/demo/controller/DemoTableController.java index 82c53ceb9..06fb5480c 100644 --- a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/demo/controller/DemoTableController.java +++ b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/demo/controller/DemoTableController.java @@ -339,6 +339,15 @@ public class DemoTableController extends BaseController return prefix + "/dynamicColumns"; } + /** + * 自定义视图分页 + */ + @GetMapping("/customView") + public String customView() + { + return prefix + "/customView"; + } + /** * 表格其他操作 */ diff --git a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/tool/SwaggerController.java b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/tool/SwaggerController.java index cfa748f30..079d7d2a7 100644 --- a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/tool/SwaggerController.java +++ b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/tool/SwaggerController.java @@ -19,6 +19,6 @@ public class SwaggerController extends BaseController @GetMapping() public String index() { - return redirect("/swagger-ui.html"); + return redirect("/swagger-ui/index.html"); } } diff --git a/ruoyi-admin/src/main/java/com/ruoyi/web/core/config/SwaggerConfig.java b/ruoyi-admin/src/main/java/com/ruoyi/web/core/config/SwaggerConfig.java index d4f020098..0cfbfbadb 100644 --- a/ruoyi-admin/src/main/java/com/ruoyi/web/core/config/SwaggerConfig.java +++ b/ruoyi-admin/src/main/java/com/ruoyi/web/core/config/SwaggerConfig.java @@ -12,7 +12,6 @@ import springfox.documentation.service.ApiInfo; import springfox.documentation.service.Contact; import springfox.documentation.spi.DocumentationType; import springfox.documentation.spring.web.plugins.Docket; -import springfox.documentation.swagger2.annotations.EnableSwagger2; /** * Swagger2的接口配置 @@ -20,7 +19,6 @@ import springfox.documentation.swagger2.annotations.EnableSwagger2; * @author ruoyi */ @Configuration -@EnableSwagger2 public class SwaggerConfig { /** 是否开启swagger */ @@ -33,7 +31,7 @@ public class SwaggerConfig @Bean public Docket createRestApi() { - return new Docket(DocumentationType.SWAGGER_2) + return new Docket(DocumentationType.OAS_30) // 是否启用Swagger .enable(enabled) // 用来创建该API的基本信息,展示在文档的页面中(自定义展示的信息) diff --git a/ruoyi-admin/src/main/resources/static/ajax/libs/bootstrap-table/extensions/custom-view/bootstrap-table-custom-view.js b/ruoyi-admin/src/main/resources/static/ajax/libs/bootstrap-table/extensions/custom-view/bootstrap-table-custom-view.js new file mode 100644 index 000000000..a33bd170a --- /dev/null +++ b/ruoyi-admin/src/main/resources/static/ajax/libs/bootstrap-table/extensions/custom-view/bootstrap-table-custom-view.js @@ -0,0 +1,108 @@ +/** + * @author zhixin wen + */ + +const Utils = $.fn.bootstrapTable.utils + +$.extend($.fn.bootstrapTable.defaults, { + customView: false, + showCustomView: false, + showCustomViewButton: false +}) + +$.extend($.fn.bootstrapTable.defaults.icons, { + customView: { + bootstrap3: 'glyphicon glyphicon-eye-open', + bootstrap5: 'bi-eye', + bootstrap4: 'fa fa-eye', + semantic: 'fa fa-eye', + foundation: 'fa fa-eye', + bulma: 'fa fa-eye', + materialize: 'remove_red_eye' + }[$.fn.bootstrapTable.theme] || 'fa-eye' +}) + +$.extend($.fn.bootstrapTable.defaults, { + onCustomViewPostBody () { + return false + }, + onCustomViewPreBody () { + return false + } +}) + +$.extend($.fn.bootstrapTable.locales, { + formatToggleCustomView () { + return 'Toggle custom view' + } +}) +$.extend($.fn.bootstrapTable.defaults, $.fn.bootstrapTable.locales) + +$.fn.bootstrapTable.methods.push('toggleCustomView') + +$.extend($.fn.bootstrapTable.Constructor.EVENTS, { + 'custom-view-post-body.bs.table': 'onCustomViewPostBody', + 'custom-view-pre-body.bs.table': 'onCustomViewPreBody' +}) + +$.BootstrapTable = class extends $.BootstrapTable { + + init () { + this.showCustomView = this.options.showCustomView + + super.init() + } + + initToolbar (...args) { + if (this.options.customView && this.options.showCustomViewButton) { + this.buttons = Object.assign(this.buttons, { + customView: { + text: this.options.formatToggleCustomView(), + icon: this.options.icons.customView, + event: this.toggleCustomView, + attributes: { + 'aria-label': this.options.formatToggleCustomView(), + title: this.options.formatToggleCustomView() + } + } + }) + } + + super.initToolbar(...args) + } + + initBody () { + super.initBody() + + if (!this.options.customView) { + return + } + + const $table = this.$el + const $customViewContainer = this.$container.find('.fixed-table-custom-view') + + $table.hide() + $customViewContainer.hide() + if (!this.options.customView || !this.showCustomView) { + $table.show() + return + } + + const data = this.getData().slice(this.pageFrom - 1, this.pageTo) + const value = Utils.calculateObjectValue(this, this.options.customView, [data], '') + + this.trigger('custom-view-pre-body', data, value) + if ($customViewContainer.length === 1) { + $customViewContainer.show().html(value) + } else { + this.$tableBody.after(`
${value}
`) + } + + this.trigger('custom-view-post-body', data, value) + } + + toggleCustomView () { + this.showCustomView = !this.showCustomView + this.initBody() + } +} \ No newline at end of file diff --git a/ruoyi-admin/src/main/resources/static/ajax/libs/bootstrap-table/extensions/reorder-rows/jquery.tablednd.js b/ruoyi-admin/src/main/resources/static/ajax/libs/bootstrap-table/extensions/reorder-rows/jquery.tablednd.js index 7f9f04c6d..08f9a1288 100644 --- a/ruoyi-admin/src/main/resources/static/ajax/libs/bootstrap-table/extensions/reorder-rows/jquery.tablednd.js +++ b/ruoyi-admin/src/main/resources/static/ajax/libs/bootstrap-table/extensions/reorder-rows/jquery.tablednd.js @@ -152,11 +152,16 @@ jQuery.tableDnD = { config.dragHandle // We only need to add the event to the specified cells && $(config.dragHandle, table).each(function() { - // The cell is bound to "this" - $(this).bind(startEvent, function(e) { - $.tableDnD.initialiseDrag($(this).parents('tr')[0], table, this, e, config); - return false; - }); + if (! $(this).hasClass("nodrag")) { + // The cell is bound to "this" + $(this).bind(startEvent, function(e) { + if (e.target.tagName === "TD" && event.target.className !== "nodrag") { + $.tableDnD.initialiseDrag($(this).parents('tr')[0], table, this, e, config); + return false; + } + return true; + }); + } }) // For backwards compatibility, we add the event to the whole row // get all the rows as a wrapped set diff --git a/ruoyi-admin/src/main/resources/static/ruoyi/js/ry-ui.js b/ruoyi-admin/src/main/resources/static/ruoyi/js/ry-ui.js index b7024ca83..4cdcb28e8 100644 --- a/ruoyi-admin/src/main/resources/static/ruoyi/js/ry-ui.js +++ b/ruoyi-admin/src/main/resources/static/ruoyi/js/ry-ui.js @@ -61,6 +61,7 @@ var table = { showColumns: true, showToggle: true, showExport: false, + showPrint: false, exportDataType: 'all', exportTypes: ['csv', 'txt', 'doc', 'excel'], clickToSelect: false, @@ -110,6 +111,7 @@ var table = { showColumns: options.showColumns, // 是否显示隐藏某列下拉框 showToggle: options.showToggle, // 是否显示详细视图和列表视图的切换按钮 showExport: options.showExport, // 是否支持导出文件 + showPrint: options.showPrint, // 是否支持打印页面 showHeader: options.showHeader, // 是否显示表头 showFullscreen: options.showFullscreen, // 是否显示全屏按钮 uniqueId: options.uniqueId, // 唯一的标识符 @@ -470,6 +472,11 @@ var table = { pageSize: pageSize }); }, + // 刷新options配置 + refreshOptions: function(options, tableId) { + var currentId = $.common.isEmpty(tableId) ? table.options.id : tableId; + $("#" + currentId).bootstrapTable('refreshOptions', options); + }, // 查询表格指定列值 selectColumns: function(column) { var rows = $.map($("#" + table.options.id).bootstrapTable('getSelections'), function (row) { diff --git a/ruoyi-admin/src/main/resources/templates/demo/modal/form.html b/ruoyi-admin/src/main/resources/templates/demo/modal/form.html index f9e201518..f9c749d65 100644 --- a/ruoyi-admin/src/main/resources/templates/demo/modal/form.html +++ b/ruoyi-admin/src/main/resources/templates/demo/modal/form.html @@ -91,5 +91,12 @@ + diff --git a/ruoyi-admin/src/main/resources/templates/demo/table/customView.html b/ruoyi-admin/src/main/resources/templates/demo/table/customView.html new file mode 100644 index 000000000..a2f4d1ceb --- /dev/null +++ b/ruoyi-admin/src/main/resources/templates/demo/table/customView.html @@ -0,0 +1,122 @@ + + + + + + +
+
+
+ +
+
+
+
+ + + +
+ + + + \ No newline at end of file diff --git a/ruoyi-admin/src/main/resources/templates/demo/table/print.html b/ruoyi-admin/src/main/resources/templates/demo/table/print.html index 85c0c4096..8695376ad 100644 --- a/ruoyi-admin/src/main/resources/templates/demo/table/print.html +++ b/ruoyi-admin/src/main/resources/templates/demo/table/print.html @@ -15,7 +15,7 @@ data-print-filter 设置值以按此列过滤打印的数据。 data-print-formatter 函数(值,行,索引)-返回字符串。格式化打印表中此列的单元格值。函数行为类似于“ formatter”列选项 printIgnore 设置为true可以在打印页面中隐藏此列。 --> -
+
@@ -27,6 +27,7 @@ $(function() { var options = { url: prefix + "/list", + showPrint: true, showSearch: false, showRefresh: false, showToggle: false, diff --git a/ruoyi-admin/src/main/resources/templates/include.html b/ruoyi-admin/src/main/resources/templates/include.html index 157242c02..351d30ae0 100644 --- a/ruoyi-admin/src/main/resources/templates/include.html +++ b/ruoyi-admin/src/main/resources/templates/include.html @@ -217,3 +217,8 @@
+ + +
+ +
diff --git a/ruoyi-admin/src/main/resources/templates/index-topnav.html b/ruoyi-admin/src/main/resources/templates/index-topnav.html index ad433a8e1..c328254af 100644 --- a/ruoyi-admin/src/main/resources/templates/index-topnav.html +++ b/ruoyi-admin/src/main/resources/templates/index-topnav.html @@ -145,6 +145,7 @@
  • 表格自动刷新
  • 表格打印配置
  • 表格动态列
  • +
  • 自定义视图分页
  • 表格其他操作
  • diff --git a/ruoyi-admin/src/main/resources/templates/index.html b/ruoyi-admin/src/main/resources/templates/index.html index 629c56af7..d69f81a66 100644 --- a/ruoyi-admin/src/main/resources/templates/index.html +++ b/ruoyi-admin/src/main/resources/templates/index.html @@ -126,6 +126,7 @@
  • 表格自动刷新
  • 表格打印配置
  • 表格动态列
  • +
  • 自定义视图分页
  • 表格其他操作
  • diff --git a/ruoyi-admin/src/main/resources/templates/system/role/role.html b/ruoyi-admin/src/main/resources/templates/system/role/role.html index 18628819e..c16b7fd1c 100644 --- a/ruoyi-admin/src/main/resources/templates/system/role/role.html +++ b/ruoyi-admin/src/main/resources/templates/system/role/role.html @@ -112,14 +112,18 @@ title: '操作', align: 'center', formatter: function(value, row, index) { - var actions = []; - actions.push('编辑 '); - actions.push('删除 '); - var more = []; - more.push("数据权限 "); - more.push("分配用户"); - actions.push('更多操作'); - return actions.join(''); + if (row.roleId != 1) { + var actions = []; + actions.push('编辑 '); + actions.push('删除 '); + var more = []; + more.push("数据权限 "); + more.push("分配用户"); + actions.push('更多操作'); + return actions.join(''); + } else { + return ""; + } } }] }; diff --git a/ruoyi-admin/src/main/resources/templates/system/user/user.html b/ruoyi-admin/src/main/resources/templates/system/user/user.html index 21d506c37..94930329a 100644 --- a/ruoyi-admin/src/main/resources/templates/system/user/user.html +++ b/ruoyi-admin/src/main/resources/templates/system/user/user.html @@ -171,14 +171,18 @@ title: '操作', align: 'center', formatter: function(value, row, index) { - var actions = []; - actions.push('编辑 '); - actions.push('删除 '); - var more = []; - more.push("重置密码 "); - more.push("分配角色"); - actions.push('更多操作'); - return actions.join(''); + if (row.userId != 1) { + var actions = []; + actions.push('编辑 '); + actions.push('删除 '); + var more = []; + more.push("重置密码 "); + more.push("分配角色"); + actions.push('更多操作'); + return actions.join(''); + } else { + return ""; + } } }] }; 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 3c6554582..869997cda 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 @@ -96,4 +96,9 @@ public class Constants * 资源映射路径 前缀 */ public static final String RESOURCE_PREFIX = "/profile"; + + /** + * RMI 远程方法调用 + */ + public static final String LOOKUP_RMI = "rmi://"; } diff --git a/ruoyi-common/src/main/java/com/ruoyi/common/core/domain/entity/SysRole.java b/ruoyi-common/src/main/java/com/ruoyi/common/core/domain/entity/SysRole.java index e8ea03a31..af2f46aad 100644 --- a/ruoyi-common/src/main/java/com/ruoyi/common/core/domain/entity/SysRole.java +++ b/ruoyi-common/src/main/java/com/ruoyi/common/core/domain/entity/SysRole.java @@ -32,8 +32,8 @@ public class SysRole extends BaseEntity @Excel(name = "角色排序", cellType = ColumnType.NUMERIC) private String roleSort; - /** 数据范围(1:所有数据权限;2:自定义数据权限;3:本部门数据权限;4:本部门及以下数据权限) */ - @Excel(name = "数据范围", readConverterExp = "1=所有数据权限,2=自定义数据权限,3=本部门数据权限,4=本部门及以下数据权限") + /** 数据范围(1:所有数据权限;2:自定义数据权限;3:本部门数据权限;4:本部门及以下数据权限;5:仅本人数据权限) */ + @Excel(name = "数据范围", readConverterExp = "1=所有数据权限,2=自定义数据权限,3=本部门数据权限,4=本部门及以下数据权限,5=仅本人数据权限") private String dataScope; /** 角色状态(0正常 1停用) */ diff --git a/ruoyi-common/src/main/java/com/ruoyi/common/core/text/Convert.java b/ruoyi-common/src/main/java/com/ruoyi/common/core/text/Convert.java index 9dd076d04..5f623c977 100644 --- a/ruoyi-common/src/main/java/com/ruoyi/common/core/text/Convert.java +++ b/ruoyi-common/src/main/java/com/ruoyi/common/core/text/Convert.java @@ -7,6 +7,7 @@ import java.nio.charset.Charset; import java.text.NumberFormat; import java.util.Set; import com.ruoyi.common.utils.StringUtils; +import org.apache.commons.lang3.ArrayUtils; /** * 类型转换器 @@ -795,9 +796,14 @@ public class Convert { return (String) obj; } - else if (obj instanceof byte[] || obj instanceof Byte[]) + else if (obj instanceof byte[]) { - return str((Byte[]) obj, charset); + return str((byte[]) obj, charset); + } + else if (obj instanceof Byte[]) + { + byte[] bytes = ArrayUtils.toPrimitive((Byte[]) obj); + return str(bytes, charset); } else if (obj instanceof ByteBuffer) { diff --git a/ruoyi-common/src/main/java/com/ruoyi/common/utils/file/FileUtils.java b/ruoyi-common/src/main/java/com/ruoyi/common/utils/file/FileUtils.java index 6bc2ce63c..dfdf9e933 100644 --- a/ruoyi-common/src/main/java/com/ruoyi/common/utils/file/FileUtils.java +++ b/ruoyi-common/src/main/java/com/ruoyi/common/utils/file/FileUtils.java @@ -18,7 +18,7 @@ import com.ruoyi.common.utils.StringUtils; * * @author ruoyi */ -public class FileUtils extends org.apache.commons.io.FileUtils +public class FileUtils { public static String FILENAME_PATTERN = "[a-zA-Z0-9_\\-\\|\\.\\u4e00-\\u9fa5]+"; diff --git a/ruoyi-framework/src/main/java/com/ruoyi/framework/config/ResourcesConfig.java b/ruoyi-framework/src/main/java/com/ruoyi/framework/config/ResourcesConfig.java index 4a1c63104..98c36c6a8 100644 --- a/ruoyi-framework/src/main/java/com/ruoyi/framework/config/ResourcesConfig.java +++ b/ruoyi-framework/src/main/java/com/ruoyi/framework/config/ResourcesConfig.java @@ -44,8 +44,7 @@ public class ResourcesConfig implements WebMvcConfigurer registry.addResourceHandler(Constants.RESOURCE_PREFIX + "/**").addResourceLocations("file:" + RuoYiConfig.getProfile() + "/"); /** swagger配置 */ - registry.addResourceHandler("swagger-ui.html").addResourceLocations("classpath:/META-INF/resources/"); - registry.addResourceHandler("/webjars/**").addResourceLocations("classpath:/META-INF/resources/webjars/"); + registry.addResourceHandler("/swagger-ui/**").addResourceLocations("classpath:/META-INF/resources/webjars/springfox-swagger-ui/"); } /** diff --git a/ruoyi-generator/src/main/java/com/ruoyi/generator/service/impl/GenTableServiceImpl.java b/ruoyi-generator/src/main/java/com/ruoyi/generator/service/impl/GenTableServiceImpl.java index de5cc50f3..b809d6a37 100644 --- a/ruoyi-generator/src/main/java/com/ruoyi/generator/service/impl/GenTableServiceImpl.java +++ b/ruoyi-generator/src/main/java/com/ruoyi/generator/service/impl/GenTableServiceImpl.java @@ -10,6 +10,7 @@ import java.util.Map; import java.util.stream.Collectors; import java.util.zip.ZipEntry; import java.util.zip.ZipOutputStream; +import org.apache.commons.io.FileUtils; import org.apache.commons.io.IOUtils; import org.apache.velocity.Template; import org.apache.velocity.VelocityContext; @@ -27,7 +28,6 @@ import com.ruoyi.common.core.text.CharsetKit; import com.ruoyi.common.core.text.Convert; import com.ruoyi.common.exception.BusinessException; import com.ruoyi.common.utils.StringUtils; -import com.ruoyi.common.utils.file.FileUtils; import com.ruoyi.generator.domain.GenTable; import com.ruoyi.generator.domain.GenTableColumn; import com.ruoyi.generator.mapper.GenTableColumnMapper; diff --git a/ruoyi-quartz/src/main/java/com/ruoyi/quartz/controller/SysJobController.java b/ruoyi-quartz/src/main/java/com/ruoyi/quartz/controller/SysJobController.java index f9f0fab3c..6803c96fa 100644 --- a/ruoyi-quartz/src/main/java/com/ruoyi/quartz/controller/SysJobController.java +++ b/ruoyi-quartz/src/main/java/com/ruoyi/quartz/controller/SysJobController.java @@ -13,11 +13,13 @@ import org.springframework.web.bind.annotation.PostMapping; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.ResponseBody; import com.ruoyi.common.annotation.Log; +import com.ruoyi.common.constant.Constants; 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.exception.job.TaskException; +import com.ruoyi.common.utils.StringUtils; import com.ruoyi.common.utils.poi.ExcelUtil; import com.ruoyi.quartz.domain.SysJob; import com.ruoyi.quartz.service.ISysJobService; @@ -131,7 +133,11 @@ public class SysJobController extends BaseController { if (!CronUtils.isValid(job.getCronExpression())) { - return AjaxResult.error("cron表达式不正确"); + return AjaxResult.error("新增任务'" + job.getJobName() + "'失败,Cron表达式不正确"); + } + else if (StringUtils.containsIgnoreCase(job.getInvokeTarget(), Constants.LOOKUP_RMI)) + { + return AjaxResult.error("新增任务'" + job.getJobName() + "'失败,目标字符串不允许'rmi://'调用"); } return toAjax(jobService.insertJob(job)); } @@ -157,7 +163,11 @@ public class SysJobController extends BaseController { if (!CronUtils.isValid(job.getCronExpression())) { - return AjaxResult.error("cron表达式不正确"); + return AjaxResult.error("修改任务'" + job.getJobName() + "'失败,Cron表达式不正确"); + } + else if (StringUtils.containsIgnoreCase(job.getInvokeTarget(), Constants.LOOKUP_RMI)) + { + return AjaxResult.error("修改任务'" + job.getJobName() + "'失败,目标字符串不允许'rmi://'调用"); } return toAjax(jobService.updateJob(job)); } diff --git a/ruoyi-system/src/main/java/com/ruoyi/system/mapper/SysDeptMapper.java b/ruoyi-system/src/main/java/com/ruoyi/system/mapper/SysDeptMapper.java index b8706257e..b8158b359 100644 --- a/ruoyi-system/src/main/java/com/ruoyi/system/mapper/SysDeptMapper.java +++ b/ruoyi-system/src/main/java/com/ruoyi/system/mapper/SysDeptMapper.java @@ -93,11 +93,11 @@ public interface SysDeptMapper public List selectRoleDeptTree(Long roleId); /** - * 修改所在部门的父级部门状态 + * 修改所在部门正常状态 * - * @param dept 部门 + * @param deptIds 部门ID组 */ - public void updateDeptStatus(SysDept dept); + public void updateDeptStatusNormal(Long[] deptIds); /** * 根据ID查询所有子部门 diff --git a/ruoyi-system/src/main/java/com/ruoyi/system/service/impl/SysDeptServiceImpl.java b/ruoyi-system/src/main/java/com/ruoyi/system/service/impl/SysDeptServiceImpl.java index dcf8a2778..e7035fc8d 100644 --- a/ruoyi-system/src/main/java/com/ruoyi/system/service/impl/SysDeptServiceImpl.java +++ b/ruoyi-system/src/main/java/com/ruoyi/system/service/impl/SysDeptServiceImpl.java @@ -12,6 +12,7 @@ import com.ruoyi.common.constant.UserConstants; import com.ruoyi.common.core.domain.Ztree; import com.ruoyi.common.core.domain.entity.SysDept; import com.ruoyi.common.core.domain.entity.SysRole; +import com.ruoyi.common.core.text.Convert; import com.ruoyi.common.exception.BusinessException; import com.ruoyi.common.utils.StringUtils; import com.ruoyi.system.mapper.SysDeptMapper; @@ -229,7 +230,7 @@ public class SysDeptServiceImpl implements ISysDeptService if (UserConstants.DEPT_NORMAL.equals(dept.getStatus())) { // 如果该部门是启用状态,则启用该部门的所有上级部门 - updateParentDeptStatus(dept); + updateParentDeptStatusNormal(dept); } return result; } @@ -239,12 +240,11 @@ public class SysDeptServiceImpl implements ISysDeptService * * @param dept 当前部门 */ - private void updateParentDeptStatus(SysDept dept) + private void updateParentDeptStatusNormal(SysDept dept) { - String updateBy = dept.getUpdateBy(); - dept = deptMapper.selectDeptById(dept.getDeptId()); - dept.setUpdateBy(updateBy); - deptMapper.updateDeptStatus(dept); + String ancestors = dept.getAncestors(); + Long[] deptIds = Convert.toLongArray(ancestors); + deptMapper.updateDeptStatusNormal(deptIds); } /** diff --git a/ruoyi-system/src/main/resources/mapper/system/SysDeptMapper.xml b/ruoyi-system/src/main/resources/mapper/system/SysDeptMapper.xml index 08aa3486a..0ea5f81b1 100644 --- a/ruoyi-system/src/main/resources/mapper/system/SysDeptMapper.xml +++ b/ruoyi-system/src/main/resources/mapper/system/SysDeptMapper.xml @@ -145,14 +145,11 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" update sys_dept set del_flag = '2' where dept_id = #{deptId} - - update sys_dept - - status = #{status}, - update_by = #{updateBy}, - update_time = sysdate() - - where find_in_set(#{deptId}, ancestors) + + update sys_dept set status = '0' where dept_id in + + #{deptId} + \ No newline at end of file diff --git a/ry.sh b/ry.sh index bec5de488..7c4f50385 100644 --- a/ry.sh +++ b/ry.sh @@ -3,7 +3,7 @@ # ./ry.sh start 启动 # ./ry.sh stop 停止 # ./ry.sh restart 重启 -# ./ry.sh start 状态 +# ./ry.sh status 状态 AppName=ruoyi-admin.jar # JVM参数