Selaa lähdekoodia

fix: 获取各条流水线最新构建信息错误

370774330@qq.com 5 vuotta sitten
vanhempi
commit
65a0da37f0

+ 9 - 7
web/src/main/java/cn/seecoder/web/dao/pipeline/PipelineHistoryMapper.java

@@ -34,14 +34,16 @@ public interface PipelineHistoryMapper {
      */
     @Select("<script>" +
             "SELECT * " +
-            " FROM   pipeline_history " +
-            " WHERE  start_time = " +
-            "(  SELECT MAX(start_time) " +
-            "   FROM pipeline_history" +
-            "   WHERE pipeline_id in" +
+            " FROM   pipeline_history, " +
+            "(  SELECT pipeline_id, MAX(start_time) start_time" +
+            "   FROM pipeline_history " +
+            "   WHERE pipeline_id in " +
             "   <foreach collection='pipelineIds' open='(' item='pipelineId' separator=',' close=')'> #{pipelineId}</foreach>" +
-            "   )" +
+            "   GROUP BY pipeline_id " +
+            ") histories " +
+            " WHERE histories.pipeline_id = pipeline_history.pipeline_id " +
+            "  AND histories.start_time = pipeline_history.start_time " +
             "</script>")
-    List<PipelineHistoryPO> selectPipelinesRecentlyHistory(@Param("pipelineIds") List<Integer> pipelineIds);
+    List<PipelineHistoryPO> selectPipelinesLatestHistories(@Param("pipelineIds") List<Integer> pipelineIds);
 
 }