TbFaultReportController.java 3.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114
  1. package com.ruoyi.asset.controller;
  2. import java.util.List;
  3. import javax.servlet.http.HttpServletResponse;
  4. import io.swagger.annotations.Api;
  5. import io.swagger.annotations.ApiOperation;
  6. import org.springframework.security.access.prepost.PreAuthorize;
  7. import org.springframework.beans.factory.annotation.Autowired;
  8. import org.springframework.web.bind.annotation.GetMapping;
  9. import org.springframework.web.bind.annotation.PostMapping;
  10. import org.springframework.web.bind.annotation.PutMapping;
  11. import org.springframework.web.bind.annotation.DeleteMapping;
  12. import org.springframework.web.bind.annotation.PathVariable;
  13. import org.springframework.web.bind.annotation.RequestBody;
  14. import org.springframework.web.bind.annotation.RequestMapping;
  15. import org.springframework.web.bind.annotation.RestController;
  16. import com.ruoyi.common.annotation.Log;
  17. import com.ruoyi.common.core.controller.BaseController;
  18. import com.ruoyi.common.core.domain.AjaxResult;
  19. import com.ruoyi.common.enums.BusinessType;
  20. import com.ruoyi.asset.domain.TbFaultReport;
  21. import com.ruoyi.asset.service.ITbFaultReportService;
  22. import com.ruoyi.common.utils.poi.ExcelUtil;
  23. import com.ruoyi.common.core.page.TableDataInfo;
  24. /**
  25. * 故障报备Controller
  26. *
  27. * @author 原动力
  28. * @date 2023-03-27
  29. */
  30. @Api(tags = "故障报备")
  31. @RestController
  32. @RequestMapping("/asset/fault")
  33. public class TbFaultReportController extends BaseController
  34. {
  35. @Autowired
  36. private ITbFaultReportService tbFaultReportService;
  37. /**
  38. * 查询故障报备列表
  39. */
  40. @ApiOperation("查询故障报备列表")
  41. @PreAuthorize("@ss.hasPermi('asset:fault:list')")
  42. @GetMapping("/list")
  43. public TableDataInfo list(TbFaultReport tbFaultReport)
  44. {
  45. startPage();
  46. List<TbFaultReport> list = tbFaultReportService.selectTbFaultReportList(tbFaultReport);
  47. return getDataTable(list);
  48. }
  49. /**
  50. * 导出故障报备列表
  51. */
  52. @ApiOperation("导出故障报备列表")
  53. @PreAuthorize("@ss.hasPermi('asset:fault:export')")
  54. @Log(title = "故障报备", businessType = BusinessType.EXPORT)
  55. @PostMapping("/export")
  56. public void export(HttpServletResponse response, TbFaultReport tbFaultReport)
  57. {
  58. List<TbFaultReport> list = tbFaultReportService.selectTbFaultReportList(tbFaultReport);
  59. ExcelUtil<TbFaultReport> util = new ExcelUtil<TbFaultReport>(TbFaultReport.class);
  60. util.exportExcel(response, list, "故障报备数据");
  61. }
  62. /**
  63. * 获取故障报备详细信息
  64. */
  65. @ApiOperation("获取故障报备详细信息")
  66. @PreAuthorize("@ss.hasPermi('asset:fault:query')")
  67. @GetMapping(value = "/{id}")
  68. public AjaxResult getInfo(@PathVariable("id") Long id)
  69. {
  70. return AjaxResult.success(tbFaultReportService.selectTbFaultReportById(id));
  71. }
  72. /**
  73. * 新增故障报备
  74. */
  75. @ApiOperation("新增故障报备")
  76. @PreAuthorize("@ss.hasPermi('asset:fault:add')")
  77. @Log(title = "故障报备", businessType = BusinessType.INSERT)
  78. @PostMapping
  79. public AjaxResult add(@RequestBody TbFaultReport tbFaultReport)
  80. {
  81. return toAjax(tbFaultReportService.insertTbFaultReport(tbFaultReport));
  82. }
  83. /**
  84. * 修改故障报备
  85. */
  86. @ApiOperation("修改故障报备")
  87. @PreAuthorize("@ss.hasPermi('asset:fault:edit')")
  88. @Log(title = "故障报备", businessType = BusinessType.UPDATE)
  89. @PutMapping
  90. public AjaxResult edit(@RequestBody TbFaultReport tbFaultReport)
  91. {
  92. return toAjax(tbFaultReportService.updateTbFaultReport(tbFaultReport));
  93. }
  94. /**
  95. * 删除故障报备
  96. */
  97. @ApiOperation("删除故障报备")
  98. @PreAuthorize("@ss.hasPermi('asset:fault:remove')")
  99. @Log(title = "故障报备", businessType = BusinessType.DELETE)
  100. @DeleteMapping("/{ids}")
  101. public AjaxResult remove(@PathVariable Long[] ids)
  102. {
  103. return toAjax(tbFaultReportService.deleteTbFaultReportByIds(ids));
  104. }
  105. }