-
@PostMapping("/login") public Result<String> login(@Pattern(regexp = "^\\S{5,16}$") String username, @Pattern(regexp = "^\\S{5,16}$")String password){ //根据用户名查询用户 User loginUser = userService.findByUserName(username); //判断该用户是否存在 if(loginUser == null){ return Result.error("用户名填写错误"); } //判断密码是否正确 if(Md5Util.getMD5String(password).equals(loginUser.getPassword())){ return Result.success("jwt token令牌"); } return Result.error("登陆失败"); }