Browse Source

开放学生批量删除

ruifeng_liu 3 năm trước cách đây
mục cha
commit
5c8011d893
1 tập tin đã thay đổi với 12 bổ sung12 xóa
  1. 12 12
      app/service/student.js

+ 12 - 12
app/service/student.js

@@ -263,18 +263,18 @@ class StudentService extends CrudService {
 
 
   // 根据学生id删除学生
   // 根据学生id删除学生
   async deletestus(data) {
   async deletestus(data) {
-    throw new BusinessError(
-      ErrorCode.BUSINESS,
-      '此功能暂不开放,待确定好会出现的以外情况后,再次开放'
-    );
-    // for (const id of data) {
-    //   await this.model.deleteOne({ _id: ObjectId(id) });
-    //   await this.umodel.deleteOne({ uid: id });
-    //   await this.upmodel.deleteMany({ studentid: id });
-    //   await this.uqmodel.deleteMany({ studentid: id });
-    //   await this.scoremodel.deleteMany({ stuid: id });
-    //   await this.attendmodel.deleteMany({ studentid: id });
-    // }
+    // throw new BusinessError(
+    //   ErrorCode.BUSINESS,
+    //   '此功能暂不开放,待确定好会出现的以外情况后,再次开放'
+    // );
+    for (const id of data) {
+      await this.umodel.deleteOne({ uid: id });
+      await this.upmodel.deleteMany({ studentid: id });
+      await this.uqmodel.deleteMany({ studentid: id });
+      await this.scoremodel.deleteMany({ stuid: id });
+      await this.attendmodel.deleteMany({ studentid: id });
+      await this.model.deleteOne({ _id: ObjectId(id) });
+    }
   }
   }
 
 
   // 批量更新寝室号
   // 批量更新寝室号