|
|
@@ -0,0 +1,42 @@
|
|
|
+package seecoder.devcloud.web.service.impl.pipeline;
|
|
|
+
|
|
|
+import org.springframework.beans.factory.annotation.Autowired;
|
|
|
+import org.springframework.stereotype.Service;
|
|
|
+import seecoder.devcloud.web.dao.pipeline.StageMapper;
|
|
|
+import seecoder.devcloud.web.model.po.pipeline.StageConfigPO;
|
|
|
+import seecoder.devcloud.web.model.po.pipeline.StagePO;
|
|
|
+import seecoder.devcloud.web.model.vo.pipeline.StageVO;
|
|
|
+import seecoder.devcloud.web.service.pipeline.StageService;
|
|
|
+
|
|
|
+import java.util.List;
|
|
|
+import java.util.stream.Collectors;
|
|
|
+
|
|
|
+/**
|
|
|
+ * @author PuHong Weng
|
|
|
+ * @date 2021/4/14
|
|
|
+ * @description:
|
|
|
+ */
|
|
|
+@Service
|
|
|
+public class StageServiceImpl implements StageService {
|
|
|
+
|
|
|
+ private final StageMapper stageMapper;
|
|
|
+
|
|
|
+ @Autowired
|
|
|
+ public StageServiceImpl(StageMapper stageMapper) {
|
|
|
+ this.stageMapper = stageMapper;
|
|
|
+ }
|
|
|
+
|
|
|
+ @Override
|
|
|
+ public List<StageVO> getAll() {
|
|
|
+ List<StagePO> stages = stageMapper.selectAllStages();
|
|
|
+ for (StagePO stage : stages){
|
|
|
+ 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());
|
|
|
+ }
|
|
|
+}
|