ソースを参照

算法名称问题

martin 2 年 前
コミット
9b79b4f315

+ 14 - 11
simulation-resource-server/src/main/java/com/css/simulation/resource/project/impl/SimulationProjectServiceImpl.java

@@ -903,9 +903,7 @@ public class SimulationProjectServiceImpl implements SimulationProjectService {
             }
 
         } else {
-            AlgorithmPO algorithmPO = new AlgorithmPO();
-            algorithmPO.setId(algorithmId);
-            algorithmBaseInfoVo = simulationProjectMapper.selectAlgorithmById(algorithmPO);
+            algorithmBaseInfoVo = simulationProjectMapper.selectAlgorithmById(algorithmId);
         }
         return algorithmBaseInfoVo;
     }
@@ -1523,18 +1521,23 @@ public class SimulationProjectServiceImpl implements SimulationProjectService {
         //1 查询算法名称
         String algorithmId = simulationManualProjectVo.getAlgorithm();
         String algorithmType = simulationManualProjectVo.getAlgorithmType();
-        String algorithmName = "算法平台已删除该算法";
-        if(DictConstants.ALGORITHM_UPLOAD_MODE_PLATFORM.equals(algorithmType)){
+        String algorithmName;
+        if (DictConstants.ALGORITHM_UPLOAD_MODE_PLATFORM.equals(algorithmType)) {
             //1 获取 token
             algorithmName = algoPlatformService.selectAlgorithmNameByAlgorithmId(algorithmId).getInfo();
-        }else {
-            AlgorithmPO algorithmPO = new AlgorithmPO();
-            algorithmPO.setId(algorithmId);
-            List<AlgorithmPO> algorithmBaseInfoVos = simulationProjectMapper.selectAlgorithmBaseInfoById(algorithmPO);
-            if (!isEmpty(algorithmBaseInfoVos)) {
-                algorithmName = algorithmBaseInfoVos.get(0).getAlgorithmName();
+            if (StringUtil.isEmpty(algorithmName)) {
+                algorithmName = "算法平台已删除该算法";
+            }
+        } else {
+
+            AlgorithmPO algorithmPO = simulationProjectMapper.selectAlgorithmById(algorithmId);
+            if (algorithmPO != null && StringUtil.isNotEmpty(algorithmPO.getAlgorithmName())) {
+                algorithmName = algorithmPO.getAlgorithmName();
+            } else {
+                algorithmName = "仿真平台不存在该算法";
             }
         }
+
         simulationManualProjectVo.setAlgorithm(algorithmName);
         //2 是否是自动项目
         if (!isAuto) {

+ 6 - 2
simulation-resource-server/src/main/java/com/css/simulation/resource/project/mapper/SimulationProjectMapper.java

@@ -12,6 +12,8 @@ import api.common.pojo.po.project.SimulationMptSceneScorePo;
 import api.common.pojo.po.scene.ScenePackagePO;
 import api.common.pojo.vo.project.*;
 import org.apache.ibatis.annotations.Mapper;
+import org.apache.ibatis.annotations.Param;
+import org.apache.ibatis.annotations.Select;
 import org.springframework.stereotype.Repository;
 
 import java.util.List;
@@ -43,8 +45,10 @@ public interface SimulationProjectMapper {
 
     List<AlgorithmPO> selectAlgorithmBaseInfoById(AlgorithmPO algorithmPO);
 
-
-    AlgorithmPO selectAlgorithmById(AlgorithmPO algorithmPO);
+    @Select("select id, algorithm_name, description\n" +
+            "        from algorithm\n" +
+            "        where id = #{algorithmId}")
+    AlgorithmPO selectAlgorithmById(@Param("algorithmId") String algorithmId);
 
     List<VehiclePO> selectVehicleBaseInfoById(String id);
 

+ 4 - 9
simulation-resource-server/src/main/resources/mapper/project/SimulationProjectMapper.xml

@@ -126,7 +126,8 @@
     </select>
 
     <!--查询项目列表-->
-    <select id="selectProjectList" parameterType="api.common.pojo.param.project.SimulationManualProjectParam" resultType="api.common.pojo.vo.project.SimulationManualProjectVo">
+    <select id="selectProjectList" parameterType="api.common.pojo.param.project.SimulationManualProjectParam"
+            resultType="api.common.pojo.vo.project.SimulationManualProjectVo">
         select * from simulation_manual_project
         <where>
             is_deleted = '0'
@@ -165,7 +166,8 @@
     </select>
 
     <!--根据id查询-->
-    <select id="selectProjectById" parameterType="api.common.pojo.param.project.SimulationManualProjectParam" resultType="api.common.pojo.po.project.SimulationManualProjectPo">
+    <select id="selectProjectById" parameterType="api.common.pojo.param.project.SimulationManualProjectParam"
+            resultType="api.common.pojo.po.project.SimulationManualProjectPo">
         select id,
                project_date,
                project_num,
@@ -282,13 +284,6 @@
         </if>
     </select>
 
-    <select id="selectAlgorithmById" resultType="api.common.pojo.po.algorithm.AlgorithmPO">
-        select id, algorithm_name, description
-        from algorithm
-        where id = #{id,jdbcType=VARCHAR}
-    </select>
-
-
     <!--获取车辆基本信息-->
     <select id="selectVehicleBaseInfoById" parameterType="string" resultType="api.common.pojo.po.model.VehiclePO">
         select a.id, a.vehicle_name, a.description, a.vehicle_top_view