|
@@ -9,6 +9,7 @@ import seecoder.devcloud.web.model.vo.pipeline.StageVO;
|
|
|
import seecoder.devcloud.web.service.pipeline.StageService;
|
|
import seecoder.devcloud.web.service.pipeline.StageService;
|
|
|
|
|
|
|
|
import java.util.List;
|
|
import java.util.List;
|
|
|
|
|
+import java.util.Map;
|
|
|
import java.util.stream.Collectors;
|
|
import java.util.stream.Collectors;
|
|
|
|
|
|
|
|
/**
|
|
/**
|
|
@@ -29,14 +30,12 @@ public class StageServiceImpl implements StageService {
|
|
|
@Override
|
|
@Override
|
|
|
public List<StageVO> getAll() {
|
|
public List<StageVO> getAll() {
|
|
|
List<StagePO> stages = stageMapper.selectAllStages();
|
|
List<StagePO> stages = stageMapper.selectAllStages();
|
|
|
- for (StagePO stage : stages){
|
|
|
|
|
|
|
+ return stages.stream().map(stage -> {
|
|
|
List<StageConfigPO> pos = stageMapper.selectConfigs(stage.getId());
|
|
List<StageConfigPO> pos = stageMapper.selectConfigs(stage.getId());
|
|
|
- if (pos.size() == 0){
|
|
|
|
|
- continue;
|
|
|
|
|
- }
|
|
|
|
|
- stage.setFakeConfigs(pos.stream().filter(StageConfigPO::getFake).collect(Collectors.toMap(StageConfigPO::getName, StageConfigPO::getValue)));
|
|
|
|
|
- stage.setConfigs(pos.stream().filter(x->!x.getFake()).collect(Collectors.toMap(StageConfigPO::getName, StageConfigPO::getValue)));
|
|
|
|
|
- }
|
|
|
|
|
- return stages.stream().map(x->new StageVO(x)).collect(Collectors.toList());
|
|
|
|
|
|
|
+ Map<String,String> fakeConfigs = pos.stream().filter(StageConfigPO::getFake).collect(Collectors.toMap(StageConfigPO::getName, StageConfigPO::getValue));
|
|
|
|
|
+ Map<String,String> configs = pos.stream().filter(x->!x.getFake()).collect(Collectors.toMap(StageConfigPO::getName, StageConfigPO::getValue));
|
|
|
|
|
+ return new StageVO(stage,fakeConfigs,configs);
|
|
|
|
|
+ }).collect(Collectors.toList());
|
|
|
|
|
+
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|