工作流列表页增加版本信息

This commit is contained in:
zhuangdashia 2025-06-19 14:26:57 +08:00
parent 13d17d3ccf
commit d162992167
3 changed files with 20 additions and 2 deletions

View File

@ -72,6 +72,13 @@ public class WorkflowController {
return workflowService.getWorkflowHistoryDetail(id,version); return workflowService.getWorkflowHistoryDetail(id,version);
} }
@GetMapping("/history/del/{id}")
@LoginRequired(role = RoleEnum.USER)
public Boolean deleteById(@PathVariable("id") Long id, @RequestParam("version") String version) {
return workflowService.deleteHistoryById(id,version);
}
@PutMapping @PutMapping
@LoginRequired(role = RoleEnum.USER) @LoginRequired(role = RoleEnum.USER)
public Boolean updateWorkflow(@RequestBody @Validated WorkflowRequestVO workflowRequestVO) { public Boolean updateWorkflow(@RequestBody @Validated WorkflowRequestVO workflowRequestVO) {

View File

@ -47,4 +47,6 @@ public interface WorkflowService {
List<WorkflowHistory> getWorkflowHistory(Long id); List<WorkflowHistory> getWorkflowHistory(Long id);
WorkflowDetailResponseVO getWorkflowHistoryDetail(Long id, String version); WorkflowDetailResponseVO getWorkflowHistoryDetail(Long id, String version);
Boolean deleteHistoryById(Long id, String version);
} }

View File

@ -60,6 +60,7 @@ import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional; import org.springframework.transaction.annotation.Transactional;
import org.springframework.validation.annotation.Validated; import org.springframework.validation.annotation.Validated;
import java.time.LocalDateTime;
import java.util.*; import java.util.*;
import java.util.concurrent.LinkedBlockingDeque; import java.util.concurrent.LinkedBlockingDeque;
import java.util.stream.Collectors; import java.util.stream.Collectors;
@ -247,7 +248,7 @@ public class WorkflowServiceImpl implements WorkflowService {
WorkflowHistory history = new WorkflowHistory(); WorkflowHistory history = new WorkflowHistory();
Workflow workflow1 = workflowMapper.selectById(workflow.getId()); Workflow workflow1 = workflowMapper.selectById(workflow.getId());
BeanUtils.copyProperties(workflow1, history); BeanUtils.copyProperties(workflow1, history);
history.setCreateDt(LocalDateTime.now());
Assert.isTrue(1 == workflowHistoryMapper.insert(history), () -> new SnailJobServerException("Failed to save workflowHistory graph")); Assert.isTrue(1 == workflowHistoryMapper.insert(history), () -> new SnailJobServerException("Failed to save workflowHistory graph"));
return Boolean.TRUE; return Boolean.TRUE;
@ -397,7 +398,7 @@ public class WorkflowServiceImpl implements WorkflowService {
@Override @Override
public List<WorkflowHistory> getWorkflowHistory(Long id) { public List<WorkflowHistory> getWorkflowHistory(Long id) {
return workflowHistoryMapper.selectList(new LambdaQueryWrapper<WorkflowHistory>().eq(WorkflowHistory::getId, id)); return workflowHistoryMapper.selectList(new LambdaQueryWrapper<WorkflowHistory>().eq(WorkflowHistory::getId, id).orderByDesc(WorkflowHistory::getCreateDt));
} }
@Override @Override
@ -416,6 +417,14 @@ public class WorkflowServiceImpl implements WorkflowService {
return doGetWorkflowDetail(workflow); return doGetWorkflowDetail(workflow);
} }
@Override
public Boolean deleteHistoryById(Long id, String version) {
return workflowHistoryMapper.delete(new LambdaQueryWrapper<WorkflowHistory>()
.eq(WorkflowHistory::getId, id)
.eq(WorkflowHistory::getVersion, version)) > 0;
}
private void batchSaveWorkflowTask(final List<WorkflowRequestVO> workflowRequestVOList, final String namespaceId) { private void batchSaveWorkflowTask(final List<WorkflowRequestVO> workflowRequestVOList, final String namespaceId) {
Set<String> groupNameSet = StreamUtils.toSet(workflowRequestVOList, WorkflowRequestVO::getGroupName); Set<String> groupNameSet = StreamUtils.toSet(workflowRequestVOList, WorkflowRequestVO::getGroupName);