退出 */ @GetMapping(value = “logout”) public R logout(HttpServletRequest request) { request.getSession().invalidate(); return R.ok(“退出成功”); }
/**
密码重置 */ @IgnoreAuth @RequestMapping(value = “/resetPass”) public R resetPass(String username, HttpServletRequest request){ UserEntity user = userService.selectOne(new EntityWrapper().eq(“username”, username)); if(user==null) { return R.error(“账号不存在”); } user.setPassword(“123456”); userService.update(user,null); return R.ok(“密码已重置为:123456”); }
/**
列表 */ @RequestMapping(“/page”) public R page(@RequestParam Map params,UserEntity user){ EntityWrapper ew = new EntityWrapper(); PageUtils page = userService.queryPage(params, MPUtil.sort(MPUtil.between(MPUtil.allLike(ew, user), params), params)); return R.ok().put(“data”, page); }
/**
列表 */ @RequestMapping(“/list”) public R list( UserEntity user){ EntityWrapper ew = new EntityWrapper(); ew.allEq(MPUtil.allEQMapPre( user, “user”)); return R.ok().put(“data”, userService.selectListView(ew)); }
/**
信息 */ @RequestMapping(“/info/{id}”) public R info(@PathVariable(“id”) String id){ UserEntity user = userService.selectById(id); return R.ok().put(“data”, user); }
/**
获取用户的session用户信息 */ @RequestMapping(“/session”) public R getCurrUser(HttpServletRequest request){ Long id = (Long)request.getSession().getAttribute(“userId”); UserEntity user = userService.selectById(id); return R.ok().put(“data”, user); }