package com.ruoyi.production.controller;
import com.ruoyi.framework.aspectj.lang.annotation.Log;
import com.ruoyi.framework.aspectj.lang.enums.BusinessType;
import com.ruoyi.framework.web.domain.AjaxResult;
import com.ruoyi.production.dto.ProductMaterialSkuDto;
import com.ruoyi.production.pojo.ProductMaterialSku;
import com.ruoyi.production.service.ProductMaterialSkuService;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.DeleteMapping;
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.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import java.util.List;
/**
*
* 物料规格控制层
*
*
* @author deslrey
* @version 1.0
* @since 2026/03/12 10:43
*/
@RestController
@RequestMapping("/productMaterialSku")
public class ProductMaterialSkuController {
@Autowired
private ProductMaterialSkuService productMaterialSkuService;
@GetMapping("/list")
@ApiOperation("物料规格数据集合")
@Log(title = "物料规格数据集合", businessType = BusinessType.OTHER)
public AjaxResult productMaterialSkuList(@RequestParam("materialId") Long materialId) {
List list = productMaterialSkuService.productMaterialSkuList(materialId);
return AjaxResult.success(list);
}
@PostMapping("/add")
@ApiOperation("新增物料规格")
@Log(title = "新增物料规格", businessType = BusinessType.INSERT)
public AjaxResult addProductMaterialSku(@RequestBody ProductMaterialSku productMaterialSku) {
productMaterialSkuService.addProductMaterialSku(productMaterialSku);
return AjaxResult.success();
}
@PutMapping("/update")
@ApiOperation("修改物料规格")
@Log(title = "修改物料规格", businessType = BusinessType.UPDATE)
public AjaxResult updateProductMaterialSku(@RequestBody ProductMaterialSku productMaterialSku) {
productMaterialSkuService.updateProductMaterialSku(productMaterialSku);
return AjaxResult.success();
}
@DeleteMapping("/delete")
@ApiOperation("删除物料规格")
@Log(title = "删除物料规格", businessType = BusinessType.DELETE)
public AjaxResult deleteProductMaterialSku(@RequestBody List ids) {
productMaterialSkuService.deleteProductMaterialSku(ids);
return AjaxResult.success();
}
}