From 2fd0e1f211744ca3fb135066d931c3e6ec8d9c94 Mon Sep 17 00:00:00 2001
From: zhanghua <314079846@qq.com>
Date: 星期一, 28 十月 2024 18:31:00 +0800
Subject: [PATCH] 12.学生列表中的添加学生 14.题目难度导入 17.建议时长

---
 src/main/java/com/ycl/jxkg/service/impl/ClassesServiceImpl.java |   36 ++++++++++++++++--------------------
 1 files changed, 16 insertions(+), 20 deletions(-)

diff --git a/src/main/java/com/ycl/jxkg/service/impl/ClassesServiceImpl.java b/src/main/java/com/ycl/jxkg/service/impl/ClassesServiceImpl.java
index c88625a..78a8613 100644
--- a/src/main/java/com/ycl/jxkg/service/impl/ClassesServiceImpl.java
+++ b/src/main/java/com/ycl/jxkg/service/impl/ClassesServiceImpl.java
@@ -57,16 +57,14 @@
         baseMapper.insert(entity);
 
         List<Integer> teacherList = form.getTeacherList();
-        if (CollectionUtils.isEmpty(teacherList)) {
-            teacherList = new ArrayList<>(1);
-        }
-        teacherList.add(webContext.getCurrentUser().getId());
-        for (Integer teacherUserId : teacherList) {
-            ClassesUser classesUser = new ClassesUser();
-            classesUser.setClassesId(entity.getId());
-            classesUser.setUserId(teacherUserId);
-            classesUser.setTeacher(Boolean.TRUE);
-            classesUserService.save(classesUser);
+        if (! CollectionUtils.isEmpty(teacherList)) {
+            for (Integer teacherUserId : teacherList) {
+                ClassesUser classesUser = new ClassesUser();
+                classesUser.setClassesId(entity.getId());
+                classesUser.setUserId(teacherUserId);
+                classesUser.setTeacher(Boolean.TRUE);
+                classesUserService.save(classesUser);
+            }
         }
         return Result.ok("娣诲姞鎴愬姛");
     }
@@ -91,16 +89,14 @@
                 .eq(ClassesUser::getTeacher, Boolean.TRUE)
                 .remove();
         List<Integer> teacherList = form.getTeacherList();
-        if (CollectionUtils.isEmpty(teacherList)) {
-            teacherList = new ArrayList<>(1);
-        }
-        teacherList.add(webContext.getCurrentUser().getId());
-        for (Integer teacherUserId : teacherList) {
-            ClassesUser classesUser = new ClassesUser();
-            classesUser.setClassesId(entity.getId());
-            classesUser.setUserId(teacherUserId);
-            classesUser.setTeacher(Boolean.TRUE);
-            classesUserService.save(classesUser);
+        if (! CollectionUtils.isEmpty(teacherList)) {
+            for (Integer teacherUserId : teacherList) {
+                ClassesUser classesUser = new ClassesUser();
+                classesUser.setClassesId(entity.getId());
+                classesUser.setUserId(teacherUserId);
+                classesUser.setTeacher(Boolean.TRUE);
+                classesUserService.save(classesUser);
+            }
         }
         return Result.ok("淇敼鎴愬姛");
     }

--
Gitblit v1.8.0