mqtt信息的获取
This commit is contained in:
@ -1,8 +1,37 @@
|
||||
package com.nkkj.ups.controller;
|
||||
|
||||
import com.nkkj.ups.result.R;
|
||||
import com.nkkj.ups.service.impl.LoginServiceImpl;
|
||||
import com.nkkj.ups.utils.JWT.JwtUtils;
|
||||
import generator.domain.User;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.security.authentication.AuthenticationManager;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
import org.springframework.web.bind.annotation.RequestBody;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
@RestController
|
||||
public class LoginController {
|
||||
@Autowired
|
||||
LoginServiceImpl loginService;
|
||||
@Autowired
|
||||
JwtUtils jwtUtils;
|
||||
@PostMapping("/login")
|
||||
public R Login(@RequestBody User user) {
|
||||
User userOne=loginService.login(user.getName(), user.getPassword());
|
||||
if(userOne != null) {
|
||||
String token=jwtUtils.createToken(userOne);
|
||||
return R.success(token);
|
||||
}
|
||||
return R.fail("登录信息错误");
|
||||
}
|
||||
@GetMapping("/")
|
||||
public R test() {
|
||||
return R.success("ok");
|
||||
}
|
||||
@GetMapping("/test")
|
||||
public R test1(){
|
||||
return R.success("test");
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user