| | |
| | | @ApiOperation("新建") |
| | | @PostMapping("/create") |
| | | @CloudRequiredPermission("business:devicerole:create") |
| | | public ApiResponse create(@RequestBody DeviceRole deviceRole) { |
| | | public ApiResponse create(@RequestBody DeviceRole deviceRole,@RequestHeader(Constants.HEADER_USER_TOKEN) String token) { |
| | | deviceRole.setLoginUserInfo(this.getLoginUser(token)); |
| | | return ApiResponse.success(deviceRoleService.create(deviceRole)); |
| | | } |
| | | |
| | | @ApiOperation("根据ID删除") |
| | | @GetMapping("/delete/{id}") |
| | | @CloudRequiredPermission("business:devicerole:delete") |
| | | public ApiResponse deleteById(@PathVariable Integer id) { |
| | | public ApiResponse deleteById(@PathVariable Integer id,@RequestHeader(Constants.HEADER_USER_TOKEN) String token){ |
| | | deviceRoleService.deleteById(id); |
| | | return ApiResponse.success(null); |
| | | } |
| | |
| | | @ApiOperation("批量删除") |
| | | @GetMapping("/delete/batch") |
| | | @CloudRequiredPermission("business:devicerole:delete") |
| | | public ApiResponse deleteByIdInBatch(@RequestParam String ids) { |
| | | public ApiResponse deleteByIdInBatch(@RequestParam String ids,@RequestHeader(Constants.HEADER_USER_TOKEN) String token){ |
| | | String [] idArray = ids.split(","); |
| | | List<Integer> idList = new ArrayList<>(); |
| | | for (String id : idArray) { |
| | | for (String id : idArray){ |
| | | idList.add(Integer.valueOf(id)); |
| | | } |
| | | deviceRoleService.deleteByIdInBatch(idList); |
| | |
| | | @ApiOperation("根据ID修改") |
| | | @PostMapping("/updateById") |
| | | @CloudRequiredPermission("business:devicerole:update") |
| | | public ApiResponse updateById(@RequestBody DeviceRole deviceRole) { |
| | | public ApiResponse updateById(@RequestBody DeviceRole deviceRole,@RequestHeader(Constants.HEADER_USER_TOKEN) String token){ |
| | | |
| | | deviceRole.setLoginUserInfo(this.getLoginUser(token)); |
| | | deviceRoleService.updateById(deviceRole); |
| | | return ApiResponse.success(null); |
| | | } |
| | |
| | | @ApiOperation("根据ID修改默认门禁组状态") |
| | | @PostMapping("/updateStatusById") |
| | | @CloudRequiredPermission("business:devicerole:update") |
| | | public ApiResponse updateStatusById(@RequestBody DeviceRole deviceRole) { |
| | | public ApiResponse updateStatusById(@RequestBody DeviceRole deviceRole,@RequestHeader(Constants.HEADER_USER_TOKEN) String token){ |
| | | |
| | | deviceRole.setLoginUserInfo(this.getLoginUser(token)); |
| | | deviceRoleService.updateStatusById(deviceRole); |
| | | return ApiResponse.success(null); |
| | | } |
| | | @ApiOperation("默认下发门禁组角色") |
| | | @PostMapping("/updateMemberRole") |
| | | public ApiResponse updateMemberRole(@RequestBody DeviceRole deviceRole) { |
| | | public ApiResponse updateMemberRole(@RequestBody DeviceRole deviceRole,@RequestHeader(Constants.HEADER_USER_TOKEN) String token){ |
| | | deviceRole.setLoginUserInfo(this.getLoginUser(token)); |
| | | deviceRoleService.updateMemberRole(deviceRole); |
| | | return ApiResponse.success(null); |
| | | } |
| | |
| | | @ApiOperation("分页查询") |
| | | @PostMapping("/page") |
| | | @CloudRequiredPermission("business:devicerole:query") |
| | | public ApiResponse<PageData<DeviceRole>> findPage (@RequestBody PageWrap<DeviceRole> pageWrap) { |
| | | public ApiResponse<PageData<DeviceRole>> findPage (@RequestBody PageWrap<DeviceRole> pageWrap,@RequestHeader(Constants.HEADER_USER_TOKEN) String token){ |
| | | return ApiResponse.success(deviceRoleService.findPage(pageWrap)); |
| | | } |
| | | |
| | | @ApiOperation("导出Excel") |
| | | @PostMapping("/exportExcel") |
| | | @CloudRequiredPermission("business:devicerole:exportExcel") |
| | | public void exportExcel (@RequestBody PageWrap<DeviceRole> pageWrap, HttpServletResponse response) { |
| | | public void exportExcel (@RequestBody PageWrap<DeviceRole> pageWrap, HttpServletResponse response,@RequestHeader(Constants.HEADER_USER_TOKEN) String token){ |
| | | ExcelExporter.build(DeviceRole.class).export(deviceRoleService.findPage(pageWrap).getRecords(), "门禁角色信息表", response); |
| | | } |
| | | |
| | | @ApiOperation("根据ID查询") |
| | | @GetMapping("/{id}") |
| | | @CloudRequiredPermission("business:devicerole:query") |
| | | public ApiResponse findById(@PathVariable Integer id) { |
| | | public ApiResponse findById(@PathVariable Integer id,@RequestHeader(Constants.HEADER_USER_TOKEN) String token){ |
| | | return ApiResponse.success(deviceRoleService.findById(id)); |
| | | } |
| | | } |