YjjtSlDataController.java 4.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128
  1. package com.goldenwater.web.controller.yjjt;
  2. import java.util.List;
  3. import java.util.Map;
  4. import jakarta.servlet.http.HttpServletResponse;
  5. import org.springframework.beans.factory.annotation.Autowired;
  6. import org.springframework.security.access.prepost.PreAuthorize;
  7. import org.springframework.web.bind.annotation.*;
  8. import com.goldenwater.common.annotation.Log;
  9. import com.goldenwater.common.core.controller.BaseController;
  10. import com.goldenwater.common.core.domain.AjaxResult;
  11. import com.goldenwater.common.core.page.TableDataInfo;
  12. import com.goldenwater.common.enums.BusinessType;
  13. import com.goldenwater.common.utils.poi.ExcelUtil;
  14. import com.goldenwater.yjjt.domain.YjjtSlData;
  15. import com.goldenwater.yjjt.service.IYjjtSlDataService;
  16. /**
  17. * 引江济太水量数据Controller
  18. */
  19. @RestController
  20. @RequestMapping("/yjjt/sl/data")
  21. public class YjjtSlDataController extends BaseController
  22. {
  23. @Autowired
  24. private IYjjtSlDataService yjjtSlDataService;
  25. /**
  26. * 查询水量数据列表
  27. */
  28. @PreAuthorize("@ss.hasPermi('yjjt:sl:list')")
  29. @GetMapping("/list")
  30. public TableDataInfo list(YjjtSlData slData)
  31. {
  32. startPage();
  33. List<YjjtSlData> list = yjjtSlDataService.selectYjjtSlDataList(slData);
  34. return getDataTable(list);
  35. }
  36. /**
  37. * 导出水量数据
  38. */
  39. @PreAuthorize("@ss.hasPermi('yjjt:sl:export')")
  40. @Log(title = "引江济太水量数据", businessType = BusinessType.EXPORT)
  41. @PostMapping("/export")
  42. public void export(HttpServletResponse response, YjjtSlData slData)
  43. {
  44. List<YjjtSlData> list = yjjtSlDataService.selectYjjtSlDataList(slData);
  45. ExcelUtil<YjjtSlData> util = new ExcelUtil<YjjtSlData>(YjjtSlData.class);
  46. util.exportExcel(response, list, "水量数据");
  47. }
  48. /**
  49. * 获取水量数据详细信息
  50. */
  51. @PreAuthorize("@ss.hasPermi('yjjt:sl:query')")
  52. @GetMapping("/{id}")
  53. public AjaxResult getInfo(@PathVariable Long id)
  54. {
  55. return success(yjjtSlDataService.selectYjjtSlDataById(id));
  56. }
  57. /**
  58. * 新增水量数据
  59. */
  60. @PreAuthorize("@ss.hasPermi('yjjt:sl:add')")
  61. @Log(title = "引江济太水量数据", businessType = BusinessType.INSERT)
  62. @PostMapping
  63. public AjaxResult add(@RequestBody YjjtSlData slData)
  64. {
  65. slData.setCreateBy(getUsername());
  66. return toAjax(yjjtSlDataService.insertYjjtSlData(slData));
  67. }
  68. /**
  69. * 修改水量数据
  70. */
  71. @PreAuthorize("@ss.hasPermi('yjjt:sl:edit')")
  72. @Log(title = "引江济太水量数据", businessType = BusinessType.UPDATE)
  73. @PutMapping
  74. public AjaxResult edit(@RequestBody YjjtSlData slData)
  75. {
  76. slData.setUpdateBy(getUsername());
  77. return toAjax(yjjtSlDataService.updateYjjtSlData(slData));
  78. }
  79. /**
  80. * 删除水量数据
  81. */
  82. @PreAuthorize("@ss.hasPermi('yjjt:sl:remove')")
  83. @Log(title = "引江济太水量数据", businessType = BusinessType.DELETE)
  84. @DeleteMapping("/{ids}")
  85. public AjaxResult remove(@PathVariable Long[] ids)
  86. {
  87. return toAjax(yjjtSlDataService.deleteYjjtSlDataByIds(ids));
  88. }
  89. /**
  90. * 获取河流名称列表(去重)
  91. */
  92. @PreAuthorize("@ss.hasPermi('yjjt:sl:list')")
  93. @GetMapping("/rvnmList")
  94. public AjaxResult rvnmList()
  95. {
  96. return success(yjjtSlDataService.selectDistinctRvnmList());
  97. }
  98. /**
  99. * 按日期范围统计数据量
  100. */
  101. @PreAuthorize("@ss.hasPermi('yjjt:sl:list')")
  102. @GetMapping("/countByDateRange")
  103. public AjaxResult countByDateRange(@RequestParam(required = false) String beginDate,
  104. @RequestParam(required = false) String endDate)
  105. {
  106. return success(yjjtSlDataService.selectCountByDateRange(beginDate, endDate));
  107. }
  108. /**
  109. * 今日/本周/本月数据统计
  110. */
  111. @PreAuthorize("@ss.hasPermi('yjjt:sl:list')")
  112. @GetMapping("/count")
  113. public AjaxResult count(@RequestParam(required = false) String addvcd)
  114. {
  115. return success(yjjtSlDataService.selectTodayWeekMonthCount(addvcd));
  116. }
  117. }