|
@@ -0,0 +1,52 @@
|
|
|
+package org.brynhild.graduation.timetable.controller
|
|
|
+
|
|
|
+import jakarta.annotation.Resource
|
|
|
+import org.brynhild.graduation.common.transfer.dto.Result
|
|
|
+import org.brynhild.graduation.common.utils.RequestBodyVerifier
|
|
|
+import org.brynhild.graduation.timetable.service.ITimeTableService
|
|
|
+import org.brynhild.graduation.transfer.timetable.vo.QueryTeachingClassRequest
|
|
|
+import org.brynhild.graduation.transfer.timetable.vo.QueryTimeTableRequest
|
|
|
+import org.springframework.beans.factory.annotation.Autowired
|
|
|
+import org.springframework.validation.BindingResult
|
|
|
+import org.springframework.validation.annotation.Validated
|
|
|
+import org.springframework.web.bind.annotation.PostMapping
|
|
|
+import org.springframework.web.bind.annotation.RequestBody
|
|
|
+import org.springframework.web.bind.annotation.RequestMapping
|
|
|
+import org.springframework.web.bind.annotation.RestController
|
|
|
+
|
|
|
+@RestController
|
|
|
+@RequestMapping("/teacher")
|
|
|
+class TeacherController {
|
|
|
+ private RequestBodyVerifier verifier
|
|
|
+ private ITimeTableService tableService
|
|
|
+
|
|
|
+ @PostMapping("/timetable")
|
|
|
+ Result queryStudentTimetable(@RequestBody @Validated QueryTimeTableRequest request, BindingResult result){
|
|
|
+ if(result.hasErrors()){
|
|
|
+ return verifier.convertToErrors(result);
|
|
|
+ }
|
|
|
+ return tableService.findTimeTable(request);
|
|
|
+ }
|
|
|
+
|
|
|
+ @PostMapping("/clazz")
|
|
|
+ Result queryTeachingClass(@RequestBody @Validated QueryTeachingClassRequest request,BindingResult result){
|
|
|
+ if(result.hasErrors()){
|
|
|
+ return verifier.convertToErrors(result);
|
|
|
+ }
|
|
|
+ println request
|
|
|
+ return tableService.queryTeachingClass(request)
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+ @Autowired
|
|
|
+ @Resource
|
|
|
+ void setVerifier(RequestBodyVerifier verifier) {
|
|
|
+ this.verifier = verifier
|
|
|
+ }
|
|
|
+
|
|
|
+ @Autowired
|
|
|
+ @Resource
|
|
|
+ void setTableService(ITimeTableService tableService) {
|
|
|
+ this.tableService = tableService
|
|
|
+ }
|
|
|
+}
|