feat: 调整 pcap 增删改查接口

This commit is contained in:
shizhendong
2024-07-30 13:53:59 +08:00
parent 4f8084eaf8
commit 4a2d7f9adf
14 changed files with 90 additions and 117 deletions

View File

@@ -6,16 +6,10 @@
<resultMap type="net.geedge.asw.module.runner.entity.PcapEntity" id="pcapResultMap">
<id property="id" column="id"/>
<result property="name" column="name"/>
<result property="tags" column="tags"/>
<result property="description" column="description"/>
<result property="path" column="path"/>
<result property="size" column="size"/>
<result property="connections" column="connections"/>
<result property="hosts" column="hosts"/>
<result property="md5" column="md5"/>
<result property="connectionTimeFirst" column="connection_time_first"/>
<result property="connectionTimeLast" column="connection_time_last"/>
<result property="protocols" column="protocols"/>
<result property="status" column="status"/>
<result property="createTimestamp" column="create_timestamp"/>
<result property="createUserId" column="create_user_id"/>
@@ -81,6 +75,10 @@
<foreach item="id" collection="params.ids.split(',')" separator="," open="(" close=")">#{id}</foreach>
</if>
<if test="params.q != null and params.q != ''">
AND ( locate(#{params.q}, pcap.name) OR locate(#{params.q}, pcap.description) )
</if>
<if test="params.jobIds != null and params.jobIds != ''">
AND job.id in
<foreach item="id" collection="params.jobIds.split(',')" separator="," open="(" close=")">#{id}</foreach>

View File

@@ -217,16 +217,10 @@ DROP TABLE IF EXISTS `pcap`;
CREATE TABLE `pcap` (
`id` varchar(64) NOT NULL COMMENT '主键',
`name` varchar(256) NOT NULL DEFAULT '' COMMENT '文件名称',
`tags` varchar(256) NOT NULL DEFAULT '' COMMENT '标签',
`description` text NOT NULL DEFAULT '' COMMENT '描述信息',
`path` varchar(64) NOT NULL DEFAULT '' COMMENT 'PCAP文件路径',
`size` bigint(20) NOT NULL DEFAULT 0 COMMENT '文件大小',
`connections` bigint(20) NOT NULL DEFAULT 0 COMMENT '连接数量',
`hosts` bigint(20) NOT NULL DEFAULT 0 COMMENT 'IP数量',
`md5` varchar(64) NOT NULL DEFAULT '' COMMENT '摘要值,根据文件md5值判断是否已上存在存在则响应当前id',
`connection_time_first` bigint(20) NOT NULL DEFAULT -1 COMMENT '连接开始时间',
`connection_time_last` bigint(20) NOT NULL DEFAULT -1 COMMENT '连接结束时间',
`protocols` varchar(64) NOT NULL DEFAULT '' COMMENT '包含的协议,多个逗号分隔',
`status` varchar(64) NOT NULL DEFAULT '' COMMENT '状态,可选值 UploadedAnalyzingCompleted',
`create_timestamp` bigint(20) NOT NULL COMMENT '创建时间戳',
`create_user_id` varchar(64) NOT NULL COMMENT '创建人',
@@ -234,23 +228,6 @@ CREATE TABLE `pcap` (
PRIMARY KEY (`id`) USING BTREE,
KEY `idx_name` (`name`) USING BTREE,
KEY `idx_md5` (`md5`) USING BTREE,
KEY `idx_tags` (`tags`) USING BTREE,
KEY `idx_workspace_id` (`workspace_id`) USING BTREE
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
/**
* 新增 decode_record 表
*/
DROP TABLE IF EXISTS `decode_record`;
CREATE TABLE `decode_record` (
`id` varchar(64) NOT NULL COMMENT '主键',
`pcap_id` varchar(64) NOT NULL DEFAULT '' COMMENT 'PCAP文件ID',
`stream_id` bigint(20) NOT NULL DEFAULT 0 COMMENT '流ID',
`stream_attributes` text NOT NULL DEFAULT '' COMMENT '流属性',
`workspace_id` varchar(64) NOT NULL DEFAULT '' COMMENT '工作空间ID',
PRIMARY KEY (`id`) USING BTREE,
KEY `idx_pcap_id` (`pcap_id`) USING BTREE,
KEY `idx_stream_id` (`stream_id`) USING BTREE,
KEY `idx_workspace_id` (`workspace_id`) USING BTREE
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
@@ -359,7 +336,7 @@ DROP TABLE IF EXISTS `workbook_resource`;
CREATE TABLE `workbook_resource` (
`id` varchar(64) NOT NULL COMMENT '主键',
`workbook_id` varchar(64) NOT NULL COMMENT 'workbook ID',
`resource_type` varchar(64) NOT NULL COMMENT '资源类型 可选值package,signature,job,pcap,decode_record',
`resource_type` varchar(64) NOT NULL COMMENT '资源类型 可选值package,signature,job,pcap',
`resource_id` varchar(64) NOT NULL COMMENT '资源id',
PRIMARY KEY (`id`) USING BTREE
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;