1. 添加日志审计功能
parent
f8340cfcf3
commit
2fdbc3f2f0
@ -0,0 +1,18 @@
|
||||
package com.supervision.police.mapper;
|
||||
|
||||
import com.supervision.police.domain.AuditLog;
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
|
||||
/**
|
||||
* @author Administrator
|
||||
* @description 针对表【audit_log(日志审计表)】的数据库操作Mapper
|
||||
* @createDate 2024-12-09 13:19:15
|
||||
* @Entity com.supervision.police.domain.AuditLog
|
||||
*/
|
||||
public interface AuditLogMapper extends BaseMapper<AuditLog> {
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
@ -0,0 +1,16 @@
|
||||
package com.supervision.police.service;
|
||||
|
||||
import com.supervision.police.domain.AuditLog;
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
import com.supervision.police.dto.AuditLogDTO;
|
||||
|
||||
/**
|
||||
* @author Administrator
|
||||
* @description 针对表【audit_log(日志审计表)】的数据库操作Service
|
||||
* @createDate 2024-12-09 13:19:15
|
||||
*/
|
||||
public interface AuditLogService extends IService<AuditLog> {
|
||||
|
||||
|
||||
void saveAuditLog(AuditLogDTO auditLogDTO);
|
||||
}
|
@ -0,0 +1,32 @@
|
||||
package com.supervision.police.service.impl;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import com.supervision.police.domain.AuditLog;
|
||||
import com.supervision.police.dto.AuditLogDTO;
|
||||
import com.supervision.police.service.AuditLogService;
|
||||
import com.supervision.police.mapper.AuditLogMapper;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
/**
|
||||
* @author Administrator
|
||||
* @description 针对表【audit_log(日志审计表)】的数据库操作Service实现
|
||||
* @createDate 2024-12-09 13:19:15
|
||||
*/
|
||||
@Service
|
||||
public class AuditLogServiceImpl extends ServiceImpl<AuditLogMapper, AuditLog>
|
||||
implements AuditLogService{
|
||||
|
||||
@Override
|
||||
public void saveAuditLog(AuditLogDTO auditLogDTO) {
|
||||
if (null == auditLogDTO){
|
||||
return;
|
||||
}
|
||||
|
||||
AuditLog auditLog = auditLogDTO.toAuditLog();
|
||||
this.save(auditLog);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
@ -0,0 +1,32 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE mapper
|
||||
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||
<mapper namespace="com.supervision.police.mapper.AuditLogMapper">
|
||||
|
||||
<resultMap id="BaseResultMap" type="com.supervision.police.domain.AuditLog">
|
||||
<id property="id" column="id" jdbcType="VARCHAR"/>
|
||||
<result property="recordType" column="record_type" jdbcType="VARCHAR"/>
|
||||
<result property="userId" column="user_id" jdbcType="VARCHAR"/>
|
||||
<result property="userName" column="user_name" jdbcType="VARCHAR"/>
|
||||
<result property="ip" column="ip" jdbcType="VARCHAR"/>
|
||||
<result property="method" column="method" jdbcType="VARCHAR"/>
|
||||
<result property="url" column="url" jdbcType="VARCHAR"/>
|
||||
<result property="requestParams" column="request_params" jdbcType="VARCHAR"/>
|
||||
<result property="costTime" column="cost_time" jdbcType="INTEGER"/>
|
||||
<result property="response" column="response" jdbcType="VARCHAR"/>
|
||||
<result property="exceptionDesc" column="exception_desc" jdbcType="VARCHAR"/>
|
||||
<result property="createTime" column="create_time" jdbcType="TIMESTAMP"/>
|
||||
<result property="createUserId" column="create_user_id" jdbcType="VARCHAR"/>
|
||||
<result property="updateTime" column="update_time" jdbcType="TIMESTAMP"/>
|
||||
<result property="updateUserId" column="update_user_id" jdbcType="VARCHAR"/>
|
||||
</resultMap>
|
||||
|
||||
<sql id="Base_Column_List">
|
||||
id,record_type,user_id,
|
||||
user_name,ip,method,
|
||||
url,request_params,cost_time,
|
||||
response,exception_desc,create_time,
|
||||
create_user_id,update_time,update_user_id
|
||||
</sql>
|
||||
</mapper>
|
Loading…
Reference in New Issue