package com.zc.business.controller; import com.ruoyi.common.core.controller.BaseController; import com.ruoyi.common.core.domain.AjaxResult; import com.ruoyi.common.core.page.TableDataInfo; import com.zc.business.domain.DcEmergencyPlans; import com.zc.business.domain.DcEvent; import com.zc.business.service.DcEmergencyPlansService; import io.swagger.annotations.Api; import io.swagger.annotations.ApiOperation; import io.swagger.annotations.ApiParam; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.security.access.prepost.PreAuthorize; import org.springframework.web.bind.annotation.*; import java.util.List; /** * 事件预案Controller * * @author wangjiabao * @date 2024-02-21 */ @Api(tags = "事件预案") @RestController @RequestMapping("/business/plans") public class DcEmergencyPlansController extends BaseController { @Autowired private DcEmergencyPlansService dcEmergencyPlansService; /** * 查询事件预案列表 */ @ApiOperation("查询事件预案列表") @PreAuthorize("@ss.hasPermi('business:plans:list')") @GetMapping("/list") public TableDataInfo list(DcEmergencyPlans dcEmergencyPlans) { startPage(); List list = dcEmergencyPlansService.selectDcEmergencyPlansList(dcEmergencyPlans); return getDataTable(list); } /** * 根据事件预案id查询事件预案列表 */ @ApiOperation("根据事件预案id查询事件预案列表") @PreAuthorize("@ss.hasPermi('business:plans:list')") @GetMapping("/list/{id}") public AjaxResult list(@PathVariable @ApiParam(name = "id", value = "事件预案id", required = true) Integer id) { DcEmergencyPlans dcEmergencyPlans = dcEmergencyPlansService.selectDcEmergencyPlans(id); return AjaxResult.success(dcEmergencyPlans); } /** * 根据事件数据查询事件预案列表 */ @ApiOperation("根据事件数据查询事件预案列表") @PreAuthorize("@ss.hasPermi('business:plans:list')") @PostMapping("/list/event/type") public AjaxResult listByEventType(@RequestBody DcEvent dcEvent) { List dcEmergencyPlansList = dcEmergencyPlansService.selectDcEmergencyPlansByEventType(dcEvent); return AjaxResult.success(dcEmergencyPlansList); } /** * 新增事件预案 */ @ApiOperation("新增预案") @PreAuthorize("@ss.hasPermi('business:plans:add')") @PostMapping public AjaxResult add(@RequestBody DcEmergencyPlans dcEmergencyPlans) { return toAjax(dcEmergencyPlansService.insertDcEmergencyPlans(dcEmergencyPlans)); } /** * 修改事件预案 */ @ApiOperation("修改预案") @PreAuthorize("@ss.hasPermi('business:plans:edit')") @PutMapping public AjaxResult update(@RequestBody DcEmergencyPlans dcEmergencyPlans) { return toAjax(dcEmergencyPlansService.updateDcEmergencyPlans(dcEmergencyPlans)); } /** * 批量修改事件预案 */ // @ApiOperation("修改预案") // @PreAuthorize("@ss.hasPermi('business:plans:edit')") // @Log(title = "事件预案", businessType = BusinessType.UPDATE) @PutMapping("/batch") public AjaxResult updateBatch(@RequestBody List dcEmergencyPlansList) { return toAjax(dcEmergencyPlansService.updateBatchDcEmergencyPlans(dcEmergencyPlansList)); } /** * 批量删除事件预案 */ @ApiOperation("批量删除预案") @PreAuthorize("@ss.hasPermi('business:plans:remove')") @DeleteMapping("/{ids}") public AjaxResult update(@PathVariable String[] ids) { return toAjax(dcEmergencyPlansService.deleteDcEmergencyPlans(ids)); } }