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.pojo.ProductMaterial;
|
import com.ruoyi.production.service.ProductMaterialService;
|
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.RestController;
|
|
import java.util.List;
|
import java.util.Map;
|
|
/**
|
* <br>
|
* 产品物料信息控制层
|
* </br>
|
*
|
* @author deslrey
|
* @version 1.0
|
* @since 2026/03/11 16:38
|
*/
|
@RestController
|
@RequestMapping("/productMaterial")
|
public class ProductMaterialController {
|
|
@Autowired
|
private ProductMaterialService productMaterialService;
|
|
@GetMapping("/loadData")
|
@ApiOperation("拉取物料编码数据")
|
@Log(title = "拉取物料编码数据", businessType = BusinessType.INSERT)
|
public AjaxResult loadProductMaterialData() {
|
productMaterialService.loadProductMaterialData();
|
return AjaxResult.success();
|
}
|
|
@GetMapping("/list")
|
@ApiOperation("物料数据")
|
@Log(title = "物料数据", businessType = BusinessType.OTHER)
|
public AjaxResult productMaterialList(String materialName) {
|
Map<String, List<ProductMaterial>> productMaterialMap = productMaterialService.ProductMaterialList(materialName);
|
return AjaxResult.success(productMaterialMap);
|
}
|
|
@PostMapping("/add")
|
@ApiOperation("新增物料")
|
@Log(title = "新增物料", businessType = BusinessType.INSERT)
|
public AjaxResult addProductMaterial(@RequestBody ProductMaterial productMaterial) {
|
productMaterialService.addProductMaterial(productMaterial);
|
return AjaxResult.success();
|
}
|
|
@PutMapping("/update")
|
@ApiOperation("修改物料")
|
@Log(title = "修改物料", businessType = BusinessType.UPDATE)
|
public AjaxResult updateProductMaterial(@RequestBody ProductMaterial productMaterial) {
|
productMaterialService.updateProductMaterial(productMaterial);
|
return AjaxResult.success();
|
}
|
|
@DeleteMapping("/delete")
|
@ApiOperation("删除物料")
|
@Log(title = "删除物料", businessType = BusinessType.DELETE)
|
public AjaxResult deleteProductMaterial(@RequestBody List<Long> ids) {
|
productMaterialService.deleteProductMaterial(ids);
|
return AjaxResult.success();
|
}
|
|
|
|
}
|