package com.jjt.elec.controller; import java.util.List; import javax.annotation.Resource; import javax.servlet.http.HttpServletResponse; import io.swagger.annotations.Api; import io.swagger.annotations.ApiOperation; import org.springframework.security.access.prepost.PreAuthorize; import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.PostMapping; import org.springframework.web.bind.annotation.PutMapping; import org.springframework.web.bind.annotation.DeleteMapping; import org.springframework.web.bind.annotation.PathVariable; import org.springframework.web.bind.annotation.RequestBody; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RestController; import com.jjt.common.annotation.Log; import com.jjt.common.core.controller.BaseController; import com.jjt.common.core.domain.AjaxResult; import com.jjt.common.enums.BusinessType; import com.jjt.elec.domain.ElecPrice; import com.jjt.elec.service.IElecPriceService; import com.jjt.common.utils.poi.ExcelUtil; import com.jjt.common.core.page.TableDataInfo; /** * 电费价格配置Controller * * @author wukai * @date 2025-03-14 */ @Api(tags="电费价格配置") @RestController @RequestMapping("/elec/price") public class ElecPriceController extends BaseController{ @Resource private IElecPriceService elecPriceService; /** * 查询电费价格配置列表 */ @ApiOperation("查询电费价格配置列表") @PreAuthorize("@ss.hasPermi('elec:price:list')") @GetMapping("/list") public TableDataInfo list(ElecPrice elecPrice) { startPage(); List list = elecPriceService.selectElecPriceList(elecPrice); return getDataTable(list); } /** * 导出电费价格配置列表 */ @ApiOperation("导出电费价格配置列表") @PreAuthorize("@ss.hasPermi('elec:price:export')") @Log(title = "电费价格配置", businessType = BusinessType.EXPORT) @PostMapping("/export") public void export(HttpServletResponse response, ElecPrice elecPrice) { List list = elecPriceService.selectElecPriceList(elecPrice); ExcelUtil util = new ExcelUtil(ElecPrice.class); util.exportExcel(response, list, "电费价格配置数据"); } /** * 获取电费价格配置详细信息 */ @ApiOperation("获取电费价格配置详细信息") @PreAuthorize("@ss.hasPermi('elec:price:query')") @GetMapping(value = "/{priceId}") public AjaxResult getInfo(@PathVariable("priceId") Long priceId) { return success(elecPriceService.selectElecPriceByPriceId(priceId)); } /** * 新增电费价格配置 */ @ApiOperation("新增电费价格配置") @PreAuthorize("@ss.hasPermi('elec:price:add')") @Log(title = "电费价格配置", businessType = BusinessType.INSERT) @PostMapping public AjaxResult add(@RequestBody ElecPrice elecPrice) { return toAjax(elecPriceService.insertElecPrice(elecPrice)); } /** * 修改电费价格配置 */ @ApiOperation("修改电费价格配置") @PreAuthorize("@ss.hasPermi('elec:price:edit')") @Log(title = "电费价格配置", businessType = BusinessType.UPDATE) @PutMapping public AjaxResult edit(@RequestBody ElecPrice elecPrice) { return toAjax(elecPriceService.updateElecPrice(elecPrice)); } /** * 删除电费价格配置 */ @ApiOperation("删除电费价格配置") @PreAuthorize("@ss.hasPermi('elec:price:remove')") @Log(title = "电费价格配置", businessType = BusinessType.DELETE) @DeleteMapping("/{priceIds}") public AjaxResult remove(@PathVariable Long[] priceIds) { return toAjax(elecPriceService.deleteElecPriceByPriceIds(priceIds)); } }