Parcourir la source

删除一个考试集合包括关联数据 的 接口。

tom il y a 3 semaines
Parent
commit
585385fd2f

+ 6 - 0
ruoyi-sim/src/main/java/com/ruoyi/sim/controller/RealExamCollectionController.java

@@ -137,4 +137,10 @@ public class RealExamCollectionController extends BaseController {
     public AjaxResult deleteExercises() {
         return service.deleteRefTypeSelfExercise();
     }
+
+    @DeleteMapping("/teacher/exam-ref/{id}")
+    @ApiOperation("[教师]删除一个考试集合包括关联数据")
+    public AjaxResult deleteRef(@PathVariable Long id) {
+        return service.deleteRef(id);
+    }
 }

+ 7 - 4
ruoyi-sim/src/main/java/com/ruoyi/sim/service/impl/RealExamCollectionService.java

@@ -447,11 +447,13 @@ public class RealExamCollectionService extends Ele6RYBaseService {
      */
     public RealExamCollection selectRealExamCollectionOpenedNotSelfExercise() {
         RealExamCollection q = selectRealExamCollectionOpened();
+        if (q == null) {
+            return null;
+        }
         if (StringUtils.equals(q.getExamCollectionType(), RealExamCollection.Type.SELF_EXERCISE)) {
             return null;
-        } else {
-            return q;
         }
+        return q;
     }
 
     /**
@@ -549,11 +551,12 @@ public class RealExamCollectionService extends Ele6RYBaseService {
         return AjaxResult.success(count.intValue());
     }
 
-    public void deleteRef(Long id) {
+    public AjaxResult deleteRef(Long id) {
         // delete ref exam data.
         realExamService.deleteRefByExamCollectionId(id);
         // 
-        deleteRealExamCollectionByExamCollectionId(id);
+        int count = deleteRealExamCollectionByExamCollectionId(id);
+        return AjaxResult.success(count);
     }
 
     /**