|  |  |  | 
|---|
|  |  |  | @PostMapping("/create") | 
|---|
|  |  |  | @CloudRequiredPermission("business:ywdevice:create") | 
|---|
|  |  |  | public ApiResponse create(@RequestBody YwDevice ywDevice,@RequestHeader(Constants.HEADER_USER_TOKEN) String token) { | 
|---|
|  |  |  | ywDevice.setLoginUserInfo(this.getLoginUser(token)); | 
|---|
|  |  |  | return ApiResponse.success(ywDeviceService.create(ywDevice)); | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | 
|---|
|  |  |  | @GetMapping("/delete/{id}") | 
|---|
|  |  |  | @CloudRequiredPermission("business:ywdevice:delete") | 
|---|
|  |  |  | public ApiResponse deleteById(@PathVariable Integer id,@RequestHeader(Constants.HEADER_USER_TOKEN) String token) { | 
|---|
|  |  |  | ywDeviceService.deleteById(id); | 
|---|
|  |  |  | ywDeviceService.deleteById(id,this.getLoginUser(token)); | 
|---|
|  |  |  | return ApiResponse.success(null); | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | 
|---|
|  |  |  | for (String id : idArray) { | 
|---|
|  |  |  | idList.add(Integer.valueOf(id)); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | ywDeviceService.deleteByIdInBatch(idList); | 
|---|
|  |  |  | ywDeviceService.deleteByIdInBatch(idList,this.getLoginUser(token)); | 
|---|
|  |  |  | return ApiResponse.success(null); | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | 
|---|
|  |  |  | @PostMapping("/updateById") | 
|---|
|  |  |  | @CloudRequiredPermission("business:ywdevice:update") | 
|---|
|  |  |  | public ApiResponse updateById(@RequestBody YwDevice ywDevice,@RequestHeader(Constants.HEADER_USER_TOKEN) String token) { | 
|---|
|  |  |  | ywDevice.setLoginUserInfo(this.getLoginUser(token)); | 
|---|
|  |  |  | ywDeviceService.updateById(ywDevice); | 
|---|
|  |  |  | return ApiResponse.success(null); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | 
|---|
|  |  |  | @PostMapping("/page") | 
|---|
|  |  |  | @CloudRequiredPermission("business:ywdevice:query") | 
|---|
|  |  |  | public ApiResponse<PageData<YwDevice>> findPage (@RequestBody PageWrap<YwDevice> pageWrap,@RequestHeader(Constants.HEADER_USER_TOKEN) String token) { | 
|---|
|  |  |  | pageWrap.getModel().setLoginUserInfo(this.getLoginUser(token)); | 
|---|
|  |  |  | return ApiResponse.success(ywDeviceService.findPage(pageWrap)); | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | 
|---|
|  |  |  | @PostMapping("/exportExcel") | 
|---|
|  |  |  | @CloudRequiredPermission("business:ywdevice:exportExcel") | 
|---|
|  |  |  | public void exportExcel (@RequestBody PageWrap<YwDevice> pageWrap, HttpServletResponse response,@RequestHeader(Constants.HEADER_USER_TOKEN) String token) { | 
|---|
|  |  |  | pageWrap.getModel().setLoginUserInfo(this.getLoginUser(token)); | 
|---|
|  |  |  | ExcelExporter.build(YwDevice.class).export(ywDeviceService.findPage(pageWrap).getRecords(), "运维设备信息表", response); | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | 
|---|
|  |  |  | @GetMapping("/{id}") | 
|---|
|  |  |  | @CloudRequiredPermission("business:ywdevice:query") | 
|---|
|  |  |  | public ApiResponse findById(@PathVariable Integer id,@RequestHeader(Constants.HEADER_USER_TOKEN) String token) { | 
|---|
|  |  |  | return ApiResponse.success(ywDeviceService.findById(id)); | 
|---|
|  |  |  | return ApiResponse.success(ywDeviceService.getDetail(id)); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | } | 
|---|