【8.0】【log】更新api日志记录的表名

pull/57/head
fengshuonan 2023-07-21 11:00:58 +08:00
parent 8282f7dd09
commit e82bb3dea1
9 changed files with 3 additions and 74 deletions

View File

@ -42,24 +42,9 @@ public interface LogConstants {
*/
String LOG_EXCEPTION_STEP_CODE = "12";
/**
*
*/
String LOG_DEFAULT_NAME = "API接口日志记录";
/**
*
*/
String LOG_DEFAULT_APP_NAME = "none-app-name";
/**
*
*/
Integer DEFAULT_BEGIN_PAGE_NO = 1;
/**
*
*/
Integer DEFAULT_PAGE_SIZE = 10;
}

View File

@ -32,33 +32,6 @@ package cn.stylefeng.roses.kernel.log.api.constants;
*/
public interface LogFileConstants {
/**
* appName
* <p>
* app-logs-2020-10-28.log
*/
String DEFAULT_LOG_FILE_NAME = "app-logs";
/**
*
*/
String FILE_CONTRACT_SYMBOL = "-";
/**
*
*/
String FILE_SUFFIX = ".log";
/**
* windows
*/
String DEFAULT_FILE_SAVE_PATH_WINDOWS = "d:/logfiles";
/**
* linuxwindows
*/
String DEFAULT_FILE_SAVE_PATH_LINUX = "/tmp/logfiles";
/**
* apiaop
*/

View File

@ -48,15 +48,12 @@ public class LogRecordFactory {
* @author fengshuonan
* @since 2020/10/28 17:31
*/
public static LogRecordDTO createLogRecord(String name, Object content) {
public static LogRecordDTO createLogRecord(Object content) {
LogRecordDTO logRecordDTO = new LogRecordDTO();
//设置全局id
logRecordDTO.setLogId(IdUtil.getSnowflake(1, 1).nextId());
// 设置日志名称
logRecordDTO.setLogName(name);
// 设置日志内容
logRecordDTO.setLogContent(content);

View File

@ -63,12 +63,6 @@ public class LogManagerRequest extends BaseRequest {
@NotBlank(message = "结束时间不能为空", groups = {delete.class})
private String endDate;
/**
*
*/
@ChineseDescription("日志名称")
private String logName;
/**
* spring.application.name
*/

View File

@ -46,12 +46,6 @@ public class LogRecordDTO {
@ChineseDescription("日志id")
private Long logId;
/**
*
*/
@ChineseDescription("日志名称")
private String logName;
/**
*
*/

View File

@ -28,7 +28,6 @@ import cn.hutool.core.util.ObjectUtil;
import cn.stylefeng.roses.kernel.auth.api.context.LoginContext;
import cn.stylefeng.roses.kernel.auth.api.pojo.login.LoginUser;
import cn.stylefeng.roses.kernel.log.api.LogRecordApi;
import cn.stylefeng.roses.kernel.log.api.constants.LogConstants;
import cn.stylefeng.roses.kernel.log.api.constants.LogFileConstants;
import cn.stylefeng.roses.kernel.log.api.expander.LogConfigExpander;
import cn.stylefeng.roses.kernel.log.api.factory.LogRecordFactory;
@ -171,7 +170,7 @@ public class RequestApiLogRecordAop implements Ordered {
Object actionName = annotationProp.get("name");
// 创建日志对象
LogRecordDTO logRecordDTO = LogRecordFactory.createLogRecord(LogConstants.LOG_DEFAULT_NAME, actionName);
LogRecordDTO logRecordDTO = LogRecordFactory.createLogRecord(actionName);
// 填充用户登录信息
LoginUser loginUserNullable = LoginContext.me().getLoginUserNullable();

View File

@ -107,11 +107,6 @@ public class DbLogRecordServiceImpl implements LogRecordApi {
// 复制logRecordDTO对象属性到sysLog
BeanUtil.copyProperties(logRecordDTO, sysLog);
// 日志名称为空的话则获取默认日志名称
if (StrUtil.isEmpty(sysLog.getLogName())) {
sysLog.setLogName(LogConstants.LOG_DEFAULT_NAME);
}
// 服务名称为空的话则获取默认服务名称
if (StrUtil.isEmpty(sysLog.getAppName())) {
sysLog.setAppName(LogConstants.LOG_DEFAULT_APP_NAME);

View File

@ -40,7 +40,7 @@ import lombok.EqualsAndHashCode;
*/
@EqualsAndHashCode(callSuper = true)
@Data
@TableName("sys_log")
@TableName("sys_log_api")
public class SysLog extends BaseEntity {
/**
@ -49,12 +49,6 @@ public class SysLog extends BaseEntity {
@TableId(value = "log_id", type = IdType.ASSIGN_ID)
private Long logId;
/**
*
*/
@TableField(value = "log_name")
private String logName;
/**
*
*/

View File

@ -142,7 +142,6 @@ public class SysLogServiceImpl extends ServiceImpl<SysLogMapper, SysLog> impleme
}
// SQL条件拼接
String name = logManagerRequest.getLogName();
String appName = logManagerRequest.getAppName();
String serverIp = logManagerRequest.getServerIp();
Long userId = logManagerRequest.getUserId();
@ -152,7 +151,6 @@ public class SysLogServiceImpl extends ServiceImpl<SysLogMapper, SysLog> impleme
queryWrapper.eq(ObjectUtil.isNotEmpty(logId), SysLog::getLogId, logId);
queryWrapper.between(ObjectUtil.isAllNotEmpty(beginDate, endDate), SysLog::getCreateTime, beginDate, endDate);
queryWrapper.like(StrUtil.isNotEmpty(name), SysLog::getLogName, name);
queryWrapper.like(StrUtil.isNotEmpty(appName), SysLog::getAppName, appName);
queryWrapper.like(StrUtil.isNotEmpty(serverIp), SysLog::getServerIp, serverIp);
queryWrapper.eq(ObjectUtil.isNotNull(userId), SysLog::getUserId, userId);