lyhzzz 3 月之前
父節點
當前提交
93a2af980f

+ 3 - 1
src/main/java/com/fdkankan/fusion/service/ICasePathService.java

@@ -3,6 +3,8 @@ package com.fdkankan.fusion.service;
 import com.fdkankan.fusion.entity.CasePath;
 import com.baomidou.mybatisplus.extension.service.IService;
 
+import java.util.List;
+
 /**
  * <p>
  *  服务类
@@ -13,5 +15,5 @@ import com.baomidou.mybatisplus.extension.service.IService;
  */
 public interface ICasePathService extends IService<CasePath> {
 
-    Object getByCaseId(Integer caseId);
+    List<CasePath> getByCaseId(Integer caseId);
 }

+ 3 - 1
src/main/java/com/fdkankan/fusion/service/impl/CasePathServiceImpl.java

@@ -7,6 +7,8 @@ import com.fdkankan.fusion.service.ICasePathService;
 import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
 import org.springframework.stereotype.Service;
 
+import java.util.List;
+
 /**
  * <p>
  *  服务实现类
@@ -19,7 +21,7 @@ import org.springframework.stereotype.Service;
 public class CasePathServiceImpl extends ServiceImpl<ICasePathMapper, CasePath> implements ICasePathService {
 
     @Override
-    public Object getByCaseId(Integer caseId) {
+    public List<CasePath> getByCaseId(Integer caseId) {
         LambdaQueryWrapper<CasePath> wrapper = new LambdaQueryWrapper<>();
         wrapper.eq(CasePath::getCaseId,caseId);
         return this.list(wrapper);

+ 31 - 0
src/main/java/com/fdkankan/fusion/service/impl/CopyCaseService.java

@@ -64,6 +64,10 @@ public class CopyCaseService {
     ICaseScriptService caseScriptService;
     @Autowired
     ICaseImgTagService caseImgTagService;
+    @Autowired
+    ICasePathService casePathService;
+    @Autowired
+    ICaseAnimationService caseAnimationService;
 
 
     @Autowired
@@ -86,6 +90,9 @@ public class CopyCaseService {
         this.cpFusionGuide(oldCaseId,newCaseId);
         this.cpCaseScript(oldCaseId,newCaseId);
         this.cpImgTag(oldCaseId,newCaseId);
+
+        this.cpPath(oldCaseId,newCaseId);
+        this.cpAnimation(oldCaseId,newCaseId);
     }
 
 
@@ -463,4 +470,28 @@ public class CopyCaseService {
             fusionMeterService.save(entity);
         }
     }
+
+    /**
+     * 复制路线
+     */
+    private void cpPath(Integer oldCaseId,Integer newCaseId){
+        List<CasePath> casePaths = casePathService.getByCaseId(oldCaseId);
+        for (CasePath casePath : casePaths) {
+            casePath.setId(null);
+            casePath.setCaseId(newCaseId);
+            casePathService.save(casePath);
+        }
+    }
+
+    /**
+     * 复制动画数据
+     */
+    private void cpAnimation(Integer oldCaseId,Integer newCaseId){
+        List<CaseAnimation> list = caseAnimationService.getListByCaseId(oldCaseId);
+        for (CaseAnimation caseAnimation : list) {
+            caseAnimation.setId(null);
+            caseAnimation.setCaseId(newCaseId);
+            caseAnimationService.save(caseAnimation);
+        }
+    }
 }