| | |
| | | } |
| | | |
| | | @SysLog() |
| | | @ApiOperation(value = "根据ID查询") |
| | | @ApiImplicitParams({ |
| | | @ApiImplicitParam(name = "id", value = "ID", dataType = "Integer", paramType = "query", example = "1") |
| | | }) |
| | | @GetMapping(value = "/selectUser") |
| | | public ResponseMsg<UserEntity> selectUser(int id) { |
| | | try { |
| | | UserEntity userEntity = userService.selectUser(id); |
| | | |
| | | return success(userEntity); |
| | | } catch (Exception ex) { |
| | | return fail(ex.getMessage(), null); |
| | | } |
| | | } |
| | | |
| | | @SysLog() |
| | | @ApiOperation(value = "查询所有") |
| | | @GetMapping(value = "/selectUserAll") |
| | | public ResponseMsg<List<UserEntity>> selectUserAll() { |
| | | try { |
| | | List<UserEntity> list = userService.selectUserAll(); |
| | | |
| | | return success(list); |
| | | } catch (Exception ex) { |
| | | return fail(ex.getMessage(), null); |
| | | } |
| | | } |
| | | |
| | | @SysLog() |
| | | @ApiOperation(value = "插入一条") |
| | | @ApiImplicitParams({ |
| | | @ApiImplicitParam(name = "entity", value = "实体类", dataType = "com.lf.server.entity.data.UserEntity", paramType = "body", example = "") |
| | |
| | | @PostMapping(value = "/insertUser", produces = "application/json; charset=UTF-8") |
| | | public ResponseMsg<Integer> insertUser(@RequestBody UserEntity entity, HttpServletRequest req) { |
| | | try { |
| | | String str = userService.ValidateNewPwd(entity); |
| | | if (str != null) { |
| | | return fail(str, -1); |
| | | } |
| | | |
| | | UserEntity ue = tokenService.getCurrentUser(req); |
| | | if (ue != null) { |
| | | entity.setCreateUser(ue.getId()); |
| | |
| | | @PostMapping(value = "/insertUsers", produces = "application/json; charset=UTF-8") |
| | | public ResponseMsg<Integer> insertUsers(@RequestBody List<UserEntity> list, HttpServletRequest req) { |
| | | try { |
| | | if (list == null || list.isEmpty()) { |
| | | return fail("实体类集合为空", -1); |
| | | } |
| | | |
| | | UserEntity ue = tokenService.getCurrentUser(req); |
| | | if (ue != null) { |
| | | for (UserEntity entity : list) { |
| | | for (UserEntity entity : list) { |
| | | String str = userService.ValidateNewPwd(entity); |
| | | if (str != null) { |
| | | return fail(str, -1); |
| | | } |
| | | |
| | | if (ue != null) { |
| | | entity.setCreateUser(ue.getId()); |
| | | } |
| | | } |
| | |
| | | @PostMapping(value = "/updateUser", produces = "application/json; charset=UTF-8") |
| | | public ResponseMsg<Integer> updateUser(@RequestBody UserEntity entity, HttpServletRequest req) { |
| | | try { |
| | | String str = userService.ValidateOldPwd(entity); |
| | | if (str != null) { |
| | | return fail(str, -1); |
| | | } |
| | | |
| | | UserEntity ue = tokenService.getCurrentUser(req); |
| | | if (ue != null) { |
| | | entity.setUpdateUser(ue.getId()); |
| | |
| | | return success(count); |
| | | } catch (Exception ex) { |
| | | return fail(ex.getMessage(), -1); |
| | | } |
| | | } |
| | | |
| | | @SysLog() |
| | | @ApiOperation(value = "根据ID查询") |
| | | @ApiImplicitParams({ |
| | | @ApiImplicitParam(name = "id", value = "ID", dataType = "Integer", paramType = "query", example = "1") |
| | | }) |
| | | @GetMapping(value = "/selectUser") |
| | | public ResponseMsg<UserEntity> selectUser(int id) { |
| | | try { |
| | | UserEntity userEntity = userService.selectUser(id); |
| | | |
| | | return success(userEntity); |
| | | } catch (Exception ex) { |
| | | return fail(ex.getMessage(), null); |
| | | } |
| | | } |
| | | |
| | | @SysLog() |
| | | @ApiOperation(value = "查询所有") |
| | | @GetMapping(value = "/selectUserAll") |
| | | public ResponseMsg<List<UserEntity>> selectUserAll() { |
| | | try { |
| | | List<UserEntity> list = userService.selectUserAll(); |
| | | |
| | | return success(list); |
| | | } catch (Exception ex) { |
| | | return fail(ex.getMessage(), null); |
| | | } |
| | | } |
| | | |