实现登录,编写错误码,实现错误码返回json

This commit is contained in:
F嘉阳
2018-01-30 16:58:12 +08:00
parent 91aba6a592
commit bc720e6270
10 changed files with 155 additions and 12 deletions

View File

@@ -6,7 +6,6 @@ import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestParam;
@Controller
public class LoginController {
@@ -14,16 +13,16 @@ public class LoginController {
@Autowired
private UserService userService;
@GetMapping("/index")
@GetMapping(value = {"index",""})
public String toLoginPage(){
return "login";
}
@PostMapping("/login/dologin")
public boolean doLogin(TbUser tbUser){
public String doLogin(TbUser tbUser)throws Exception{
if (userService.doLoginService(tbUser.getColname(),tbUser.getColpassword())){
return true;
return "home";
}
return false;
return "login";
}
}