ElecPriceController.java 3.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113
  1. package com.jjt.elec.controller;
  2. import java.util.List;
  3. import javax.annotation.Resource;
  4. import javax.servlet.http.HttpServletResponse;
  5. import io.swagger.annotations.Api;
  6. import io.swagger.annotations.ApiOperation;
  7. import org.springframework.security.access.prepost.PreAuthorize;
  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.jjt.common.annotation.Log;
  17. import com.jjt.common.core.controller.BaseController;
  18. import com.jjt.common.core.domain.AjaxResult;
  19. import com.jjt.common.enums.BusinessType;
  20. import com.jjt.elec.domain.ElecPrice;
  21. import com.jjt.elec.service.IElecPriceService;
  22. import com.jjt.common.utils.poi.ExcelUtil;
  23. import com.jjt.common.core.page.TableDataInfo;
  24. /**
  25. * 电费价格配置Controller
  26. *
  27. * @author wukai
  28. * @date 2025-03-14
  29. */
  30. @Api(tags="电费价格配置")
  31. @RestController
  32. @RequestMapping("/elec/price")
  33. public class ElecPriceController extends BaseController{
  34. @Resource
  35. private IElecPriceService elecPriceService;
  36. /**
  37. * 查询电费价格配置列表
  38. */
  39. @ApiOperation("查询电费价格配置列表")
  40. @PreAuthorize("@ss.hasPermi('elec:price:list')")
  41. @GetMapping("/list")
  42. public TableDataInfo list(ElecPrice elecPrice)
  43. {
  44. startPage();
  45. List<ElecPrice> list = elecPriceService.selectElecPriceList(elecPrice);
  46. return getDataTable(list);
  47. }
  48. /**
  49. * 导出电费价格配置列表
  50. */
  51. @ApiOperation("导出电费价格配置列表")
  52. @PreAuthorize("@ss.hasPermi('elec:price:export')")
  53. @Log(title = "电费价格配置", businessType = BusinessType.EXPORT)
  54. @PostMapping("/export")
  55. public void export(HttpServletResponse response, ElecPrice elecPrice)
  56. {
  57. List<ElecPrice> list = elecPriceService.selectElecPriceList(elecPrice);
  58. ExcelUtil<ElecPrice> util = new ExcelUtil<ElecPrice>(ElecPrice.class);
  59. util.exportExcel(response, list, "电费价格配置数据");
  60. }
  61. /**
  62. * 获取电费价格配置详细信息
  63. */
  64. @ApiOperation("获取电费价格配置详细信息")
  65. @PreAuthorize("@ss.hasPermi('elec:price:query')")
  66. @GetMapping(value = "/{priceId}")
  67. public AjaxResult getInfo(@PathVariable("priceId") Long priceId)
  68. {
  69. return success(elecPriceService.selectElecPriceByPriceId(priceId));
  70. }
  71. /**
  72. * 新增电费价格配置
  73. */
  74. @ApiOperation("新增电费价格配置")
  75. @PreAuthorize("@ss.hasPermi('elec:price:add')")
  76. @Log(title = "电费价格配置", businessType = BusinessType.INSERT)
  77. @PostMapping
  78. public AjaxResult add(@RequestBody ElecPrice elecPrice)
  79. {
  80. return toAjax(elecPriceService.insertElecPrice(elecPrice));
  81. }
  82. /**
  83. * 修改电费价格配置
  84. */
  85. @ApiOperation("修改电费价格配置")
  86. @PreAuthorize("@ss.hasPermi('elec:price:edit')")
  87. @Log(title = "电费价格配置", businessType = BusinessType.UPDATE)
  88. @PutMapping
  89. public AjaxResult edit(@RequestBody ElecPrice elecPrice)
  90. {
  91. return toAjax(elecPriceService.updateElecPrice(elecPrice));
  92. }
  93. /**
  94. * 删除电费价格配置
  95. */
  96. @ApiOperation("删除电费价格配置")
  97. @PreAuthorize("@ss.hasPermi('elec:price:remove')")
  98. @Log(title = "电费价格配置", businessType = BusinessType.DELETE)
  99. @DeleteMapping("/{priceIds}")
  100. public AjaxResult remove(@PathVariable Long[] priceIds)
  101. {
  102. return toAjax(elecPriceService.deleteElecPriceByPriceIds(priceIds));
  103. }
  104. }