feat: 主机连接日志.

This commit is contained in:
lijiahang
2023-12-27 12:31:18 +08:00
parent 459002f666
commit 6fdd29b3fe
18 changed files with 147 additions and 97 deletions

View File

@@ -11,8 +11,10 @@ Authorization: {{token}}
"type": "",
"token": "",
"status": "",
"startTimeStart": "",
"endTimeEnd": ""
"startTimeRange": [
"",
""
]
}

View File

@@ -36,6 +36,10 @@ public class HostConnectLogDO extends BaseDO {
@TableField("user_id")
private Long userId;
@Schema(description = "用户名")
@TableField("username")
private String username;
@Schema(description = "主机id")
@TableField("host_id")
private Long hostId;

View File

@@ -24,9 +24,18 @@ public class HostConnectLogCreateRequest extends PageRequest {
@Schema(description = "用户id")
private Long userId;
@Schema(description = "用户名")
private String username;
@Schema(description = "主机id")
private Long hostId;
@Schema(description = "主机名称")
private String hostName;
@Schema(description = "主机地址")
private String hostAddress;
@Size(max = 128)
@Schema(description = "token")
private String token;

View File

@@ -45,12 +45,8 @@ public class HostConnectLogQueryRequest extends PageRequest {
@Schema(description = "状态")
private String status;
@Schema(description = "开始时间-区间")
@Schema(description = "开始时间-区间")
@JsonFormat(shape = JsonFormat.Shape.STRING, pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
private Date startTimeStart;
@Schema(description = "开始时间-闭区间")
@JsonFormat(shape = JsonFormat.Shape.STRING, pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
private Date startTimeEnd;
private Date[] startTimeRange;
}

View File

@@ -31,6 +31,9 @@ public class HostConnectLogVO implements Serializable {
@Schema(description = "用户id")
private Long userId;
@Schema(description = "用户名")
private String username;
@Schema(description = "主机id")
private Long hostId;

View File

@@ -2,6 +2,7 @@ package com.orion.ops.module.asset.service.impl;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.orion.lang.define.wrapper.DataGrid;
import com.orion.lang.utils.Arrays1;
import com.orion.ops.framework.mybatis.core.query.Conditions;
import com.orion.ops.module.asset.convert.HostConnectLogConvert;
import com.orion.ops.module.asset.dao.HostConnectLogDAO;
@@ -74,8 +75,8 @@ public class HostConnectLogServiceImpl implements HostConnectLogService {
.eq(HostConnectLogDO::getType, request.getType())
.like(HostConnectLogDO::getToken, request.getToken())
.eq(HostConnectLogDO::getStatus, request.getStatus())
.ge(HostConnectLogDO::getStartTime, request.getStartTimeStart())
.le(HostConnectLogDO::getStartTime, request.getStartTimeEnd());
.ge(HostConnectLogDO::getStartTime, Arrays1.getIfPresent(request.getStartTimeRange(), 0))
.le(HostConnectLogDO::getStartTime, Arrays1.getIfPresent(request.getStartTimeRange(), 1));
}
}

View File

@@ -6,6 +6,7 @@
<resultMap id="BaseResultMap" type="com.orion.ops.module.asset.entity.domain.HostConnectLogDO">
<id column="id" property="id"/>
<result column="user_id" property="userId"/>
<result column="username" property="username"/>
<result column="host_id" property="hostId"/>
<result column="host_name" property="hostName"/>
<result column="host_address" property="hostAddress"/>
@@ -22,7 +23,7 @@
<!-- 通用查询结果列 -->
<sql id="Base_Column_List">
id, user_id, host_id, host_name, host_address, type, token, status, start_time, end_time, extra_info, create_time, update_time, deleted
id, user_id, username, host_id, host_name, host_address, type, token, status, start_time, end_time, extra_info, create_time, update_time, deleted
</sql>
</mapper>