| | |
| | | import com.mes.common.CacheUtil; |
| | | import com.mes.common.Constants; |
| | | import com.mes.common.Result; |
| | | import com.mes.controller.dto.UserDTO; |
| | | import com.mes.entity.userInfo.User; |
| | | import com.mes.exception.ServiceException; |
| | | import com.mes.mapper.userInfo.UserMapper; |
| | |
| | | System.out.println(cacheUtil.getCacheData("admin")); |
| | | return userMapper.findAll(); |
| | | } |
| | | @ApiOperation("登录") |
| | | @PostMapping("/login") |
| | | public Result login(@RequestBody UserDTO userDTO){ |
| | | //UserDTO getUserCacheDTO = cacheUtil.getCacheData(userDTO.getUserId()); |
| | | userService.deleteCache(userDTO.getUserId()); |
| | | UserDTO getUserDTO=userService.login(userDTO); |
| | | if(getUserDTO!=null){ |
| | | return Result.seccess(userDTO); |
| | | }else{ |
| | | throw new ServiceException(Constants.Code_600,"用户名或密码错误"); |
| | | } |
| | | } |
| | | //@ApiOperation("登录") |
| | | // @PostMapping("/login") |
| | | // public Result login(@RequestBody UserDTO userDTO){ |
| | | // //UserDTO getUserCacheDTO = cacheUtil.getCacheData(userDTO.getUserId()); |
| | | // userService.deleteCache(userDTO.getUserId()); |
| | | // UserDTO getUserDTO=userService.login(userDTO); |
| | | // if(getUserDTO!=null){ |
| | | // return Result.seccess(userDTO); |
| | | // }else{ |
| | | // throw new ServiceException(Constants.Code_600,"用户名或密码错误"); |
| | | // } |
| | | // } |
| | | @ApiOperation("注册") |
| | | @PostMapping("/register") |
| | | public Result register(@RequestBody User user){ |