HdQhController.java 3.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115
  1. package com.ruoyi.web.controller;
  2. import java.util.Arrays;
  3. import java.util.List;
  4. import javax.servlet.http.HttpServletResponse;
  5. import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
  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.web.domain.HdQh;
  21. import com.ruoyi.web.service.IHdQhService;
  22. import com.ruoyi.common.utils.poi.ExcelUtil;
  23. import com.ruoyi.common.core.page.TableDataInfo;
  24. /**
  25. * 活动信息-球耗Controller
  26. *
  27. * @author shenzx
  28. * @date 2025-11-22
  29. */
  30. @RestController
  31. @RequestMapping("/hd/qh")
  32. public class HdQhController extends BaseController
  33. {
  34. private IHdQhService hdQhService;
  35. @Autowired
  36. public void setHdQhService(IHdQhService hdQhService) {
  37. this.hdQhService = hdQhService;
  38. }
  39. /**
  40. * 查询活动信息-球耗列表
  41. */
  42. @PreAuthorize("@ss.hasPermi('hd:qh:list')")
  43. @GetMapping("/list")
  44. public TableDataInfo list(HdQh hdQh)
  45. {
  46. startPage();
  47. QueryWrapper<HdQh> queryWrapper = new QueryWrapper<>();
  48. queryWrapper.setEntity(hdQh);
  49. List<HdQh> hdQhList = hdQhService.list(queryWrapper);
  50. return getDataTable(hdQhList);
  51. }
  52. /**
  53. * 导出活动信息-球耗列表
  54. */
  55. @PreAuthorize("@ss.hasPermi('hd:qh:export')")
  56. @Log(title = "活动信息-球耗", businessType = BusinessType.EXPORT)
  57. @PostMapping("/export")
  58. public void export(HttpServletResponse response, HdQh hdQh)
  59. {
  60. QueryWrapper<HdQh> queryWrapper = new QueryWrapper<>();
  61. queryWrapper.setEntity(hdQh);
  62. List<HdQh> list = hdQhService.list(queryWrapper);
  63. ExcelUtil<HdQh> util = new ExcelUtil<>(HdQh.class);
  64. util.exportExcel(response, list, "活动信息-球耗数据");
  65. }
  66. /**
  67. * 获取活动信息-球耗详细信息
  68. */
  69. @PreAuthorize("@ss.hasPermi('hd:qh:query')")
  70. @GetMapping(value = "/{id}")
  71. public AjaxResult getInfo(@PathVariable("id") Long id)
  72. {
  73. return success(hdQhService.getById(id));
  74. }
  75. /**
  76. * 新增活动信息-球耗
  77. */
  78. @PreAuthorize("@ss.hasPermi('hd:qh:add')")
  79. @Log(title = "活动信息-球耗", businessType = BusinessType.INSERT)
  80. @PostMapping
  81. public AjaxResult add(@RequestBody HdQh hdQh)
  82. {
  83. hdQhService.save(hdQh);
  84. return success(hdQh);
  85. }
  86. /**
  87. * 修改活动信息-球耗
  88. */
  89. @PreAuthorize("@ss.hasPermi('hd:qh:edit')")
  90. @Log(title = "活动信息-球耗", businessType = BusinessType.UPDATE)
  91. @PutMapping
  92. public AjaxResult edit(@RequestBody HdQh hdQh)
  93. {
  94. hdQhService.updateById(hdQh);
  95. return success(hdQh);
  96. }
  97. /**
  98. * 删除活动信息-球耗
  99. */
  100. @PreAuthorize("@ss.hasPermi('hd:qh:remove')")
  101. @Log(title = "活动信息-球耗", businessType = BusinessType.DELETE)
  102. @DeleteMapping("/{ids}")
  103. public AjaxResult remove(@PathVariable Long[] ids)
  104. {
  105. return toAjax(hdQhService.removeByIds(Arrays.asList(ids)));
  106. }
  107. }