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

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

View File

@ -22,9 +22,12 @@ public interface ExtApiDefinitionExecResultMapper {
List<ExecutedCaseInfoResult> findFaliureCaseInfoByProjectIDAndExecuteTimeAndLimitNumber(@Param("projectId") String projectId, @Param("startTimestamp") long startTimestamp); List<ExecutedCaseInfoResult> findFaliureCaseInfoByProjectIDAndExecuteTimeAndLimitNumber(@Param("projectId") String projectId, @Param("startTimestamp") long startTimestamp);
String selectExecResult(String resourceId); String selectExecResult(String resourceId);
ApiDefinitionExecResult selectPlanApiMaxResultByTestIdAndType(String resourceId, String type); 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"> <!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"> <mapper namespace="io.metersphere.base.mapper.ext.ExtApiDefinitionExecResultMapper">
<delete id="deleteByResourceId" parameterType="java.lang.String"> <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> </delete>
<select id="selectMaxResultByResourceId" parameterType="java.lang.String" resultType="io.metersphere.base.domain.ApiDefinitionExecResult"> <select id="selectMaxResultByResourceId" parameterType="java.lang.String" resultType="io.metersphere.base.domain.ApiDefinitionExecResult">
@ -95,11 +96,25 @@
<select id="selectStatusByIdList" <select id="selectStatusByIdList"
resultType="io.metersphere.base.domain.ApiDefinitionExecResult"> resultType="io.metersphere.base.domain.ApiDefinitionExecResult">
select id,status from api_definition_exec_result select id,status from api_definition_exec_result
where id in where id in
<foreach collection="ids" item="v" separator="," open="(" close=")"> <foreach collection="ids" item="v" separator="," open="(" close=")">
#{v} #{v}
</foreach> </foreach>
</select> </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> </mapper>

View File

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