1.审计管理

2.谐波检测bug修改
This commit is contained in:
wr
2023-05-19 16:20:57 +08:00
parent 6b7dfdb6f7
commit 373fe16ee1
18 changed files with 528 additions and 148 deletions

View File

@@ -1,7 +1,8 @@
package com.njcn.system.mapper;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.njcn.system.pojo.dto.excel.UserLogExcel;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.njcn.system.excel.UserLogExcel;
import com.njcn.system.pojo.param.AuditParam;
import com.njcn.system.pojo.po.UserLog;
import com.njcn.system.pojo.vo.AuditLogCusVO;
@@ -25,6 +26,8 @@ public interface AuditMapper {
* 查询需要备份的审计日志
*/
List<UserLogExcel> queryExportUser(@Param("ew") QueryWrapper<UserLogExcel> queryWrapper);
Page<UserLogExcel> queryExportLimit(Page<UserLogExcel> page, @Param("startTime")String time,@Param("endTime")String endTime);
/**
* 获取审计日志统计列表
*/

View File

@@ -1,12 +1,9 @@
package com.njcn.system.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.njcn.system.pojo.dto.AreaTreeDTO;
import com.njcn.system.pojo.po.Area;
import com.njcn.system.excel.UserLogExcel;
import com.njcn.system.pojo.po.UserLog;
import com.njcn.system.pojo.vo.AreaTreeVO;
import org.apache.ibatis.annotations.Param;
import java.util.List;
/**
@@ -20,5 +17,23 @@ import java.util.List;
public interface UserLogMapper extends BaseMapper<UserLog> {
/**
* 日志批量插入
* @param userLogs
*/
void insertBatch(@Param("list") List<UserLogExcel> userLogs);
/**
* 根据id查询数据库是否存在
* @param idList
* @return
*/
List<String> ids(@Param("ids")List<String> idList);
/**
* 查询表空间大小
* @param schema
* @return
*/
Float getMemoInfo(@Param("schema") String schema);
}

View File

@@ -91,13 +91,13 @@
AND operate != "unknown operate"
AND update_time >= #{auditParam.searchBeginTime}
AND #{auditParam.searchEndTime} >= update_time
<if test="auditParam.loginName!=null">
<if test="auditParam.loginName!=null and auditParam.loginName!=''">
and login_name = #{auditParam.loginName}
</if>
<if test="auditParam.type!=null">
<if test="auditParam.type!=null and auditParam.type!=''">
and type = #{auditParam.type}
</if>
<if test="auditParam.operateType!=null">
<if test="auditParam.operateType!=null and auditParam.operateType!=''">
and operate_type = #{auditParam.operateType}
</if>
GROUP BY login_name, operate_type
@@ -118,5 +118,35 @@
FROM sys_user_log
GROUP BY operate_type
</select>
<select id="queryExportLimit" resultType="com.njcn.system.excel.UserLogExcel">
SELECT
id,
login_name loginName,
user_name userName,
ip,
operate,
operate_type operateType,
result,
fail_reason failReason,
level,
type,
service_name serviceName,
state,
create_by createBy,
create_time createTime,
update_by updateBy,
update_time updateTime
FROM sys_user_log
<where>
<if test="startTime != null and startTime != ''">
and create_time >= #{startTime}
</if>
<if test="endTime != null and endTime != ''">
and create_time &lt;= #{endTime}
</if>
</where>
</select>
</mapper>

View File

@@ -2,4 +2,59 @@
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.njcn.system.mapper.UserLogMapper">
<insert id="insertBatch">
INSERT INTO sys_user_log (
id,
login_name,
user_name,
ip,
operate,
operate_type,
result,
fail_reason,
LEVEL,
type,
service_name,
state,
create_by,
create_time,
update_by,
update_time
)
values
<foreach collection="list" item="item" separator="," index="index">
( #{item.id},
#{item.loginName},
#{item.userName},
#{item.ip},
#{item.operate},
#{item.operateType},
#{item.result},
#{item.failReason},
#{item.level},
#{item.type},
#{item.serviceName},
#{item.state},
#{item.createBy},
#{item.createTime},
#{item.updateBy},
#{item.updateTime} )
</foreach>
</insert>
<select id="ids" resultType="java.lang.String">
select id from sys_user_log
where id in
<foreach collection="ids" item="item" index="index" open="(" separator="," close=")">
#{item}
</foreach>
</select>
<select id="getMemoInfo" resultType="java.lang.Float">
SELECT
TRUNCATE (data_length / 1024 / 1024, 2) AS '数据容量(MB)'
FROM
information_schema.tables
where table_schema = #{schema} and table_name="sys_user_log"
</select>
</mapper>