parent
4aca52bfb1
commit
d2ac70b4c4
|
@ -32,7 +32,4 @@ public interface TestPlanReportMapper {
|
||||||
int updateByPrimaryKeySelective(TestPlanReport record);
|
int updateByPrimaryKeySelective(TestPlanReport record);
|
||||||
|
|
||||||
int updateByPrimaryKey(TestPlanReport record);
|
int updateByPrimaryKey(TestPlanReport record);
|
||||||
|
|
||||||
@MapKey("id")
|
|
||||||
Map<String, ParamsDTO> reportCount(@Param("planIds") Set<String> planIds);
|
|
||||||
}
|
}
|
|
@ -235,18 +235,7 @@
|
||||||
<include refid="Example_Where_Clause" />
|
<include refid="Example_Where_Clause" />
|
||||||
</if>
|
</if>
|
||||||
</select>
|
</select>
|
||||||
<select id="reportCount" resultType="io.metersphere.api.dto.definition.ParamsDTO">
|
|
||||||
select t.test_plan_id as id , count(*) from test_plan_report t
|
|
||||||
<where>
|
|
||||||
<if test="planIds != null and planIds.size() > 0">
|
|
||||||
and t.test_plan_id IN
|
|
||||||
<foreach collection="planIds" item="id" separator="," open="(" close=")">
|
|
||||||
#{id}
|
|
||||||
</foreach>
|
|
||||||
</if>
|
|
||||||
</where>
|
|
||||||
GROUP BY t.test_plan_id
|
|
||||||
</select>
|
|
||||||
<update id="updateByExampleSelective" parameterType="map">
|
<update id="updateByExampleSelective" parameterType="map">
|
||||||
update test_plan_report
|
update test_plan_report
|
||||||
<set>
|
<set>
|
||||||
|
|
|
@ -1,12 +1,14 @@
|
||||||
package io.metersphere.base.mapper.ext;
|
package io.metersphere.base.mapper.ext;
|
||||||
|
|
||||||
import io.metersphere.base.domain.TestPlanReport;
|
import io.metersphere.api.dto.definition.ParamsDTO;
|
||||||
import io.metersphere.track.dto.TestPlanReportDTO;
|
import io.metersphere.track.dto.TestPlanReportDTO;
|
||||||
import io.metersphere.track.request.report.QueryTestPlanReportRequest;
|
import io.metersphere.track.request.report.QueryTestPlanReportRequest;
|
||||||
import org.apache.ibatis.annotations.InsertProvider;
|
import org.apache.ibatis.annotations.MapKey;
|
||||||
import org.springframework.data.repository.query.Param;
|
import org.springframework.data.repository.query.Param;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
import java.util.Map;
|
||||||
|
import java.util.Set;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @author song.tianyang
|
* @author song.tianyang
|
||||||
|
@ -15,4 +17,7 @@ import java.util.List;
|
||||||
*/
|
*/
|
||||||
public interface ExtTestPlanReportMapper {
|
public interface ExtTestPlanReportMapper {
|
||||||
List<TestPlanReportDTO> list(@Param("request")QueryTestPlanReportRequest request);
|
List<TestPlanReportDTO> list(@Param("request")QueryTestPlanReportRequest request);
|
||||||
|
|
||||||
|
@MapKey("id")
|
||||||
|
Map<String, ParamsDTO> reportCount(@Param("planIds") Set<String> planIds);
|
||||||
}
|
}
|
||||||
|
|
|
@ -140,4 +140,17 @@
|
||||||
</foreach>
|
</foreach>
|
||||||
</if>
|
</if>
|
||||||
</select>
|
</select>
|
||||||
|
|
||||||
|
<select id="reportCount" resultType="io.metersphere.api.dto.definition.ParamsDTO">
|
||||||
|
select t.test_plan_id as id , count(*) from test_plan_report t
|
||||||
|
<where>
|
||||||
|
<if test="planIds != null and planIds.size() > 0">
|
||||||
|
and t.test_plan_id IN
|
||||||
|
<foreach collection="planIds" item="id" separator="," open="(" close=")">
|
||||||
|
#{id}
|
||||||
|
</foreach>
|
||||||
|
</if>
|
||||||
|
</where>
|
||||||
|
GROUP BY t.test_plan_id
|
||||||
|
</select>
|
||||||
</mapper>
|
</mapper>
|
||||||
|
|
|
@ -147,7 +147,7 @@ public class TestPlanService {
|
||||||
@Resource
|
@Resource
|
||||||
private TestCaseTestMapper testCaseTestMapper;
|
private TestCaseTestMapper testCaseTestMapper;
|
||||||
@Resource
|
@Resource
|
||||||
private TestPlanReportMapper testPlanReportMapper;
|
private ExtTestPlanReportMapper extTestPlanReportMapper;
|
||||||
@Resource
|
@Resource
|
||||||
private TestPlanReportService testPlanReportService;
|
private TestPlanReportService testPlanReportService;
|
||||||
@Lazy
|
@Lazy
|
||||||
|
@ -438,7 +438,7 @@ public class TestPlanService {
|
||||||
ArrayList<String> idList = new ArrayList<>(ids);
|
ArrayList<String> idList = new ArrayList<>(ids);
|
||||||
List<Schedule> scheduleByResourceIds = scheduleService.getScheduleByResourceIds(idList, ScheduleGroup.TEST_PLAN_TEST.name());
|
List<Schedule> scheduleByResourceIds = scheduleService.getScheduleByResourceIds(idList, ScheduleGroup.TEST_PLAN_TEST.name());
|
||||||
Map<String, Schedule> scheduleMap = scheduleByResourceIds.stream().collect(Collectors.toMap(Schedule::getResourceId, Schedule -> Schedule));
|
Map<String, Schedule> scheduleMap = scheduleByResourceIds.stream().collect(Collectors.toMap(Schedule::getResourceId, Schedule -> Schedule));
|
||||||
Map<String, ParamsDTO> stringParamsDTOMap = testPlanReportMapper.reportCount(ids);
|
Map<String, ParamsDTO> stringParamsDTOMap = extTestPlanReportMapper.reportCount(ids);
|
||||||
|
|
||||||
testPlans.forEach(item -> {
|
testPlans.forEach(item -> {
|
||||||
item.setExecutionTimes(stringParamsDTOMap.get(item.getId()) == null ? 0 : Integer.parseInt(stringParamsDTOMap.get(item.getId()).getValue() == null ? "0" : stringParamsDTOMap.get(item.getId()).getValue()));
|
item.setExecutionTimes(stringParamsDTOMap.get(item.getId()) == null ? 0 : Integer.parseInt(stringParamsDTOMap.get(item.getId()).getValue() == null ? "0" : stringParamsDTOMap.get(item.getId()).getValue()));
|
||||||
|
|
Loading…
Reference in New Issue