fix: 禁用资源池检查资源占用
This commit is contained in:
parent
345b7c591f
commit
5fff7d81b1
|
@ -8,8 +8,6 @@ import java.util.List;
|
||||||
|
|
||||||
public interface ExtTaskMapper {
|
public interface ExtTaskMapper {
|
||||||
|
|
||||||
void deleteByResourceId(String id);
|
|
||||||
|
|
||||||
List<TaskCenterDTO> getTasks(@Param("request") TaskCenterRequest request);
|
List<TaskCenterDTO> getTasks(@Param("request") TaskCenterRequest request);
|
||||||
|
|
||||||
int getRunningTasks(@Param("request") TaskCenterRequest request);
|
int getRunningTasks(@Param("request") TaskCenterRequest request);
|
||||||
|
@ -18,6 +16,6 @@ public interface ExtTaskMapper {
|
||||||
|
|
||||||
List<TaskCenterDTO> getScenario(@Param("id") String id);
|
List<TaskCenterDTO> getScenario(@Param("id") String id);
|
||||||
|
|
||||||
int checkActuator (@Param("actuator") String actuator);
|
List<String> checkActuator (@Param("actuator") String actuator);
|
||||||
|
|
||||||
}
|
}
|
|
@ -89,25 +89,23 @@
|
||||||
)tt ORDER BY tt.executionTime DESC;
|
)tt ORDER BY tt.executionTime DESC;
|
||||||
</select>
|
</select>
|
||||||
|
|
||||||
<select id="checkActuator" resultType="java.lang.Integer" parameterType="java.lang.String">
|
<select id="checkActuator" resultType="java.lang.String" parameterType="java.lang.String">
|
||||||
SELECT
|
SELECT
|
||||||
sum( sum_actuator )
|
name
|
||||||
FROM
|
FROM
|
||||||
(
|
api_scenario_report
|
||||||
SELECT
|
WHERE
|
||||||
count( id ) AS sum_actuator
|
actuator =#{actuator}
|
||||||
FROM
|
|
||||||
api_scenario_report
|
|
||||||
WHERE
|
|
||||||
actuator =#{actuator}
|
|
||||||
AND `status` in ('Running','Waiting') UNION ALL
|
|
||||||
SELECT
|
|
||||||
count( id ) AS sum_actuator
|
|
||||||
FROM
|
|
||||||
api_definition_exec_result
|
|
||||||
WHERE
|
|
||||||
actuator = #{actuator}
|
|
||||||
AND `status` in ('Running','Waiting')
|
AND `status` in ('Running','Waiting')
|
||||||
) AS total
|
|
||||||
|
UNION ALL
|
||||||
|
|
||||||
|
SELECT
|
||||||
|
name
|
||||||
|
FROM
|
||||||
|
api_definition_exec_result
|
||||||
|
WHERE
|
||||||
|
actuator = #{actuator}
|
||||||
|
AND `status` in ('Running','Waiting')
|
||||||
</select>
|
</select>
|
||||||
</mapper>
|
</mapper>
|
|
@ -105,9 +105,6 @@ public class TestResourcePoolService {
|
||||||
testResourcePool.setStatus(status);
|
testResourcePool.setStatus(status);
|
||||||
// 禁用/删除 资源池
|
// 禁用/删除 资源池
|
||||||
if (INVALID.name().equals(status) || DELETE.name().equals(status)) {
|
if (INVALID.name().equals(status) || DELETE.name().equals(status)) {
|
||||||
if(extTaskMapper.checkActuator(testResourcePool.getId())>0){
|
|
||||||
MSException.throwException("当前资源池正在使用中不能删除");
|
|
||||||
}
|
|
||||||
testResourcePoolMapper.updateByPrimaryKeySelective(testResourcePool);
|
testResourcePoolMapper.updateByPrimaryKeySelective(testResourcePool);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -154,6 +151,9 @@ public class TestResourcePoolService {
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
// api
|
||||||
|
List<String> apiNames = extTaskMapper.checkActuator(testResourcePool.getId());
|
||||||
|
builder.append(StringUtils.join(apiNames, "; "));
|
||||||
result.setTestName(builder.toString());
|
result.setTestName(builder.toString());
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue