|
@@ -3,6 +3,7 @@ package com.schoolinout.web.controller.api;
|
|
|
import com.schoolinout.api.service.IApiParentService;
|
|
|
import com.schoolinout.api.service.IApiParentStudentRelationService;
|
|
|
import com.schoolinout.api.service.IApiStudentService;
|
|
|
+import com.schoolinout.common.core.controller.BaseController;
|
|
|
import com.schoolinout.common.core.domain.AjaxResult;
|
|
|
import com.schoolinout.common.core.domain.entity.ParentLogin;
|
|
|
import com.schoolinout.common.core.domain.entity.SysDictData;
|
|
@@ -43,7 +44,7 @@ import java.util.concurrent.TimeUnit;
|
|
|
@Tag(name = "用户端-家长接口")
|
|
|
@RequestMapping("/app/parent")
|
|
|
@RestController
|
|
|
-public class Api_ParentController {
|
|
|
+public class Api_ParentController extends BaseController {
|
|
|
|
|
|
public static final String CODE_CACHE_KEY = "validate:code:";
|
|
|
|
|
@@ -169,4 +170,21 @@ public class Api_ParentController {
|
|
|
}
|
|
|
return AjaxResult.success(data);
|
|
|
}
|
|
|
+
|
|
|
+ @Operation(summary = "新增绑定学生")
|
|
|
+ @PostMapping("/bind/relation/{studentNum}")
|
|
|
+ public AjaxResult bindStudent(@PathVariable String studentNum) {
|
|
|
+
|
|
|
+ // step1:检测学号学生是否存在
|
|
|
+ Student student = new Student();
|
|
|
+ student.setStudentNum(studentNum);
|
|
|
+ Student studentDb = studentService.listStudentSimple(student);
|
|
|
+ if (studentDb == null) {
|
|
|
+ return AjaxResult.error("不存在该学号的学生");
|
|
|
+ }
|
|
|
+ // step2:存在及保证关系
|
|
|
+ Long parentId = getLoginUser().getParentLogin().getId();
|
|
|
+ parentService.saveOrUpdateRelation(parentId, studentDb.getId());
|
|
|
+ return success();
|
|
|
+ }
|
|
|
}
|