瀏覽代碼

分班调整

dzx 9 月之前
父節點
當前提交
d22408cb41
共有 1 個文件被更改,包括 15 次插入11 次删除
  1. 15 11
      src/main/java/com/xjrsoft/module/student/controller/BaseNewStudentController.java

+ 15 - 11
src/main/java/com/xjrsoft/module/student/controller/BaseNewStudentController.java

@@ -409,18 +409,22 @@ public class BaseNewStudentController {
     @PostMapping("/change-banding-status")
     @ApiOperation(value = "修改分班状态")
     @SaCheckPermission("basenewstudent:add")
-    public RT<Boolean> changeBandingStatus(@Valid @RequestBody ChangeBandingStatusDto dto){
-        BaseNewStudent newStudent = baseNewStudentService.getById(dto.getId());
-
-        UpdateWrapper<BaseNewStudent> updateWrapper = new UpdateWrapper<>();
-        updateWrapper.eq("id", newStudent.getId());
-        updateWrapper.setSql("is_can_banding = " + dto.getIsCanBanding());
-        if(StrUtil.isNotEmpty(dto.getRemarks())){
-            updateWrapper.setSql("remarks = '" + dto.getRemarks() + "'");
-        }else{
-            updateWrapper.setSql("remarks = null");
+    public RT<Boolean> changeBandingStatus(@Valid @RequestBody List<ChangeBandingStatusDto> dto){
+        for (ChangeBandingStatusDto el : dto) {
+            BaseNewStudent newStudent = baseNewStudentService.getById(el.getId());
+
+            UpdateWrapper<BaseNewStudent> updateWrapper = new UpdateWrapper<>();
+            updateWrapper.eq("id", newStudent.getId());
+            updateWrapper.setSql("is_can_banding = " + el.getIsCanBanding());
+            if(StrUtil.isNotEmpty(el.getRemarks())){
+                updateWrapper.setSql("remarks = '" + el.getRemarks() + "'");
+            }else{
+                updateWrapper.setSql("remarks = null");
+            }
+            baseNewStudentService.update(newStudent, updateWrapper);
         }
-        return RT.ok(baseNewStudentService.update(newStudent, updateWrapper));
+
+        return RT.ok(true);
     }
 
 }