fix: pcap 接口调整
This commit is contained in:
@@ -62,7 +62,6 @@ public class PcapController {
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public R add(@RequestParam(value = "files", required = true) List<MultipartFile> fileList,
|
||||
@RequestParam(value = "descriptions", required = false) List<String> descriptionList,
|
||||
@RequestParam(required = false) String workbookId,
|
||||
@RequestParam(required = false) String workspaceId) throws IOException {
|
||||
T.VerifyUtil.is(workspaceId).notEmpty(RCode.WORKSPACE_ID_CANNOT_EMPTY);
|
||||
|
||||
@@ -70,7 +69,7 @@ public class PcapController {
|
||||
for (int i = 0; i < fileList.size(); i++) {
|
||||
MultipartFile file = fileList.get(i);
|
||||
String description = T.StrUtil.emptyToDefault(T.CollUtil.get(descriptionList, i), "");
|
||||
PcapEntity pcapEntity = pcapService.savePcap(file.getResource(), description, workbookId, workspaceId);
|
||||
PcapEntity pcapEntity = pcapService.savePcap(file.getResource(), description, workspaceId);
|
||||
recordList.add(
|
||||
T.MapUtil.builder()
|
||||
.put("id", pcapEntity.getId())
|
||||
|
||||
@@ -124,8 +124,7 @@ public class PcapServiceImpl extends ServiceImpl<PcapDao, PcapEntity> implements
|
||||
@Override
|
||||
public PcapEntity savePcap(Resource fileResource, String... params) {
|
||||
String description = T.ArrayUtil.get(params, 0);
|
||||
String workbookId = T.ArrayUtil.get(params, 1);
|
||||
String workspaceId = T.ArrayUtil.get(params, 2);
|
||||
String workspaceId = T.ArrayUtil.get(params, 1);
|
||||
String createUserId = T.StrUtil.emptyToDefault(T.ArrayUtil.get(params, 3), StpUtil.getLoginIdAsString());
|
||||
|
||||
PcapEntity entity = new PcapEntity();
|
||||
@@ -162,9 +161,6 @@ public class PcapServiceImpl extends ServiceImpl<PcapDao, PcapEntity> implements
|
||||
|
||||
// save
|
||||
this.save(entity);
|
||||
|
||||
// workbook resource
|
||||
workbookResourceService.saveResource(workbookId, entity.getId(), WorkbookConstant.ResourceType.PCAP.getValue());
|
||||
} catch (IOException e) {
|
||||
log.error(e, "[savePcap] [error] [workspaceId: {}]", workspaceId);
|
||||
throw new ASWException(RCode.ERROR);
|
||||
|
||||
@@ -18,19 +18,14 @@
|
||||
|
||||
<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="name" column="name"/>
|
||||
<result property="version" column="version"/>
|
||||
</association>
|
||||
|
||||
<association property="runner" columnPrefix="run_" javaType="net.geedge.asw.module.runner.entity.RunnerEntity">
|
||||
<association property="environment" columnPrefix="em_" javaType="net.geedge.asw.module.environment.entity.EnvironmentEntity">
|
||||
<id property="id" column="id"/>
|
||||
<result property="name" column="name"/>
|
||||
</association>
|
||||
@@ -46,28 +41,22 @@
|
||||
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.identifier AS pkg_identifier,
|
||||
pkg.name AS pkg_name,
|
||||
|
||||
run.id AS run_id,
|
||||
run.name AS run_name,
|
||||
env.id AS em_id,
|
||||
env.name AS em_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 environment env ON job.env_id = env.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
|
||||
@@ -83,19 +72,14 @@
|
||||
<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 test="params.environmentIds != null and params.environmentIds != ''">
|
||||
AND env.id in
|
||||
<foreach item="id" collection="params.environmentIds.split(',')" separator="," open="(" close=")">#{id}</foreach>
|
||||
</if>
|
||||
|
||||
<if test="params.playbooks != null and params.playbooks != ''">
|
||||
@@ -103,10 +87,6 @@
|
||||
<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>
|
||||
|
||||
Reference in New Issue
Block a user