|
@@ -1,5 +1,6 @@
|
|
|
package com.xjrsoft.module.organization.controller;
|
|
|
|
|
|
+import cn.dev33.satoken.annotation.SaCheckPermission;
|
|
|
import cn.dev33.satoken.secure.BCrypt;
|
|
|
import cn.dev33.satoken.secure.SaSecureUtil;
|
|
|
import cn.dev33.satoken.session.SaSession;
|
|
@@ -76,6 +77,8 @@ public class UserController {
|
|
|
|
|
|
private final SmsCtcc smsCtcc;
|
|
|
|
|
|
+ private final IUserStudentService userStudentService;
|
|
|
+
|
|
|
|
|
|
@GetMapping(value = "/list")
|
|
|
@ApiOperation(value = "用户列表(不分页)")
|
|
@@ -372,4 +375,25 @@ public class UserController {
|
|
|
dto.setPostId(RoleEnum.PARENT.getCode());
|
|
|
return R.ok(userService.add(dto));
|
|
|
}
|
|
|
+
|
|
|
+ @PostMapping("/bind-student")
|
|
|
+ @ApiOperation(value = "绑定学生")
|
|
|
+ public R bindStudent(@Valid @RequestBody UserStudentBindDto dto) {
|
|
|
+ User user = userService.getOne(Wrappers.<User>query().lambda()
|
|
|
+ .eq(User::getName, dto.getName())
|
|
|
+ .eq(User::getCredentialNumber, dto.getIdCard()));
|
|
|
+ UserStudentAddDto userStudentAddDto = new UserStudentAddDto();
|
|
|
+ if (user == null) {
|
|
|
+ return R.error("学生不存在!");
|
|
|
+ }
|
|
|
+ userStudentAddDto.setUserId(dto.getUserId());
|
|
|
+ userStudentAddDto.setStudentId(user.getId());
|
|
|
+ return R.ok(userStudentService.add(userStudentAddDto));
|
|
|
+ }
|
|
|
+
|
|
|
+ @DeleteMapping("/unbind-student")
|
|
|
+ @ApiOperation(value = "解绑学生")
|
|
|
+ public R unBindStudent(@Valid @RequestBody List<Long> ids) {
|
|
|
+ return R.ok(userStudentService.delete(ids));
|
|
|
+ }
|
|
|
}
|