init_object,增加了不完全的登录API,完善数据库设计
This commit is contained in:
@@ -0,0 +1,29 @@
|
||||
package com.guo.learningprogresstracker.controller;
|
||||
|
||||
import com.guo.learningprogresstracker.domain.entity.CommonResult;
|
||||
import com.guo.learningprogresstracker.domain.model.LoginBody;
|
||||
import com.guo.learningprogresstracker.exception.AppException;
|
||||
import com.guo.learningprogresstracker.service.LoginService;
|
||||
import org.springframework.web.bind.annotation.CrossOrigin;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
import org.springframework.web.bind.annotation.RequestBody;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
|
||||
/**
|
||||
* @author guo
|
||||
*/
|
||||
@CrossOrigin
|
||||
@RestController
|
||||
public class LoginController {
|
||||
|
||||
@Resource
|
||||
private LoginService loginService;
|
||||
|
||||
@PostMapping("/login")
|
||||
public CommonResult<Object> login(@RequestBody LoginBody loginBody) throws AppException {
|
||||
String token = loginService.login(loginBody.getUsername(),loginBody.getPassword());
|
||||
return CommonResult.success("登录成功!",token);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user