| | |
| | | |
| | | import com.ycl.jxkg.base.Result; |
| | | import com.ycl.jxkg.domain.form.RegisterForm; |
| | | import com.ycl.jxkg.service.AuthenticationService; |
| | | import com.ycl.jxkg.service.UserService; |
| | | import lombok.RequiredArgsConstructor; |
| | | import org.springframework.validation.annotation.Validated; |
| | |
| | | */ |
| | | @RestController |
| | | @RequiredArgsConstructor |
| | | @RequestMapping("/register") |
| | | @RequestMapping("/api/register") |
| | | public class RegisterController { |
| | | |
| | | private final UserService userService; |
| | | private final AuthenticationService authenticationService; |
| | | |
| | | @PostMapping("/teacher") |
| | | public Result teacherRegister(@RequestBody @Validated RegisterForm form) { |
| | | form.setPassword(authenticationService.pwdEncode(form.getPassword())); |
| | | userService.teacherRegister(form); |
| | | return Result.ok("注册成功"); |
| | | } |
| | | |
| | | @PostMapping("/student") |
| | | public Result studentRegister(@RequestBody @Validated RegisterForm form) { |
| | | form.setPassword(authenticationService.pwdEncode(form.getPassword())); |
| | | userService.studentRegister(form); |
| | | return Result.ok("注册成功"); |
| | | } |