package com.ruoyi.ngtools.controller; import java.util.List; import javax.servlet.http.HttpServletResponse; import org.springframework.security.access.prepost.PreAuthorize; import org.springframework.beans.factory.annotation.Autowired; 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.ruoyi.common.annotation.Log; import com.ruoyi.common.core.controller.BaseController; import com.ruoyi.common.core.domain.AjaxResult; import com.ruoyi.common.enums.BusinessType; import com.ruoyi.ngtools.domain.NgMeterpar; import com.ruoyi.ngtools.service.INgMeterparService; import com.ruoyi.common.utils.poi.ExcelUtil; import com.ruoyi.common.core.page.TableDataInfo; /** * 流量计参数Controller * * @author ruoyi * @date 2025-02-06 */ @RestController @RequestMapping("/ngtools/meterpar") public class NgMeterparController extends BaseController { @Autowired private INgMeterparService ngMeterparService; /** * 查询流量计参数列表 */ @PreAuthorize("@ss.hasPermi('ngtools:meterpar:list')") @GetMapping("/list") public TableDataInfo list(NgMeterpar ngMeterpar) { startPage(); List list = ngMeterparService.selectNgMeterparList(ngMeterpar); return getDataTable(list); } /** * 导出流量计参数列表 */ @PreAuthorize("@ss.hasPermi('ngtools:meterpar:export')") @Log(title = "流量计参数", businessType = BusinessType.EXPORT) @PostMapping("/export") public void export(HttpServletResponse response, NgMeterpar ngMeterpar) { List list = ngMeterparService.selectNgMeterparList(ngMeterpar); ExcelUtil util = new ExcelUtil(NgMeterpar.class); util.exportExcel(response, list, "流量计参数数据"); } /** * 获取流量计参数详细信息 */ @PreAuthorize("@ss.hasPermi('ngtools:meterpar:query')") @GetMapping(value = "/{id}") public AjaxResult getInfo(@PathVariable("id") String id) { return success(ngMeterparService.selectNgMeterparById(id)); } /** * 新增流量计参数 */ @PreAuthorize("@ss.hasPermi('ngtools:meterpar:add')") @Log(title = "流量计参数", businessType = BusinessType.INSERT) @PostMapping public AjaxResult add(@RequestBody NgMeterpar ngMeterpar) { return toAjax(ngMeterparService.insertNgMeterpar(ngMeterpar)); } /** * 修改流量计参数 */ @PreAuthorize("@ss.hasPermi('ngtools:meterpar:edit')") @Log(title = "流量计参数", businessType = BusinessType.UPDATE) @PutMapping public AjaxResult edit(@RequestBody NgMeterpar ngMeterpar) { return toAjax(ngMeterparService.updateNgMeterpar(ngMeterpar)); } /** * 删除流量计参数 */ @PreAuthorize("@ss.hasPermi('ngtools:meterpar:remove')") @Log(title = "流量计参数", businessType = BusinessType.DELETE) @DeleteMapping("/{ids}") public AjaxResult remove(@PathVariable String[] ids) { return toAjax(ngMeterparService.deleteNgMeterparByIds(ids)); } }