TPssrPatrolController.java 3.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101
  1. package com.ruoyi.project.pssr.controller;
  2. import com.ruoyi.common.utils.poi.ExcelUtil;
  3. import com.ruoyi.framework.aspectj.lang.annotation.Log;
  4. import com.ruoyi.framework.aspectj.lang.enums.BusinessType;
  5. import com.ruoyi.framework.web.controller.BaseController;
  6. import com.ruoyi.framework.web.domain.AjaxResult;
  7. import com.ruoyi.framework.web.page.TableDataInfo;
  8. import com.ruoyi.project.patrol.patrol.service.ITPatrolMainService;
  9. import com.ruoyi.project.patrol.patrol.service.ITPatrolPlanService;
  10. import com.ruoyi.project.pssr.domain.TPssrPatrol;
  11. import com.ruoyi.project.pssr.service.ITPssrFileService;
  12. import com.ruoyi.project.pssr.service.ITPssrPatrolService;
  13. import org.springframework.beans.factory.annotation.Autowired;
  14. import org.springframework.security.access.prepost.PreAuthorize;
  15. import org.springframework.web.bind.annotation.*;
  16. import java.util.List;
  17. /**
  18. * 巡检Controller
  19. *
  20. * @author ssy
  21. * @date 2024-09-18
  22. */
  23. @RestController
  24. @RequestMapping("/pssr/patrol")
  25. public class TPssrPatrolController extends BaseController {
  26. @Resource
  27. private TPssrPatrolMapper tPssrPatrolMapper;
  28. @Autowired
  29. private ITPssrFileService tPssrFileService;
  30. @Autowired
  31. private ITPssrPatrolService tPssrPatrolService;
  32. @Autowired
  33. private ITPatrolPlanService tPatrolPlanService;
  34. @Autowired
  35. private ITPatrolMainService tPatrolMainService;
  36. /**
  37. * 查询巡检列表
  38. */
  39. @PreAuthorize("@ss.hasPermi('pssr:patrol:list')")
  40. @GetMapping("/list")
  41. public TableDataInfo list(TPssrPatrol tPssrPatrol) {
  42. startPage();
  43. List<TPssrPatrol> list = tPssrPatrolService.selectTPssrPatrolList(tPssrPatrol);
  44. return getDataTable(list);
  45. }
  46. /**
  47. * 导出巡检列表
  48. */
  49. @PreAuthorize("@ss.hasPermi('pssr:patrol:export')")
  50. @Log(title = "巡检", businessType = BusinessType.EXPORT)
  51. @GetMapping("/export")
  52. public AjaxResult export(TPssrPatrol tPssrPatrol) {
  53. List<TPssrPatrol> list = tPssrPatrolService.selectTPssrPatrolList(tPssrPatrol);
  54. ExcelUtil<TPssrPatrol> util = new ExcelUtil<TPssrPatrol>(TPssrPatrol.class);
  55. return util.exportExcel(list, "patrol");
  56. }
  57. /**
  58. * 获取巡检详细信息
  59. */
  60. @PreAuthorize("@ss.hasPermi('pssr:patrol:query')")
  61. @GetMapping(value = "/{id}")
  62. public AjaxResult getInfo(@PathVariable("id") Long id) {
  63. return AjaxResult.success(tPssrPatrolService.selectTPssrPatrolById(id));
  64. }
  65. /**
  66. * 新增巡检
  67. */
  68. @PreAuthorize("@ss.hasPermi('pssr:patrol:add')")
  69. @Log(title = "巡检", businessType = BusinessType.INSERT)
  70. @PostMapping
  71. public AjaxResult add(@RequestBody TPssrPatrol tPssrPatrol) {
  72. return toAjax(tPssrPatrolService.insertTPssrPatrol(tPssrPatrol, getUserId().toString()));
  73. }
  74. /**
  75. * 修改巡检
  76. */
  77. @PreAuthorize("@ss.hasPermi('pssr:patrol:edit')")
  78. @Log(title = "巡检", businessType = BusinessType.UPDATE)
  79. @PutMapping
  80. public AjaxResult edit(@RequestBody TPssrPatrol tPssrPatrol) {
  81. return toAjax(tPssrPatrolService.updateTPssrPatrol(tPssrPatrol));
  82. }
  83. /**
  84. * 删除巡检
  85. */
  86. @PreAuthorize("@ss.hasPermi('pssr:patrol:remove')")
  87. @Log(title = "巡检", businessType = BusinessType.DELETE)
  88. @DeleteMapping("/{ids}")
  89. public AjaxResult remove(@PathVariable Long[] ids) {
  90. return toAjax(tPssrPatrolService.deleteTPssrPatrolByIds(ids));
  91. }
  92. }