审计日志
This commit is contained in:
@@ -4,6 +4,7 @@ import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
import com.njcn.system.pojo.dto.excel.UserLogExcel;
|
||||
import com.njcn.system.pojo.param.AuditParam;
|
||||
import com.njcn.system.pojo.po.UserLog;
|
||||
import com.njcn.system.pojo.vo.AuditLogCusVO;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
|
||||
import java.util.List;
|
||||
@@ -24,5 +25,16 @@ public interface AuditMapper {
|
||||
* 查询需要备份的审计日志
|
||||
*/
|
||||
List<UserLogExcel> queryExportUser(@Param("ew") QueryWrapper<UserLogExcel> queryWrapper);
|
||||
|
||||
/**
|
||||
* 获取审计日志统计列表
|
||||
*/
|
||||
List<AuditLogCusVO> selectCensusAuditLog(@Param("auditParam") AuditParam auditParam);
|
||||
/**
|
||||
* 查询所有登录名
|
||||
*/
|
||||
List<String> selectLoginName();
|
||||
/**
|
||||
* 查询所有操作类型
|
||||
*/
|
||||
List<String> selectOperateType();
|
||||
}
|
||||
|
||||
@@ -8,6 +8,15 @@
|
||||
FROM sys_user_log
|
||||
WHERE update_time >= #{auditParam.searchBeginTime}
|
||||
AND #{auditParam.searchEndTime} >= update_time
|
||||
<if test="auditParam.loginName!=null">
|
||||
and login_name = #{auditParam.loginName}
|
||||
</if>
|
||||
<if test="auditParam.type!=null">
|
||||
and type = #{auditParam.type}
|
||||
</if>
|
||||
<if test="auditParam.operateType!=null">
|
||||
and operate_type = #{auditParam.operateType}
|
||||
</if>
|
||||
</select>
|
||||
|
||||
<select id="selectAuditLog" resultType="UserLog">
|
||||
@@ -32,14 +41,14 @@
|
||||
sys_user_log
|
||||
WHERE update_time >= #{auditParam.searchBeginTime}
|
||||
AND #{auditParam.searchEndTime} >= update_time
|
||||
<if test="auditParam.userName!=null">
|
||||
and user_name = #{auditParam.userName}
|
||||
<if test="auditParam.loginName!=null">
|
||||
and login_name = #{auditParam.loginName}
|
||||
</if>
|
||||
<if test="auditParam.type!=null">
|
||||
and type = #{auditParam.type}
|
||||
</if>
|
||||
<if test="auditParam.operate!=null">
|
||||
and operate = #{auditParam.operate}
|
||||
<if test="auditParam.operateType!=null">
|
||||
and operate_type = #{auditParam.operateType}
|
||||
</if>
|
||||
AND id >= (select id from sys_user_log order by id limit #{auditParam.pageNum}, 1) limit #{auditParam.pageSize}
|
||||
</select>
|
||||
@@ -66,5 +75,43 @@
|
||||
Where ${ew.sqlSegment}
|
||||
</select>
|
||||
|
||||
<select id="selectCensusAuditLog" resultType="AuditLogCusVO">
|
||||
SELECT
|
||||
login_name LoginName,
|
||||
operate_type operateType,
|
||||
count(id) AS count
|
||||
FROM sys_user_log
|
||||
WHERE user_name !=""
|
||||
AND user_name !="unknown user"
|
||||
AND operate != "unknown operate"
|
||||
AND update_time >= #{auditParam.searchBeginTime}
|
||||
AND #{auditParam.searchEndTime} >= update_time
|
||||
<if test="auditParam.loginName!=null">
|
||||
and login_name = #{auditParam.loginName}
|
||||
</if>
|
||||
<if test="auditParam.type!=null">
|
||||
and type = #{auditParam.type}
|
||||
</if>
|
||||
<if test="auditParam.operateType!=null">
|
||||
and operate_type = #{auditParam.operateType}
|
||||
</if>
|
||||
GROUP BY login_name, operate_type
|
||||
</select>
|
||||
|
||||
<select id="selectLoginName" resultType="String">
|
||||
SELECT
|
||||
login_name
|
||||
FROM sys_user_log
|
||||
WHERE login_name !=""
|
||||
AND login_name !="unknown user"
|
||||
GROUP BY login_name
|
||||
</select>
|
||||
|
||||
<select id="selectOperateType" resultType="String">
|
||||
SELECT
|
||||
operate_type
|
||||
FROM sys_user_log
|
||||
GROUP BY operate_type
|
||||
</select>
|
||||
|
||||
</mapper>
|
||||
Reference in New Issue
Block a user