This commit is contained in:
weiz 2024-02-27 11:53:31 +08:00
parent 557ddadcac
commit 4a7126bf57

View File

@ -185,6 +185,16 @@ class SupervisionInspectionLogic extends BaseLogic
*/
public static function delete(array $params): bool
{
$inspection_result = SupervisionInspectionResult::where('inspection_id',$params['id'])->findOrEmpty();
if(!$inspection_result->isEmpty()){
self::setError('该巡视内容下存在巡视结果数据,请先删除巡视结果数据');
return false;
}
$inspection_problem = SupervisionInspectionProblem::where('inspection_id',$params['id'])->findOrEmpty();
if(!$inspection_problem->isEmpty()){
self::setError('该巡视内容下存在巡视问题数据,请先删除巡视问题数据');
return false;
}
return SupervisionInspection::destroy($params['id']);
}