| 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.core.utils.Constants; | 
| import com.doumee.dao.business.model.WarningEvent; | 
| import com.doumee.service.business.WarningEventService; | 
| 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 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 2025/09/29 11:20 | 
|  */ | 
| @Api(tags = "报警事件记录日志表") | 
| @RestController | 
| @RequestMapping(Constants.CLOUD_SERVICE_URL_INDEX+"/business/warningEvent") | 
| public class WarningEventCloudController extends BaseController { | 
|   | 
|     @Autowired | 
|     private WarningEventService warningEventService; | 
|   | 
|     @PreventRepeat | 
|     @ApiOperation("新建") | 
|     @PostMapping("/create") | 
|     @CloudRequiredPermission("business:warningevent:create") | 
|     public ApiResponse create(@RequestBody WarningEvent warningEvent) { | 
|         return ApiResponse.success(warningEventService.create(warningEvent)); | 
|     } | 
|   | 
|     @ApiOperation("根据ID删除") | 
|     @GetMapping("/delete/{id}") | 
|     @CloudRequiredPermission("business:warningevent:delete") | 
|     public ApiResponse deleteById(@PathVariable Integer id) { | 
|         warningEventService.deleteById(id); | 
|         return ApiResponse.success(null); | 
|     } | 
|   | 
|     @ApiOperation("批量删除") | 
|     @GetMapping("/delete/batch") | 
|     @CloudRequiredPermission("business:warningevent:delete") | 
|     public ApiResponse deleteByIdInBatch(@RequestParam String ids) { | 
|         String [] idArray = ids.split(","); | 
|         List<Integer> idList = new ArrayList<>(); | 
|         for (String id : idArray) { | 
|             idList.add(Integer.valueOf(id)); | 
|         } | 
|         warningEventService.deleteByIdInBatch(idList); | 
|         return ApiResponse.success(null); | 
|     } | 
|   | 
|     @ApiOperation("根据ID修改") | 
|     @PostMapping("/updateById") | 
|     @CloudRequiredPermission("business:warningevent:update") | 
|     public ApiResponse updateById(@RequestBody WarningEvent warningEvent) { | 
|         warningEventService.updateById(warningEvent); | 
|         return ApiResponse.success(null); | 
|     } | 
|   | 
|     @ApiOperation("分页查询") | 
|     @PostMapping("/page") | 
|     @CloudRequiredPermission("business:warningevent:query") | 
|     public ApiResponse<PageData<WarningEvent>> findPage (@RequestBody PageWrap<WarningEvent> pageWrap) { | 
|         return ApiResponse.success(warningEventService.findPage(pageWrap)); | 
|     } | 
|   | 
|     @ApiOperation("导出Excel") | 
|     @PostMapping("/exportExcel") | 
|     @CloudRequiredPermission("business:warningevent:exportExcel") | 
|     public void exportExcel (@RequestBody PageWrap<WarningEvent> pageWrap, HttpServletResponse response) { | 
|         ExcelExporter.build(WarningEvent.class).export(warningEventService.findPage(pageWrap).getRecords(), "报警事件记录日志表", response); | 
|     } | 
|   | 
|     @ApiOperation("根据ID查询") | 
|     @GetMapping("/{id}") | 
|     @CloudRequiredPermission("business:warningevent:query") | 
|     public ApiResponse findById(@PathVariable Integer id) { | 
|         return ApiResponse.success(warningEventService.findById(id)); | 
|     } | 
| } |