package com.ruoyi.project.pssr.controller; import com.ruoyi.common.utils.poi.ExcelUtil; import com.ruoyi.framework.aspectj.lang.annotation.Log; import com.ruoyi.framework.aspectj.lang.enums.BusinessType; import com.ruoyi.framework.web.controller.BaseController; import com.ruoyi.framework.web.domain.AjaxResult; import com.ruoyi.framework.web.page.TableDataInfo; import com.ruoyi.project.patrol.patrol.service.ITPatrolMainService; import com.ruoyi.project.patrol.patrol.service.ITPatrolPlanService; import com.ruoyi.project.pssr.domain.TPssrPatrol; import com.ruoyi.project.pssr.service.ITPssrFileService; import com.ruoyi.project.pssr.service.ITPssrPatrolService; 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 ssy * @date 2024-09-18 */ @RestController @RequestMapping("/pssr/patrol") public class TPssrPatrolController extends BaseController { @Resource private TPssrPatrolMapper tPssrPatrolMapper; @Autowired private ITPssrFileService tPssrFileService; @Autowired private ITPssrPatrolService tPssrPatrolService; @Autowired private ITPatrolPlanService tPatrolPlanService; @Autowired private ITPatrolMainService tPatrolMainService; /** * 查询巡检列表 */ @PreAuthorize("@ss.hasPermi('pssr:patrol:list')") @GetMapping("/list") public TableDataInfo list(TPssrPatrol tPssrPatrol) { startPage(); List list = tPssrPatrolService.selectTPssrPatrolList(tPssrPatrol); return getDataTable(list); } /** * 导出巡检列表 */ @PreAuthorize("@ss.hasPermi('pssr:patrol:export')") @Log(title = "巡检", businessType = BusinessType.EXPORT) @GetMapping("/export") public AjaxResult export(TPssrPatrol tPssrPatrol) { List list = tPssrPatrolService.selectTPssrPatrolList(tPssrPatrol); ExcelUtil util = new ExcelUtil(TPssrPatrol.class); return util.exportExcel(list, "patrol"); } /** * 获取巡检详细信息 */ @PreAuthorize("@ss.hasPermi('pssr:patrol:query')") @GetMapping(value = "/{id}") public AjaxResult getInfo(@PathVariable("id") Long id) { return AjaxResult.success(tPssrPatrolService.selectTPssrPatrolById(id)); } /** * 新增巡检 */ @PreAuthorize("@ss.hasPermi('pssr:patrol:add')") @Log(title = "巡检", businessType = BusinessType.INSERT) @PostMapping public AjaxResult add(@RequestBody TPssrPatrol tPssrPatrol) { return toAjax(tPssrPatrolService.insertTPssrPatrol(tPssrPatrol, getUserId().toString())); } /** * 修改巡检 */ @PreAuthorize("@ss.hasPermi('pssr:patrol:edit')") @Log(title = "巡检", businessType = BusinessType.UPDATE) @PutMapping public AjaxResult edit(@RequestBody TPssrPatrol tPssrPatrol) { return toAjax(tPssrPatrolService.updateTPssrPatrol(tPssrPatrol)); } /** * 删除巡检 */ @PreAuthorize("@ss.hasPermi('pssr:patrol:remove')") @Log(title = "巡检", businessType = BusinessType.DELETE) @DeleteMapping("/{ids}") public AjaxResult remove(@PathVariable Long[] ids) { return toAjax(tPssrPatrolService.deleteTPssrPatrolByIds(ids)); } }