| ¶Ô±ÈÐÂÎļþ |
| | |
| | | package com.doumee.cloud.admin; |
| | | |
| | | import com.doumee.api.BaseController; |
| | | import com.doumee.config.annotation.CloudRequiredPermission; |
| | | import com.doumee.core.annotation.excel.ExcelExporter; |
| | | import com.doumee.core.annotation.pr.PreventRepeat; |
| | | import com.doumee.service.business.third.model.ApiResponse; |
| | | import com.doumee.service.business.third.model.PageData; |
| | | import com.doumee.service.business.third.model.PageWrap; |
| | | import com.doumee.core.utils.Constants; |
| | | import com.doumee.dao.admin.response.DeviceEventDTO; |
| | | import com.doumee.dao.business.model.DeviceEvent; |
| | | import com.doumee.service.business.DeviceEventService; |
| | | import io.swagger.annotations.Api; |
| | | import io.swagger.annotations.ApiOperation; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.web.bind.annotation.*; |
| | | |
| | | import javax.servlet.http.HttpServletResponse; |
| | | import java.util.ArrayList; |
| | | import java.util.List; |
| | | /** |
| | | * @author æ±è¹è¹ |
| | | * @date 2023/11/30 15:33 |
| | | */ |
| | | @Api(tags = "é¨ç¦äºä»¶æ¨éè®°å½è¡¨") |
| | | @RestController |
| | | @RequestMapping(Constants.CLOUD_SERVICE_URL_INDEX+"/business/deviceEvent") |
| | | public class DeviceEventCloudController extends BaseController { |
| | | |
| | | @Autowired |
| | | private DeviceEventService deviceEventService; |
| | | |
| | | @PreventRepeat |
| | | @ApiOperation("æ°å»º") |
| | | @PostMapping("/create") |
| | | // @CloudRequiredPermission("business:deviceevent:create") |
| | | public ApiResponse create(@RequestBody DeviceEvent deviceEvent) { |
| | | return ApiResponse.success(deviceEventService.create(deviceEvent)); |
| | | } |
| | | |
| | | @ApiOperation("æ ¹æ®IDå é¤") |
| | | @GetMapping("/delete/{id}") |
| | | @CloudRequiredPermission("business:deviceevent:delete") |
| | | public ApiResponse deleteById(@PathVariable Integer id,@RequestHeader(Constants.HEADER_USER_TOKEN) String token){ |
| | | deviceEventService.deleteById(id); |
| | | return ApiResponse.success(null); |
| | | } |
| | | |
| | | @ApiOperation("æ¹éå é¤") |
| | | @GetMapping("/delete/batch") |
| | | @CloudRequiredPermission("business:deviceevent:delete") |
| | | 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 ){ |
| | | idList.add(Integer.valueOf(id)); |
| | | } |
| | | deviceEventService.deleteByIdInBatch(idList); |
| | | return ApiResponse.success(null); |
| | | } |
| | | |
| | | @ApiOperation("æ ¹æ®IDä¿®æ¹") |
| | | @PostMapping("/updateById") |
| | | @CloudRequiredPermission("business:deviceevent:update") |
| | | public ApiResponse updateById(@RequestBody DeviceEvent deviceEvent,@RequestHeader(Constants.HEADER_USER_TOKEN) String token){ |
| | | deviceEventService.updateById(deviceEvent); |
| | | return ApiResponse.success(null); |
| | | } |
| | | |
| | | @ApiOperation("å页æ¥è¯¢") |
| | | @PostMapping("/page") |
| | | @CloudRequiredPermission("business:deviceevent:query") |
| | | public ApiResponse<PageData<DeviceEventDTO>> findPage (@RequestBody PageWrap<DeviceEvent> pageWrap,@RequestHeader(Constants.HEADER_USER_TOKEN) String token){ |
| | | return ApiResponse.success(deviceEventService.findDeviceEventDTOPage(pageWrap)); |
| | | } |
| | | |
| | | @ApiOperation("导åºExcel") |
| | | @PostMapping("/exportExcel") |
| | | @CloudRequiredPermission("business:deviceevent:exportExcel") |
| | | public void exportExcel (@RequestBody PageWrap<DeviceEvent> pageWrap, HttpServletResponse response,@RequestHeader(Constants.HEADER_USER_TOKEN) String token){ |
| | | ExcelExporter.build(DeviceEventDTO.class).export(deviceEventService.findDeviceEventDTOPage(pageWrap).getRecords(), "é¨ç¦äºä»¶æ¨éè®°å½è¡¨", response); |
| | | } |
| | | // public void exportExcel (@RequestBody PageWrap<DeviceEvent> pageWrap, HttpServletResponse response,@RequestHeader(Constants.HEADER_USER_TOKEN) String token){ |
| | | // ExcelExporter.build(DeviceEventVo.class).export(deviceEventService.findDeviceEventExcel(pageWrap), "é¨ç¦äºä»¶æ¨éè®°å½è¡¨", response); |
| | | // } |
| | | |
| | | @ApiOperation("æ ¹æ®IDæ¥è¯¢") |
| | | @GetMapping("/{id}") |
| | | @CloudRequiredPermission("business:deviceevent:query") |
| | | public ApiResponse findById(@PathVariable Integer id,@RequestHeader(Constants.HEADER_USER_TOKEN) String token){ |
| | | return ApiResponse.success(deviceEventService.findById(id)); |
| | | } |
| | | } |