!4 同步RuoYi更新

Merge pull request !4 from Bo/master
This commit is contained in:
Bo 2021-06-18 17:54:34 +08:00 committed by Gitee
commit 03365e6cba
27 changed files with 360 additions and 94 deletions

25
pom.xml
View File

@ -22,14 +22,14 @@
<druid.version>1.2.6</druid.version> <druid.version>1.2.6</druid.version>
<bitwalker.version>1.21</bitwalker.version> <bitwalker.version>1.21</bitwalker.version>
<kaptcha.version>2.3.2</kaptcha.version> <kaptcha.version>2.3.2</kaptcha.version>
<swagger.version>2.9.2</swagger.version> <swagger.version>3.0.0</swagger.version>
<mybatis-spring-boot.version>2.1.4</mybatis-spring-boot.version> <mybatis-spring-boot.version>2.1.4</mybatis-spring-boot.version>
<pagehelper.boot.version>1.3.0</pagehelper.boot.version> <pagehelper.boot.version>1.3.0</pagehelper.boot.version>
<fastjson.version>1.2.76</fastjson.version> <fastjson.version>1.2.76</fastjson.version>
<oshi.version>5.6.0</oshi.version> <oshi.version>5.7.4</oshi.version>
<jna.version>5.7.0</jna.version> <jna.version>5.8.0</jna.version>
<commons.io.version>2.5</commons.io.version> <commons.io.version>2.10.0</commons.io.version>
<commons.fileupload.version>1.3.3</commons.fileupload.version> <commons.fileupload.version>1.4</commons.fileupload.version>
<poi.version>4.1.2</poi.version> <poi.version>4.1.2</poi.version>
<velocity.version>1.7</velocity.version> <velocity.version>1.7</velocity.version>
</properties> </properties>
@ -129,16 +129,12 @@
<version>${jna.version}</version> <version>${jna.version}</version>
</dependency> </dependency>
<!-- swagger2--> <!-- Swagger3依赖 -->
<dependency> <dependency>
<groupId>io.springfox</groupId> <groupId>io.springfox</groupId>
<artifactId>springfox-swagger2</artifactId> <artifactId>springfox-boot-starter</artifactId>
<version>${swagger.version}</version> <version>${swagger.version}</version>
<exclusions> <exclusions>
<exclusion>
<groupId>io.swagger</groupId>
<artifactId>swagger-annotations</artifactId>
</exclusion>
<exclusion> <exclusion>
<groupId>io.swagger</groupId> <groupId>io.swagger</groupId>
<artifactId>swagger-models</artifactId> <artifactId>swagger-models</artifactId>
@ -146,13 +142,6 @@
</exclusions> </exclusions>
</dependency> </dependency>
<!-- swagger2-UI-->
<dependency>
<groupId>io.springfox</groupId>
<artifactId>springfox-swagger-ui</artifactId>
<version>${swagger.version}</version>
</dependency>
<!-- io常用工具类 --> <!-- io常用工具类 -->
<dependency> <dependency>
<groupId>commons-io</groupId> <groupId>commons-io</groupId>

View File

@ -30,29 +30,17 @@
<optional>true</optional> <!-- 表示依赖不会传递 --> <optional>true</optional> <!-- 表示依赖不会传递 -->
</dependency> </dependency>
<!-- swagger2--> <!-- swagger3-->
<dependency> <dependency>
<groupId>io.springfox</groupId> <groupId>io.springfox</groupId>
<artifactId>springfox-swagger2</artifactId> <artifactId>springfox-boot-starter</artifactId>
</dependency>
<!--防止进入swagger页面报类型转换错误排除2.9.2中的引用手动增加1.5.21版本-->
<dependency>
<groupId>io.swagger</groupId>
<artifactId>swagger-annotations</artifactId>
<version>1.5.21</version>
</dependency> </dependency>
<!-- 防止进入swagger页面报类型转换错误排除3.0.0中的引用手动增加1.6.2版本 -->
<dependency> <dependency>
<groupId>io.swagger</groupId> <groupId>io.swagger</groupId>
<artifactId>swagger-models</artifactId> <artifactId>swagger-models</artifactId>
<version>1.5.21</version> <version>1.6.2</version>
</dependency>
<!-- swagger2-UI-->
<dependency>
<groupId>io.springfox</groupId>
<artifactId>springfox-swagger-ui</artifactId>
</dependency> </dependency>
<!-- Mysql驱动包 --> <!-- Mysql驱动包 -->

View File

@ -339,6 +339,15 @@ public class DemoTableController extends BaseController
return prefix + "/dynamicColumns"; return prefix + "/dynamicColumns";
} }
/**
* 自定义视图分页
*/
@GetMapping("/customView")
public String customView()
{
return prefix + "/customView";
}
/** /**
* 表格其他操作 * 表格其他操作
*/ */

View File

@ -19,6 +19,6 @@ public class SwaggerController extends BaseController
@GetMapping() @GetMapping()
public String index() public String index()
{ {
return redirect("/swagger-ui.html"); return redirect("/swagger-ui/index.html");
} }
} }

View File

@ -12,7 +12,6 @@ import springfox.documentation.service.ApiInfo;
import springfox.documentation.service.Contact; import springfox.documentation.service.Contact;
import springfox.documentation.spi.DocumentationType; import springfox.documentation.spi.DocumentationType;
import springfox.documentation.spring.web.plugins.Docket; import springfox.documentation.spring.web.plugins.Docket;
import springfox.documentation.swagger2.annotations.EnableSwagger2;
/** /**
* Swagger2的接口配置 * Swagger2的接口配置
@ -20,7 +19,6 @@ import springfox.documentation.swagger2.annotations.EnableSwagger2;
* @author ruoyi * @author ruoyi
*/ */
@Configuration @Configuration
@EnableSwagger2
public class SwaggerConfig public class SwaggerConfig
{ {
/** 是否开启swagger */ /** 是否开启swagger */
@ -33,7 +31,7 @@ public class SwaggerConfig
@Bean @Bean
public Docket createRestApi() public Docket createRestApi()
{ {
return new Docket(DocumentationType.SWAGGER_2) return new Docket(DocumentationType.OAS_30)
// 是否启用Swagger // 是否启用Swagger
.enable(enabled) .enable(enabled)
// 用来创建该API的基本信息展示在文档的页面中自定义展示的信息 // 用来创建该API的基本信息展示在文档的页面中自定义展示的信息

View File

@ -0,0 +1,108 @@
/**
* @author zhixin wen <wenzhixin2010@gmail.com>
*/
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(`<div class="fixed-table-custom-view">${value}</div>`)
}
this.trigger('custom-view-post-body', data, value)
}
toggleCustomView () {
this.showCustomView = !this.showCustomView
this.initBody()
}
}

View File

@ -152,11 +152,16 @@ jQuery.tableDnD = {
config.dragHandle config.dragHandle
// We only need to add the event to the specified cells // We only need to add the event to the specified cells
&& $(config.dragHandle, table).each(function() { && $(config.dragHandle, table).each(function() {
if (! $(this).hasClass("nodrag")) {
// The cell is bound to "this" // The cell is bound to "this"
$(this).bind(startEvent, function(e) { $(this).bind(startEvent, function(e) {
if (e.target.tagName === "TD" && event.target.className !== "nodrag") {
$.tableDnD.initialiseDrag($(this).parents('tr')[0], table, this, e, config); $.tableDnD.initialiseDrag($(this).parents('tr')[0], table, this, e, config);
return false; return false;
}
return true;
}); });
}
}) })
// For backwards compatibility, we add the event to the whole row // For backwards compatibility, we add the event to the whole row
// get all the rows as a wrapped set // get all the rows as a wrapped set

View File

@ -61,6 +61,7 @@ var table = {
showColumns: true, showColumns: true,
showToggle: true, showToggle: true,
showExport: false, showExport: false,
showPrint: false,
exportDataType: 'all', exportDataType: 'all',
exportTypes: ['csv', 'txt', 'doc', 'excel'], exportTypes: ['csv', 'txt', 'doc', 'excel'],
clickToSelect: false, clickToSelect: false,
@ -110,6 +111,7 @@ var table = {
showColumns: options.showColumns, // 是否显示隐藏某列下拉框 showColumns: options.showColumns, // 是否显示隐藏某列下拉框
showToggle: options.showToggle, // 是否显示详细视图和列表视图的切换按钮 showToggle: options.showToggle, // 是否显示详细视图和列表视图的切换按钮
showExport: options.showExport, // 是否支持导出文件 showExport: options.showExport, // 是否支持导出文件
showPrint: options.showPrint, // 是否支持打印页面
showHeader: options.showHeader, // 是否显示表头 showHeader: options.showHeader, // 是否显示表头
showFullscreen: options.showFullscreen, // 是否显示全屏按钮 showFullscreen: options.showFullscreen, // 是否显示全屏按钮
uniqueId: options.uniqueId, // 唯一的标识符 uniqueId: options.uniqueId, // 唯一的标识符
@ -470,6 +472,11 @@ var table = {
pageSize: pageSize pageSize: pageSize
}); });
}, },
// 刷新options配置
refreshOptions: function(options, tableId) {
var currentId = $.common.isEmpty(tableId) ? table.options.id : tableId;
$("#" + currentId).bootstrapTable('refreshOptions', options);
},
// 查询表格指定列值 // 查询表格指定列值
selectColumns: function(column) { selectColumns: function(column) {
var rows = $.map($("#" + table.options.id).bootstrapTable('getSelections'), function (row) { var rows = $.map($("#" + table.options.id).bootstrapTable('getSelections'), function (row) {

View File

@ -91,5 +91,12 @@
</form> </form>
</div> </div>
<th:block th:include="include :: footer" /> <th:block th:include="include :: footer" />
<script type="text/javascript">
function submitHandler() {
if ($.validate.form()) {
$.modal.msgSuccess('保存成功!');
}
}
</script>
</body> </body>
</html> </html>

View File

@ -0,0 +1,122 @@
<!DOCTYPE html>
<html lang="zh" xmlns:th="http://www.thymeleaf.org" xmlns:shiro="http://www.pollix.at/thymeleaf/shiro">
<head>
<th:block th:include="include :: header('自定义视图分页')" />
</head>
<body class="gray-bg">
<div class="container-div">
<div class="row">
<div class="col-sm-12 select-table table-striped">
<table id="bootstrap-table" data-page-size="10"
data-show-custom-view="true" data-custom-view="customViewFormatter"
data-show-custom-view-button="true">
</table>
</div>
</div>
</div>
<template id="profileTemplate">
<div class="col-sm-4">
<div class="contact-box">
<a href="profile.html">
<div class="col-sm-4">
<div class="text-center">
<img alt="image" class="img-circle m-t-xs img-responsive" src="%IMAGE%">
<div class="m-t-xs font-bold">%userName%</div>
</div>
</div>
<div class="col-sm-8">
<h3><strong>%userCode%</strong></h3>
<p><i class="fa fa-jpy"></i> %userBalance%</p>
<address>
<strong>RuoYi, Inc.</strong><br>
E-mail: %userEmail%<br>
<abbr title="Phone">Tel:</abbr> %userPhone%
</address>
</div>
<div class="clearfix"></div>
</a>
</div>
</div>
</template>
<div th:include="include :: footer"></div>
<th:block th:include="include :: bootstrap-table-custom-view-js" />
<script th:inline="javascript">
var prefix = ctx + "demo/table";
var datas = [[${@dict.getType('sys_normal_disable')}]];
$(function() {
var options = {
url: prefix + "/list",
showSearch: false,
showRefresh: false,
showToggle: false,
showColumns: false,
showExport: true,
columns: [{
checkbox: true
},
{
field : 'userId',
title : '用户ID'
},
{
field : 'userCode',
title : '用户编号'
},
{
field : 'userName',
title : '用户姓名'
},
{
field : 'userPhone',
title : '用户手机'
},
{
field : 'userEmail',
title : '用户邮箱'
},
{
field : 'userBalance',
title : '用户余额'
},
{
field: 'status',
title: '用户状态',
align: 'center',
formatter: function(value, row, index) {
return $.table.selectDictLabel(datas, value);
}
},
{
title: '操作',
align: 'center',
formatter: function(value, row, index) {
var actions = [];
actions.push('<a class="btn btn-success btn-xs" href="#"><i class="fa fa-edit"></i>编辑</a> ');
actions.push('<a class="btn btn-danger btn-xs" href="#"><i class="fa fa-remove"></i>删除</a>');
return actions.join('');
}
}]
};
$.table.init(options);
});
function customViewFormatter (data) {
var template = $('#profileTemplate').html()
var view = ''
$.each(data, function (i, row) {
view += template.replace('%userCode%', row.userCode)
.replace('%IMAGE%', "http://demo.ruoyi.vip/img/profile.jpg")
.replace('%userName%', row.userName)
.replace('%userEmail%', row.userEmail)
.replace('%userPhone%', row.userPhone)
.replace('%userBalance%', row.userBalance);
})
return `<div class="row mx-0">${view}</div>`
}
</script>
</body>
</html>

View File

@ -15,7 +15,7 @@
data-print-filter 设置值以按此列过滤打印的数据。 data-print-filter 设置值以按此列过滤打印的数据。
data-print-formatter 函数(值,行,索引)-返回字符串。格式化打印表中此列的单元格值。函数行为类似于“ formatter”列选项 data-print-formatter 函数(值,行,索引)-返回字符串。格式化打印表中此列的单元格值。函数行为类似于“ formatter”列选项
printIgnore 设置为true可以在打印页面中隐藏此列。 --> printIgnore 设置为true可以在打印页面中隐藏此列。 -->
<table id="bootstrap-table" data-show-print="true"></table> <table id="bootstrap-table"></table>
</div> </div>
</div> </div>
</div> </div>
@ -27,6 +27,7 @@
$(function() { $(function() {
var options = { var options = {
url: prefix + "/list", url: prefix + "/list",
showPrint: true,
showSearch: false, showSearch: false,
showRefresh: false, showRefresh: false,
showToggle: false, showToggle: false,

View File

@ -217,3 +217,8 @@
<div th:fragment="bootstrap-table-print-js"> <div th:fragment="bootstrap-table-print-js">
<script th:src="@{/ajax/libs/bootstrap-table/extensions/print/bootstrap-table-print.js?v=20210602}"></script> <script th:src="@{/ajax/libs/bootstrap-table/extensions/print/bootstrap-table-print.js?v=20210602}"></script>
</div> </div>
<!-- 表格视图分页插件 -->
<div th:fragment="bootstrap-table-custom-view-js">
<script th:src="@{/ajax/libs/bootstrap-table/extensions/custom-view/bootstrap-table-custom-view.js?v=20210602}"></script>
</div>

View File

@ -145,6 +145,7 @@
<li><a class="menuItem" th:href="@{/demo/table/refresh}">表格自动刷新</a></li> <li><a class="menuItem" th:href="@{/demo/table/refresh}">表格自动刷新</a></li>
<li><a class="menuItem" th:href="@{/demo/table/print}">表格打印配置</a></li> <li><a class="menuItem" th:href="@{/demo/table/print}">表格打印配置</a></li>
<li><a class="menuItem" th:href="@{/demo/table/dynamicColumns}">表格动态列</a></li> <li><a class="menuItem" th:href="@{/demo/table/dynamicColumns}">表格动态列</a></li>
<li><a class="menuItem" th:href="@{/demo/table/customView}">自定义视图分页</a></li>
<li><a class="menuItem" th:href="@{/demo/table/other}">表格其他操作</a></li> <li><a class="menuItem" th:href="@{/demo/table/other}">表格其他操作</a></li>
</ul> </ul>
</li> </li>

View File

@ -126,6 +126,7 @@
<li><a class="menuItem" th:href="@{/demo/table/refresh}">表格自动刷新</a></li> <li><a class="menuItem" th:href="@{/demo/table/refresh}">表格自动刷新</a></li>
<li><a class="menuItem" th:href="@{/demo/table/print}">表格打印配置</a></li> <li><a class="menuItem" th:href="@{/demo/table/print}">表格打印配置</a></li>
<li><a class="menuItem" th:href="@{/demo/table/dynamicColumns}">表格动态列</a></li> <li><a class="menuItem" th:href="@{/demo/table/dynamicColumns}">表格动态列</a></li>
<li><a class="menuItem" th:href="@{/demo/table/customView}">自定义视图分页</a></li>
<li><a class="menuItem" th:href="@{/demo/table/other}">表格其他操作</a></li> <li><a class="menuItem" th:href="@{/demo/table/other}">表格其他操作</a></li>
</ul> </ul>
</li> </li>

View File

@ -112,6 +112,7 @@
title: '操作', title: '操作',
align: 'center', align: 'center',
formatter: function(value, row, index) { formatter: function(value, row, index) {
if (row.roleId != 1) {
var actions = []; var actions = [];
actions.push('<a class="btn btn-success btn-xs ' + editFlag + '" href="javascript:void(0)" onclick="$.operate.edit(\'' + row.roleId + '\')"><i class="fa fa-edit"></i>编辑</a> '); actions.push('<a class="btn btn-success btn-xs ' + editFlag + '" href="javascript:void(0)" onclick="$.operate.edit(\'' + row.roleId + '\')"><i class="fa fa-edit"></i>编辑</a> ');
actions.push('<a class="btn btn-danger btn-xs ' + removeFlag + '" href="javascript:void(0)" onclick="$.operate.remove(\'' + row.roleId + '\')"><i class="fa fa-remove"></i>删除</a> '); actions.push('<a class="btn btn-danger btn-xs ' + removeFlag + '" href="javascript:void(0)" onclick="$.operate.remove(\'' + row.roleId + '\')"><i class="fa fa-remove"></i>删除</a> ');
@ -120,6 +121,9 @@
more.push("<a class='btn btn-default btn-xs " + editFlag + "' href='javascript:void(0)' onclick='authUser(" + row.roleId + ")'><i class='fa fa-user'></i>分配用户</a>"); more.push("<a class='btn btn-default btn-xs " + editFlag + "' href='javascript:void(0)' onclick='authUser(" + row.roleId + ")'><i class='fa fa-user'></i>分配用户</a>");
actions.push('<a tabindex="0" class="btn btn-info btn-xs" role="button" data-container="body" data-placement="left" data-toggle="popover" data-html="true" data-trigger="hover" data-content="' + more.join('') + '"><i class="fa fa-chevron-circle-right"></i>更多操作</a>'); actions.push('<a tabindex="0" class="btn btn-info btn-xs" role="button" data-container="body" data-placement="left" data-toggle="popover" data-html="true" data-trigger="hover" data-content="' + more.join('') + '"><i class="fa fa-chevron-circle-right"></i>更多操作</a>');
return actions.join(''); return actions.join('');
} else {
return "";
}
} }
}] }]
}; };

View File

@ -171,6 +171,7 @@
title: '操作', title: '操作',
align: 'center', align: 'center',
formatter: function(value, row, index) { formatter: function(value, row, index) {
if (row.userId != 1) {
var actions = []; var actions = [];
actions.push('<a class="btn btn-success btn-xs ' + editFlag + '" href="javascript:void(0)" onclick="$.operate.editTab(\'' + row.userId + '\')"><i class="fa fa-edit"></i>编辑</a> '); actions.push('<a class="btn btn-success btn-xs ' + editFlag + '" href="javascript:void(0)" onclick="$.operate.editTab(\'' + row.userId + '\')"><i class="fa fa-edit"></i>编辑</a> ');
actions.push('<a class="btn btn-danger btn-xs ' + removeFlag + '" href="javascript:void(0)" onclick="$.operate.remove(\'' + row.userId + '\')"><i class="fa fa-remove"></i>删除</a> '); actions.push('<a class="btn btn-danger btn-xs ' + removeFlag + '" href="javascript:void(0)" onclick="$.operate.remove(\'' + row.userId + '\')"><i class="fa fa-remove"></i>删除</a> ');
@ -179,6 +180,9 @@
more.push("<a class='btn btn-default btn-xs " + editFlag + "' href='javascript:void(0)' onclick='authRole(" + row.userId + ")'><i class='fa fa-check-square-o'></i>分配角色</a>"); more.push("<a class='btn btn-default btn-xs " + editFlag + "' href='javascript:void(0)' onclick='authRole(" + row.userId + ")'><i class='fa fa-check-square-o'></i>分配角色</a>");
actions.push('<a tabindex="0" class="btn btn-info btn-xs" role="button" data-container="body" data-placement="left" data-toggle="popover" data-html="true" data-trigger="hover" data-content="' + more.join('') + '"><i class="fa fa-chevron-circle-right"></i>更多操作</a>'); actions.push('<a tabindex="0" class="btn btn-info btn-xs" role="button" data-container="body" data-placement="left" data-toggle="popover" data-html="true" data-trigger="hover" data-content="' + more.join('') + '"><i class="fa fa-chevron-circle-right"></i>更多操作</a>');
return actions.join(''); return actions.join('');
} else {
return "";
}
} }
}] }]
}; };

View File

@ -96,4 +96,9 @@ public class Constants
* 资源映射路径 前缀 * 资源映射路径 前缀
*/ */
public static final String RESOURCE_PREFIX = "/profile"; public static final String RESOURCE_PREFIX = "/profile";
/**
* RMI 远程方法调用
*/
public static final String LOOKUP_RMI = "rmi://";
} }

View File

@ -32,8 +32,8 @@ public class SysRole extends BaseEntity
@Excel(name = "角色排序", cellType = ColumnType.NUMERIC) @Excel(name = "角色排序", cellType = ColumnType.NUMERIC)
private String roleSort; private String roleSort;
/** 数据范围1所有数据权限2自定义数据权限3本部门数据权限4本部门及以下数据权限 */ /** 数据范围1所有数据权限2自定义数据权限3本部门数据权限4本部门及以下数据权限5仅本人数据权限 */
@Excel(name = "数据范围", readConverterExp = "1=所有数据权限,2=自定义数据权限,3=本部门数据权限,4=本部门及以下数据权限") @Excel(name = "数据范围", readConverterExp = "1=所有数据权限,2=自定义数据权限,3=本部门数据权限,4=本部门及以下数据权限,5=仅本人数据权限")
private String dataScope; private String dataScope;
/** 角色状态0正常 1停用 */ /** 角色状态0正常 1停用 */

View File

@ -7,6 +7,7 @@ import java.nio.charset.Charset;
import java.text.NumberFormat; import java.text.NumberFormat;
import java.util.Set; import java.util.Set;
import com.ruoyi.common.utils.StringUtils; import com.ruoyi.common.utils.StringUtils;
import org.apache.commons.lang3.ArrayUtils;
/** /**
* 类型转换器 * 类型转换器
@ -795,9 +796,14 @@ public class Convert
{ {
return (String) obj; 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) else if (obj instanceof ByteBuffer)
{ {

View File

@ -18,7 +18,7 @@ import com.ruoyi.common.utils.StringUtils;
* *
* @author ruoyi * @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]+"; public static String FILENAME_PATTERN = "[a-zA-Z0-9_\\-\\|\\.\\u4e00-\\u9fa5]+";

View File

@ -44,8 +44,7 @@ public class ResourcesConfig implements WebMvcConfigurer
registry.addResourceHandler(Constants.RESOURCE_PREFIX + "/**").addResourceLocations("file:" + RuoYiConfig.getProfile() + "/"); registry.addResourceHandler(Constants.RESOURCE_PREFIX + "/**").addResourceLocations("file:" + RuoYiConfig.getProfile() + "/");
/** swagger配置 */ /** swagger配置 */
registry.addResourceHandler("swagger-ui.html").addResourceLocations("classpath:/META-INF/resources/"); registry.addResourceHandler("/swagger-ui/**").addResourceLocations("classpath:/META-INF/resources/webjars/springfox-swagger-ui/");
registry.addResourceHandler("/webjars/**").addResourceLocations("classpath:/META-INF/resources/webjars/");
} }
/** /**

View File

@ -10,6 +10,7 @@ import java.util.Map;
import java.util.stream.Collectors; import java.util.stream.Collectors;
import java.util.zip.ZipEntry; import java.util.zip.ZipEntry;
import java.util.zip.ZipOutputStream; import java.util.zip.ZipOutputStream;
import org.apache.commons.io.FileUtils;
import org.apache.commons.io.IOUtils; import org.apache.commons.io.IOUtils;
import org.apache.velocity.Template; import org.apache.velocity.Template;
import org.apache.velocity.VelocityContext; 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.core.text.Convert;
import com.ruoyi.common.exception.BusinessException; import com.ruoyi.common.exception.BusinessException;
import com.ruoyi.common.utils.StringUtils; import com.ruoyi.common.utils.StringUtils;
import com.ruoyi.common.utils.file.FileUtils;
import com.ruoyi.generator.domain.GenTable; import com.ruoyi.generator.domain.GenTable;
import com.ruoyi.generator.domain.GenTableColumn; import com.ruoyi.generator.domain.GenTableColumn;
import com.ruoyi.generator.mapper.GenTableColumnMapper; import com.ruoyi.generator.mapper.GenTableColumnMapper;

View File

@ -13,11 +13,13 @@ import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody; import org.springframework.web.bind.annotation.ResponseBody;
import com.ruoyi.common.annotation.Log; import com.ruoyi.common.annotation.Log;
import com.ruoyi.common.constant.Constants;
import com.ruoyi.common.core.controller.BaseController; import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.common.core.domain.AjaxResult; import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.common.core.page.TableDataInfo; import com.ruoyi.common.core.page.TableDataInfo;
import com.ruoyi.common.enums.BusinessType; import com.ruoyi.common.enums.BusinessType;
import com.ruoyi.common.exception.job.TaskException; import com.ruoyi.common.exception.job.TaskException;
import com.ruoyi.common.utils.StringUtils;
import com.ruoyi.common.utils.poi.ExcelUtil; import com.ruoyi.common.utils.poi.ExcelUtil;
import com.ruoyi.quartz.domain.SysJob; import com.ruoyi.quartz.domain.SysJob;
import com.ruoyi.quartz.service.ISysJobService; import com.ruoyi.quartz.service.ISysJobService;
@ -131,7 +133,11 @@ public class SysJobController extends BaseController
{ {
if (!CronUtils.isValid(job.getCronExpression())) 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)); return toAjax(jobService.insertJob(job));
} }
@ -157,7 +163,11 @@ public class SysJobController extends BaseController
{ {
if (!CronUtils.isValid(job.getCronExpression())) 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)); return toAjax(jobService.updateJob(job));
} }

View File

@ -93,11 +93,11 @@ public interface SysDeptMapper
public List<String> selectRoleDeptTree(Long roleId); public List<String> selectRoleDeptTree(Long roleId);
/** /**
* 修改所在部门的父级部门状态 * 修改所在部门正常状态
* *
* @param dept 部门 * @param deptIds 部门ID组
*/ */
public void updateDeptStatus(SysDept dept); public void updateDeptStatusNormal(Long[] deptIds);
/** /**
* 根据ID查询所有子部门 * 根据ID查询所有子部门

View File

@ -12,6 +12,7 @@ import com.ruoyi.common.constant.UserConstants;
import com.ruoyi.common.core.domain.Ztree; import com.ruoyi.common.core.domain.Ztree;
import com.ruoyi.common.core.domain.entity.SysDept; import com.ruoyi.common.core.domain.entity.SysDept;
import com.ruoyi.common.core.domain.entity.SysRole; 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.exception.BusinessException;
import com.ruoyi.common.utils.StringUtils; import com.ruoyi.common.utils.StringUtils;
import com.ruoyi.system.mapper.SysDeptMapper; import com.ruoyi.system.mapper.SysDeptMapper;
@ -229,7 +230,7 @@ public class SysDeptServiceImpl implements ISysDeptService
if (UserConstants.DEPT_NORMAL.equals(dept.getStatus())) if (UserConstants.DEPT_NORMAL.equals(dept.getStatus()))
{ {
// 如果该部门是启用状态则启用该部门的所有上级部门 // 如果该部门是启用状态则启用该部门的所有上级部门
updateParentDeptStatus(dept); updateParentDeptStatusNormal(dept);
} }
return result; return result;
} }
@ -239,12 +240,11 @@ public class SysDeptServiceImpl implements ISysDeptService
* *
* @param dept 当前部门 * @param dept 当前部门
*/ */
private void updateParentDeptStatus(SysDept dept) private void updateParentDeptStatusNormal(SysDept dept)
{ {
String updateBy = dept.getUpdateBy(); String ancestors = dept.getAncestors();
dept = deptMapper.selectDeptById(dept.getDeptId()); Long[] deptIds = Convert.toLongArray(ancestors);
dept.setUpdateBy(updateBy); deptMapper.updateDeptStatusNormal(deptIds);
deptMapper.updateDeptStatus(dept);
} }
/** /**

View File

@ -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 set del_flag = '2' where dept_id = #{deptId}
</delete> </delete>
<update id="updateDeptStatus" parameterType="SysDept"> <update id="updateDeptStatusNormal" parameterType="Long">
update sys_dept update sys_dept set status = '0' where dept_id in
<set> <foreach collection="array" item="deptId" open="(" separator="," close=")">
<if test="status != null and status != ''">status = #{status},</if> #{deptId}
<if test="updateBy != null and updateBy != ''">update_by = #{updateBy},</if> </foreach>
update_time = sysdate()
</set>
where find_in_set(#{deptId}, ancestors)
</update> </update>
</mapper> </mapper>

2
ry.sh
View File

@ -3,7 +3,7 @@
# ./ry.sh start 启动 # ./ry.sh start 启动
# ./ry.sh stop 停止 # ./ry.sh stop 停止
# ./ry.sh restart 重启 # ./ry.sh restart 重启
# ./ry.sh start 状态 # ./ry.sh status 状态
AppName=ruoyi-admin.jar AppName=ruoyi-admin.jar
# JVM参数 # JVM参数