yixindibang/measurement/src/main/java/com/ruoyi/operation/controller/SteelPoundController.java

109 lines
3.6 KiB
Java

package com.ruoyi.operation.controller;
import java.util.Arrays;
import java.util.List;
import javax.servlet.http.HttpServletResponse;
import com.ruoyi.bill.domain.PoundBill;
import com.ruoyi.bill.service.IPoundBillService;
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.operation.service.ISteelPoundService;
import com.ruoyi.common.utils.poi.ExcelUtil;
import com.ruoyi.common.core.page.TableDataInfo;
/**
* 钢材磅Controller
*
* @author ptt
* @date 2025-06-05
*/
@RestController
@RequestMapping("/measurement/operation/steelpound")
public class SteelPoundController extends BaseController
{
@Autowired
private IPoundBillService steelPoundService;
/**
* 查询钢材磅列表
*/
@PreAuthorize("@ss.hasPermi('measurement/operation:steelpound:list')")
@GetMapping("/list")
public TableDataInfo list(PoundBill steelPound)
{
startPage();
List<PoundBill> list = steelPoundService.selectPoundBillList(steelPound);
return getDataTable(list);
}
/**
* 导出钢材磅列表
*/
@PreAuthorize("@ss.hasPermi('measurement/operation:steelpound:export')")
@Log(title = "钢材磅", businessType = BusinessType.EXPORT)
@PostMapping("/export")
public void export(HttpServletResponse response, PoundBill steelPound)
{
List<PoundBill> list = steelPoundService.selectPoundBillList(steelPound);
ExcelUtil<PoundBill> util = new ExcelUtil<PoundBill>(PoundBill.class);
util.exportExcel(response, list, "钢材磅数据");
}
/**
* 获取钢材磅详细信息
*/
@PreAuthorize("@ss.hasPermi('measurement/operation:steelpound:query')")
@GetMapping(value = "/{id}")
public AjaxResult getInfo(@PathVariable("id") String id)
{
return success(steelPoundService.getById(id));
}
/**
* 新增钢材磅
*/
@PreAuthorize("@ss.hasPermi('measurement/operation:steelpound:add')")
@Log(title = "钢材磅", businessType = BusinessType.INSERT)
@PostMapping
public AjaxResult add(@RequestBody PoundBill steelPound)
{
return toAjax(steelPoundService.save(steelPound));
}
/**
* 修改钢材磅
*/
@PreAuthorize("@ss.hasPermi('measurement/operation:steelpound:edit')")
@Log(title = "钢材磅", businessType = BusinessType.UPDATE)
@PutMapping
public AjaxResult edit(@RequestBody PoundBill steelPound)
{
return toAjax(steelPoundService.updatePoundBill(steelPound));
}
/**
* 删除钢材磅
*/
@PreAuthorize("@ss.hasPermi('measurement/operation:steelpound:remove')")
@Log(title = "钢材磅", businessType = BusinessType.DELETE)
@DeleteMapping("/{ids}")
public AjaxResult remove(@PathVariable String[] ids)
{
List<String> list = Arrays.asList(ids);
return toAjax(steelPoundService.removeByIds(list));
}
}