feat: ASW-10 新增 pcap 相关接口
This commit is contained in:
@@ -5,7 +5,6 @@
|
||||
|
||||
<resultMap type="net.geedge.asw.module.runner.entity.JobEntity" id="jobResultMap">
|
||||
<id property="id" column="id"/>
|
||||
<result property="id" column="id"/>
|
||||
<result property="playbookId" column="playbook_id"/>
|
||||
<result property="packageId" column="package_id"/>
|
||||
<result property="runnerId" column="runner_id"/>
|
||||
|
||||
126
src/main/resources/db/mapper/runner/PcapMapper.xml
Normal file
126
src/main/resources/db/mapper/runner/PcapMapper.xml
Normal file
@@ -0,0 +1,126 @@
|
||||
<?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="net.geedge.asw.module.runner.dao.PcapDao">
|
||||
|
||||
<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"/>
|
||||
<result property="workspaceId" column="workspace_id"/>
|
||||
|
||||
<result property="jobId" column="jobId"/>
|
||||
|
||||
<association property="application" columnPrefix="app_" javaType="net.geedge.asw.module.app.entity.ApplicationEntity">
|
||||
<id property="id" column="id"/>
|
||||
<result property="name" column="name"/>
|
||||
</association>
|
||||
|
||||
<association property="pkg" columnPrefix="pkg_" javaType="net.geedge.asw.module.app.entity.PackageEntity">
|
||||
<id property="id" column="id"/>
|
||||
<result property="platform" column="platform"/>
|
||||
<result property="identifier" column="identifier"/>
|
||||
<result property="version" column="version"/>
|
||||
<result property="logo" column="logo"/>
|
||||
</association>
|
||||
|
||||
<association property="runner" columnPrefix="run_" javaType="net.geedge.asw.module.runner.entity.RunnerEntity">
|
||||
<id property="id" column="id"/>
|
||||
<result property="name" column="name"/>
|
||||
</association>
|
||||
|
||||
<association property="playbook" columnPrefix="pb_" javaType="net.geedge.asw.module.runner.entity.PlaybookEntity">
|
||||
<id property="id" column="id"/>
|
||||
<result property="name" column="name"/>
|
||||
</association>
|
||||
|
||||
</resultMap>
|
||||
|
||||
<select id="queryList" resultMap="pcapResultMap">
|
||||
SELECT
|
||||
pcap.*,
|
||||
job.id AS jobId,
|
||||
|
||||
app.id AS app_id,
|
||||
app.name AS app_name,
|
||||
|
||||
pkg.id AS pkg_id,
|
||||
pkg.platform AS pkg_platform,
|
||||
pkg.version AS pkg_version,
|
||||
pkg.logo AS pkg_logo,
|
||||
pkg.identifier AS pkg_identifier,
|
||||
|
||||
run.id AS run_id,
|
||||
run.name AS run_name,
|
||||
|
||||
pb.id AS pb_id,
|
||||
pb.name AS pb_name
|
||||
FROM
|
||||
pcap pcap
|
||||
left join job job on pcap.id = job.pcap_id
|
||||
LEFT JOIN runner run ON job.runner_id = run.id
|
||||
LEFT JOIN package pkg ON job.package_id = pkg.id
|
||||
LEFT JOIN playbook pb ON job.playbook_id = pb.id
|
||||
LEFT JOIN application app ON pb.app_id = app.id
|
||||
LEFT JOIN workbook_resource wr ON pcap.id = wr.resource_id AND wr.resource_type = 'pcap'
|
||||
<where>
|
||||
<if test="params.ids != null and params.ids != ''">
|
||||
pcap.id in
|
||||
<foreach item="id" collection="params.ids.split(',')" separator="," open="(" close=")">#{id}</foreach>
|
||||
</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>
|
||||
</if>
|
||||
|
||||
<if test="params.appIds != null and params.appIds != ''">
|
||||
AND app.id in
|
||||
<foreach item="id" collection="params.appIds.split(',')" separator="," open="(" close=")">#{id}</foreach>
|
||||
</if>
|
||||
|
||||
<if test="params.packageIds != null and params.packageIds != ''">
|
||||
AND pkg.id in
|
||||
<foreach item="id" collection="params.packageIds.split(',')" separator="," open="(" close=")">#{id}</foreach>
|
||||
</if>
|
||||
|
||||
<if test="params.runnerIds != null and params.runnerIds != ''">
|
||||
AND run.id in
|
||||
<foreach item="id" collection="params.runnerIds.split(',')" separator="," open="(" close=")">#{id}</foreach>
|
||||
</if>
|
||||
|
||||
<if test="params.playbooks != null and params.playbooks != ''">
|
||||
AND pb.id in
|
||||
<foreach item="id" collection="params.playbooks.split(',')" separator="," open="(" close=")">#{id}</foreach>
|
||||
</if>
|
||||
|
||||
<if test="params.workbookId != null and params.workbookId != ''">
|
||||
AND wr.workbook_id = #{params.workbookId}
|
||||
</if>
|
||||
|
||||
<if test="params.workspaceId != null and params.workspaceId != ''">
|
||||
AND pcap.workspace_id = #{params.workspaceId}
|
||||
</if>
|
||||
</where>
|
||||
|
||||
GROUP BY
|
||||
pcap.id
|
||||
|
||||
<if test="params.orderBy == null or params.orderBy == ''">
|
||||
ORDER BY pcap.id
|
||||
</if>
|
||||
</select>
|
||||
|
||||
</mapper>
|
||||
Reference in New Issue
Block a user