root 2 years ago
parent
commit
a37d3cdb6b

+ 1 - 2
simulation-resource-scheduler/src/main/java/com/css/simulation/resource/scheduler/mapper/VehicleMapper.java

@@ -55,7 +55,6 @@ public interface VehicleMapper {
             "from model_vehicle\n" +
             "where id = (select vehicle_id\n" +
             "            from model_config\n" +
-            "            where id = #{vehicleConfigId}\n" +
-            ")")
+            "            where id = #{vehicleConfigId})")
     String selectParPathByVehicleConfigId(@Param("vehicleConfigId") String vehicleConfigId);
 }

+ 3 - 6
simulation-resource-server/src/main/java/com/css/simulation/resource/model/mapper/ModelVehicleMapper.java

@@ -4,15 +4,12 @@ import org.apache.ibatis.annotations.Mapper;
 import org.apache.ibatis.annotations.Param;
 import org.apache.ibatis.annotations.Select;
 
-import java.util.List;
-
 @Mapper
 public interface ModelVehicleMapper {
     @Select("select is_deleted\n" +
             "from model_vehicle\n" +
-            "where id in (select vehicle_id\n" +
+            "where id = (select vehicle_id\n" +
             "             from model_config\n" +
-            "             where id = #{configId}\n" +
-            ")")
-    List<String> selectIsDeletedByConfigId(@Param("configId") String configId);
+            "             where id = #{configId})")
+    String selectIsDeletedByConfigId(@Param("configId") String configId);
 }

+ 3 - 5
simulation-resource-server/src/main/java/com/css/simulation/resource/util/ProjectUtil.java

@@ -4,7 +4,6 @@ import api.common.pojo.constants.DictConstants;
 import api.common.pojo.param.project.SimulationManualProjectParam;
 import api.common.pojo.po.project.SchedulerProjectPO;
 import api.common.pojo.po.project.SimulationManualProjectPo;
-import api.common.util.CollectionUtil;
 import api.common.util.StringUtil;
 import com.css.simulation.resource.algorithm.mapper.AlgorithmMapper;
 import com.css.simulation.resource.model.mapper.ModelConfigMapper;
@@ -19,7 +18,6 @@ import lombok.extern.slf4j.Slf4j;
 import org.springframework.stereotype.Component;
 
 import javax.annotation.Resource;
-import java.util.List;
 
 @Component
 @Slf4j
@@ -94,9 +92,9 @@ public class ProjectUtil {
             throw new RuntimeException("项目所使用的车辆配置已被删除。");
         }
         //3 查询车辆配置中是否存在车辆模型。
-        final List<String> vehicles = modelVehicleMapper.selectIsDeletedByConfigId(scenePackageId);
-        if (CollectionUtil.isNotEmpty(vehicles)) {
-            throw new RuntimeException("项目所使用的车辆配置不存在动力学配置。");
+        final String vehicleIsDeleted = modelVehicleMapper.selectIsDeletedByConfigId(scenePackageId);
+        if (DictConstants.IS_DELETED.equals(vehicleIsDeleted)) {
+            throw new RuntimeException("车辆配置绑定的动力学配置已被删除。");
         }
         //4 查询场景测试包是否被禁用。
         String isUnavailable = scenePackageMapper.selectIsUnavailableByPackageId(scenePackageId);