1. 修改TaskController中的setCommandJudged方式,现在它将直接修改t_command中的IS_JUDGED字段
2. queryCommandInfos方法现在添加了筛选条件以及分页查询
This commit is contained in:
@@ -8,7 +8,7 @@ import java.util.List;
|
||||
|
||||
@Mapper
|
||||
public interface CommandMapper {
|
||||
Boolean createCommand(@Param("info") TaskCommandInfo taskCommandInfo);
|
||||
void createCommand(@Param("info") TaskCommandInfo taskCommandInfo);
|
||||
|
||||
void createCommands(@Param("command_infos") List<TaskCommandInfo> taskCommandInfos);
|
||||
|
||||
@@ -18,10 +18,18 @@ public interface CommandMapper {
|
||||
|
||||
Boolean startCommandsByTaskId(@Param("task_id") Long taskId);
|
||||
|
||||
Boolean setCommandValid(@Param("command_id") String commandId,
|
||||
@Param("is_valid") Boolean isValid);
|
||||
Boolean setCommandJudged(@Param("command_id") String commandId,
|
||||
@Param("is_judged") Boolean isJudged);
|
||||
|
||||
List<TaskCommandInfo> queryCommandInfoByTaskId(@Param("task_id") Long taskId);
|
||||
List<TaskCommandInfo> queryCommandInfos(@Param("task_id") Long taskId,
|
||||
@Param("src_ip") String sourceIP,
|
||||
@Param("src_port") String sourcePort,
|
||||
@Param("dst_ip") String destinationIP,
|
||||
@Param("dst_port") String destinationPort,
|
||||
@Param("page") Integer page,
|
||||
@Param("page_num") Integer pageNum);
|
||||
|
||||
TaskCommandInfo queryCommandInfoByUUID(@Param("uuid") String uuid);
|
||||
|
||||
String queryCommandInfo(@Param("command_info") TaskCommandInfo commandInfo);
|
||||
}
|
||||
|
||||
@@ -28,6 +28,11 @@ public class CommandService {
|
||||
|
||||
@DSTransactional
|
||||
public String createCommand(TaskCommandInfo commandInfo) {
|
||||
String uuid = commandMapper.queryCommandInfo(commandInfo);
|
||||
if (uuid != null) {
|
||||
return uuid;
|
||||
}
|
||||
|
||||
commandInfo.setUUID(UUID.randomUUID().toString());
|
||||
commandMapper.createCommand(commandInfo);
|
||||
return commandInfo.getUUID();
|
||||
@@ -59,8 +64,14 @@ public class CommandService {
|
||||
sqlSessionWrapper.startBatchSession(CommandMapper.class, function, taskCommandInfos);
|
||||
}
|
||||
|
||||
public List<TaskCommandInfo> queryCommandInfoByTaskId(Long taskId) {
|
||||
return commandMapper.queryCommandInfoByTaskId(taskId);
|
||||
public List<TaskCommandInfo> queryCommandInfos(Long taskId,
|
||||
String sourceIP, String sourcePort,
|
||||
String destinationIP, String destinationPort,
|
||||
Integer page, Integer pageNum) {
|
||||
return commandMapper.queryCommandInfos(taskId,
|
||||
sourceIP, sourcePort,
|
||||
destinationIP, destinationPort,
|
||||
page, pageNum);
|
||||
}
|
||||
|
||||
public TaskCommandInfo queryCommandInfoByUUID(String uuid) {
|
||||
@@ -79,9 +90,7 @@ public class CommandService {
|
||||
return commandMapper.removeCommandsByTaskId(taskId);
|
||||
}
|
||||
|
||||
public Object setCommandValid(String commandId, Boolean isValid) {
|
||||
return commandMapper.setCommandValid(commandId, isValid);
|
||||
public Boolean setCommandJudged(String commandId, Boolean isValid) {
|
||||
return commandMapper.setCommandJudged(commandId, isValid);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user