init_object,增加了不完全的登录API,完善数据库设计

This commit is contained in:
guo
2024-06-28 22:31:12 +08:00
parent 3a513a7063
commit b0deeb58af
51 changed files with 1392 additions and 1 deletions
@@ -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);
}
}