fix(任务中心): 缺少sql报错

This commit is contained in:
wxg0103 2021-11-22 13:55:07 +08:00 committed by 刘瑞斌
parent 8984a98ce8
commit f8c193d297
3 changed files with 24 additions and 4 deletions

View File

@ -26,5 +26,8 @@ public interface ExtApiDefinitionExecResultMapper {
ApiDefinitionExecResult selectPlanApiMaxResultByTestIdAndType(String resourceId, String type);
List<ApiDefinitionExecResult> selectStatusByIdList(@Param("ids")Collection<String> values);
List<ApiDefinitionExecResult> selectStatusByIdList(@Param("ids") Collection<String> values);
List<ApiDefinitionExecResult> selectApiResultByProjectId(String projectId);
}

View File

@ -2,7 +2,8 @@
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="io.metersphere.base.mapper.ext.ExtApiDefinitionExecResultMapper">
<delete id="deleteByResourceId" parameterType="java.lang.String">
delete from api_definition_exec_result where resource_id = #{id,jdbcType=VARCHAR}
delete
from api_definition_exec_result where resource_id = #{id,jdbcType=VARCHAR}
</delete>
<select id="selectMaxResultByResourceId" parameterType="java.lang.String" resultType="io.metersphere.base.domain.ApiDefinitionExecResult">
@ -102,4 +103,18 @@
</foreach>
</select>
<select id="selectApiResultByProjectId" resultType="io.metersphere.base.domain.ApiDefinitionExecResult">
select *
from api_definition_exec_result t
left join `user` t1 ON t.user_id = t1.id
left join test_resource_pool t2 on t.actuator = t2.id
left join api_definition t3 on t.resource_id = t3.id
left join api_test_case t4 on t4.id = t.resource_id
left join test_plan_api_case t5 on t.resource_id = t5.id
left join test_plan t6 on t5.test_plan_id = t6.id
where to_days(FROM_UNIXTIME(t.create_time / 1000)) = to_days(now())
and (t3.project_id = #{projectId} OR t4.project_id = #{projectId} OR t6.project_id = #{projectId})
and t.`STATUS` in ('running', 'waiting')
</select>
</mapper>

View File

@ -32,4 +32,6 @@ public interface ExtApiScenarioReportMapper {
List<ApiReportCountDTO> countByApiScenarioId();
List<ApiScenarioReport> selectStatusByIds(@Param("ids") Collection<String> values);
List<ApiScenarioReport> selectReportByProjectId(String projectId);
}