From 1e91312f0854888587b836a1359abe77f5db8a9e Mon Sep 17 00:00:00 2001 From: RuoYi Date: Thu, 23 Feb 2023 09:29:26 +0800 Subject: [PATCH] =?UTF-8?q?=E6=97=A5=E5=BF=97=E7=AE=A1=E7=90=86=E4=BD=BF?= =?UTF-8?q?=E7=94=A8=E7=B4=A2=E5=BC=95=E6=8F=90=E5=8D=87=E6=9F=A5=E8=AF=A2?= =?UTF-8?q?=E6=80=A7=E8=83=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../main/resources/static/ruoyi/js/common.js | 27 +++++++++++++++++++ .../main/resources/static/ruoyi/js/ry-ui.js | 9 +------ .../monitor/logininfor/logininfor.html | 14 ++++++++-- .../templates/monitor/operlog/operlog.html | 18 +++++++++---- .../resources/templates/system/user/user.html | 1 + .../mapper/system/SysLogininforMapper.xml | 4 +-- .../mapper/system/SysOperLogMapper.xml | 4 +-- sql/{ry_20230220.sql => ry_20230223.sql} | 9 +++++-- 8 files changed, 65 insertions(+), 21 deletions(-) rename sql/{ry_20230220.sql => ry_20230223.sql} (99%) diff --git a/ruoyi-admin/src/main/resources/static/ruoyi/js/common.js b/ruoyi-admin/src/main/resources/static/ruoyi/js/common.js index bfb94793..c00317e2 100644 --- a/ruoyi-admin/src/main/resources/static/ruoyi/js/common.js +++ b/ruoyi-admin/src/main/resources/static/ruoyi/js/common.js @@ -68,6 +68,7 @@ $(function() { endLayDate.config.min.month = ''; endLayDate.config.min.date = ''; } + $('#endTime').trigger('click'); } }); endLayDate = laydate.render({ @@ -383,6 +384,32 @@ function checkpwd(chrtype, password) { return true; } +/** 开始时间/时分秒 */ +function beginOfTime(date) { + if($.common.isNotEmpty(date)) { + return $.common.sprintf("%s 00:00:00", date); + } +} + +/** 结束时间/时分秒 */ +function endOfTime(date) { + if($.common.isNotEmpty(date)) { + return $.common.sprintf("%s 23:59:59", date); + } +} + +/** 重置日期/年月日 */ +function resetDate() { + if ($.common.isNotEmpty(startLayDate) && $.common.isNotEmpty(endLayDate)) { + endLayDate.config.min.year = ''; + endLayDate.config.min.month = ''; + endLayDate.config.min.date = ''; + startLayDate.config.max.year = '2099'; + startLayDate.config.max.month = '12'; + startLayDate.config.max.date = '31'; + } +} + // 日志打印封装处理 var log = { log: function(msg) { 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 de878e83..2a306cb4 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 @@ -704,14 +704,7 @@ var table = { } else if (table.options.type == table_type.bootstrapTreeTable) { $("#" + tableId).bootstrapTreeTable('refresh', table.options.ajaxParams); } - if ($.common.isNotEmpty(startLayDate) && $.common.isNotEmpty(endLayDate)) { - endLayDate.config.min.year = ''; - endLayDate.config.min.month = ''; - endLayDate.config.min.date = ''; - startLayDate.config.max.year = '2099'; - startLayDate.config.max.month = '12'; - startLayDate.config.max.date = '31'; - } + resetDate(); }, // 获取选中复选框项 selectCheckeds: function(name) { diff --git a/ruoyi-admin/src/main/resources/templates/monitor/logininfor/logininfor.html b/ruoyi-admin/src/main/resources/templates/monitor/logininfor/logininfor.html index 549b8db4..7b2df062 100644 --- a/ruoyi-admin/src/main/resources/templates/monitor/logininfor/logininfor.html +++ b/ruoyi-admin/src/main/resources/templates/monitor/logininfor/logininfor.html @@ -24,9 +24,9 @@
  • - + - - +
  •  搜索 @@ -69,6 +69,7 @@ cleanUrl: prefix + "/clean", removeUrl: prefix + "/remove", exportUrl: prefix + "/export", + queryParams: queryParams, sortName: "loginTime", sortOrder: "desc", modalName: "登录日志", @@ -128,6 +129,15 @@ $.table.init(options); }); + function queryParams(params) { + var search = $.table.queryParams(params); + search.params = { + beginTime : beginOfTime($("#startTime").val()), + endTime : endOfTime($("#endTime").val()) + }; + return search; + } + function unlock() { $.operate.post(prefix + "/unlock?loginName=" + $.table.selectColumns("loginName")); } diff --git a/ruoyi-admin/src/main/resources/templates/monitor/operlog/operlog.html b/ruoyi-admin/src/main/resources/templates/monitor/operlog/operlog.html index 351e665c..9a0a76f3 100644 --- a/ruoyi-admin/src/main/resources/templates/monitor/operlog/operlog.html +++ b/ruoyi-admin/src/main/resources/templates/monitor/operlog/operlog.html @@ -30,9 +30,9 @@
  • - + - - +
  •  搜索 @@ -92,14 +92,17 @@ }, { field: 'title', - title: '系统模块' - }, + title: '系统模块', + formatter: function(value, row, index) { + return $.table.tooltip(value); + } + }, { field: 'businessType', title: '操作类型', align: 'center', formatter: function(value, row, index) { - return $.table.selectDictLabel(datas, value); + return $.table.selectDictLabel(datas, value); } }, { @@ -159,6 +162,10 @@ function queryParams(params) { var search = $.table.queryParams(params); + search.params = { + beginTime : beginOfTime($("#startTime").val()), + endTime : endOfTime($("#endTime").val()) + }; search.businessTypes = $.common.join($('#businessTypes').selectpicker('val')); return search; } @@ -168,6 +175,7 @@ } function resetPre() { + resetDate(); $("#operlog-form")[0].reset(); $("#businessTypes").selectpicker('refresh'); $.table.search('operlog-form', 'bootstrap-table'); 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 3755fcfc..d91db5de 100644 --- a/ruoyi-admin/src/main/resources/templates/system/user/user.html +++ b/ruoyi-admin/src/main/resources/templates/system/user/user.html @@ -224,6 +224,7 @@ /* 自定义重置-表单重置/隐藏框/树节点选择色/搜索 */ function resetPre() { + resetDate(); $("#user-form")[0].reset(); $("#deptId").val(""); $("#parentId").val(""); diff --git a/ruoyi-system/src/main/resources/mapper/system/SysLogininforMapper.xml b/ruoyi-system/src/main/resources/mapper/system/SysLogininforMapper.xml index a2ac5b4e..76ef71f3 100644 --- a/ruoyi-system/src/main/resources/mapper/system/SysLogininforMapper.xml +++ b/ruoyi-system/src/main/resources/mapper/system/SysLogininforMapper.xml @@ -34,10 +34,10 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" AND login_name like concat('%', #{loginName}, '%') - and date_format(login_time,'%y%m%d') >= date_format(#{params.beginTime},'%y%m%d') + AND login_time >= #{params.beginTime} - and date_format(login_time,'%y%m%d') <= date_format(#{params.endTime},'%y%m%d') + AND login_time <= #{params.endTime} diff --git a/ruoyi-system/src/main/resources/mapper/system/SysOperLogMapper.xml b/ruoyi-system/src/main/resources/mapper/system/SysOperLogMapper.xml index fa30d316..1006a43f 100644 --- a/ruoyi-system/src/main/resources/mapper/system/SysOperLogMapper.xml +++ b/ruoyi-system/src/main/resources/mapper/system/SysOperLogMapper.xml @@ -56,10 +56,10 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" AND oper_name like concat('%', #{operName}, '%') - and date_format(oper_time,'%y%m%d') >= date_format(#{params.beginTime},'%y%m%d') + AND oper_time >= #{params.beginTime} - and date_format(oper_time,'%y%m%d') <= date_format(#{params.endTime},'%y%m%d') + AND oper_time <= #{params.endTime} diff --git a/sql/ry_20230220.sql b/sql/ry_20230223.sql similarity index 99% rename from sql/ry_20230220.sql rename to sql/ry_20230223.sql index 23c3587f..5a1d7e5e 100644 --- a/sql/ry_20230220.sql +++ b/sql/ry_20230223.sql @@ -429,7 +429,10 @@ create table sys_oper_log ( error_msg varchar(2000) default '' comment '错误消息', oper_time datetime comment '操作时间', cost_time bigint(20) default 0 comment '消耗时间', - primary key (oper_id) + primary key (oper_id), + key idx_sys_oper_log_bt (business_type), + key idx_sys_oper_log_s (status), + key idx_sys_oper_log_ot (oper_time) ) engine=innodb auto_increment=100 comment = '操作日志记录'; @@ -563,7 +566,9 @@ create table sys_logininfor ( status char(1) default '0' comment '登录状态(0成功 1失败)', msg varchar(255) default '' comment '提示消息', login_time datetime comment '访问时间', - primary key (info_id) + primary key (info_id), + key idx_sys_logininfor_s (status), + key idx_sys_logininfor_lt (login_time) ) engine=innodb auto_increment=100 comment = '系统访问记录';