Pārlūkot izejas kodu

增加课表删除接口

wanxl 1 gadu atpakaļ
vecāks
revīzija
79a5080542

+ 6 - 4
src/main/java/com/template/api/ClassScheduleAPI.java

@@ -2,13 +2,11 @@ package com.template.api;
 
 
 import com.template.model.result.CommonResult;
 import com.template.model.result.CommonResult;
 import io.swagger.annotations.ApiOperation;
 import io.swagger.annotations.ApiOperation;
-import org.springframework.web.bind.annotation.GetMapping;
-import org.springframework.web.bind.annotation.PostMapping;
-import org.springframework.web.bind.annotation.RequestMapping;
-import org.springframework.web.bind.annotation.RequestParam;
+import org.springframework.web.bind.annotation.*;
 import org.springframework.web.multipart.MultipartFile;
 import org.springframework.web.multipart.MultipartFile;
 
 
 import javax.servlet.http.HttpServletResponse;
 import javax.servlet.http.HttpServletResponse;
+import java.util.List;
 
 
 @RequestMapping("/auto/class-schedule")
 @RequestMapping("/auto/class-schedule")
 public interface ClassScheduleAPI {
 public interface ClassScheduleAPI {
@@ -24,4 +22,8 @@ public interface ClassScheduleAPI {
     @PostMapping("/uploadSchedule")
     @PostMapping("/uploadSchedule")
     @ApiOperation(value = "导入课表", notes = "导入课表", httpMethod = "POST")
     @ApiOperation(value = "导入课表", notes = "导入课表", httpMethod = "POST")
     CommonResult uploadSchedule(@RequestParam("file") MultipartFile file);
     CommonResult uploadSchedule(@RequestParam("file") MultipartFile file);
+
+    @PostMapping("/deleteSchedule")
+    @ApiOperation(value = "删除课表", notes = "删除课表", httpMethod = "POST")
+    CommonResult deleteSchedule(@RequestBody List<Integer> ids);
 }
 }

+ 9 - 0
src/main/java/com/template/controller/ClassScheduleController.java

@@ -206,6 +206,15 @@ public class ClassScheduleController implements ClassScheduleAPI {
         return CommonResult.ok();
         return CommonResult.ok();
     }
     }
 
 
+    @Override
+    public CommonResult deleteSchedule(List<Integer> ids) {
+        boolean a =classScheduleService.removeByIds(ids);
+        if(!a){
+            return CommonResult.fail("删除失败");
+        }
+        return CommonResult.ok("删除完成");
+    }
+
     //    @Scheduled(cron = "0 44 11 * * ? ")
     //    @Scheduled(cron = "0 44 11 * * ? ")
     public void update() {
     public void update() {
 //        LocalDate localDate = LocalDate.of(2023, 9, 4);
 //        LocalDate localDate = LocalDate.of(2023, 9, 4);