root 2 år sedan
förälder
incheckning
4f521f48a1

+ 5 - 4
simulation-resource-server/src/main/java/com/css/simulation/resource/scene/mapper/SceneNaturalMapper.java

@@ -4,6 +4,7 @@ import api.common.pojo.param.scene.SceneNaturalParam;
 import api.common.pojo.po.scene.SceneNaturalPO;
 import org.apache.ibatis.annotations.Delete;
 import org.apache.ibatis.annotations.Mapper;
+import org.apache.ibatis.annotations.Param;
 import org.apache.ibatis.annotations.Select;
 import org.springframework.stereotype.Repository;
 
@@ -45,12 +46,12 @@ public interface SceneNaturalMapper {
     @Select("select natural_id\n" +
             "from scene_natural\n" +
             "where natural_name = #{naturalName}")
-    List<String> selectIdByName(String sceneName);
-
+    List<String> selectIdByName(@Param("sceneName") String sceneName);
 
     @Delete("update scene_natural\n" +
             "set is_deleted  = '1',\n" +
-            "    modify_time = now()\n" +
+            "    modify_time = now(),\n" +
+            "    modify_user = #{modifyUserId}) \n" +
             "where natural_name = '#{sceneName}'\n")
-    void deleteByName(String sceneName);
+    void deleteByName(@Param("sceneName") String sceneName, @Param("modifyUserId") String modifyUserId);
 }

+ 6 - 8
simulation-resource-server/src/main/java/com/css/simulation/resource/scene/mapper/ScenePackageMapper.java

@@ -5,7 +5,7 @@ import api.common.pojo.po.scene.ScenePackagePO;
 import api.common.pojo.vo.scene.ScenePackageNewVO;
 import org.apache.ibatis.annotations.Mapper;
 import org.apache.ibatis.annotations.Param;
-import org.apache.ibatis.annotations.Select;
+import org.apache.ibatis.annotations.Update;
 import org.springframework.stereotype.Repository;
 
 import java.util.List;
@@ -36,13 +36,11 @@ public interface ScenePackageMapper {
 
     //测试包数量
     Integer queryPackageCount(ScenePackagePO params);
-
-    @Select("select share\n" +
-            "from scene_package\n" +
-            "where is_deleted = '0'\n" +
-            " and package_id = #{packageId}")
-    String selectShareById(@Param("packageId")String packageId);
-
     //改变状态是否禁用
     void updateIsUnavailable(ScenePackagePO params);
+
+    @Update("update scene_package\n" +
+            "set is_unavailable = #{isUnavailable}\n" +
+            "where package_id in (select root_id from scene_package_sublist where scene_natural_ids like concat('%', #{sceneId}, '%'))")
+    void updateIsUnavailableByPackageId(@Param("isUnavailable")String isUnavailable,@Param("sceneId")String sceneId);
 }

+ 1 - 1
simulation-resource-server/src/main/java/com/css/simulation/resource/scene/service/SceneNaturalService.java

@@ -447,7 +447,7 @@ public class SceneNaturalService {
         //5 将所有场景包中的该场景删除
         systemScenePackageSublistMapper.deleteBySceneName(sceneName);
         //6 删除所有同名场景(包括公有和私有)
-        sceneNaturalMapper.deleteByName(sceneName);
+//        sceneNaturalMapper.deleteByName(sceneName);
         //7 记录日志
         Map<String, String> map = new HashMap<>();
         map.put("sceneId", params.getNaturalId());