基于微信小程序的安心陪诊管理系统-代码

@RequestMapping("users")
@RestController
public class UsersController {

    @Autowired
    private UsersService userService;

    @Autowired
    private TokenService tokenService;

    /**
     * 登录
     */
    @IgnoreAuth
    @RequestMapping(value = "/login")
    public R login(String username, String password, String captcha, HttpServletRequest request) {
        UsersEntity user = userService.selectOne(new EntityWrapper<UsersEntity>().eq("username", username));
        if (user == null || !user.getPassword().equals(password)) {
            return R.error("账号或密码不正确");
        }
        String token = tokenService.generateToken(user.getId(), username, "users", user.getRole());
        return R.ok().put("token", token);
    }

}
上一篇:manim边做边学--交替变换


下一篇:apache-skywalking-apm-10.1.0使用