package com.ruoyi.production.controller;
|
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
import com.ruoyi.common.utils.poi.ExcelUtil;
|
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.pojo.ProductMaterialSkuImportDto;
|
import com.ruoyi.production.service.ProductMaterialSkuService;
|
import io.swagger.annotations.Api;
|
import io.swagger.annotations.ApiOperation;
|
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.web.bind.annotation.*;
|
import org.springframework.web.multipart.MultipartFile;
|
|
import javax.servlet.http.HttpServletResponse;
|
import java.util.List;
|
|
/**
|
* <br>
|
* 物料规格控制层
|
* </br>
|
*
|
* @author deslrey
|
* @version 1.0
|
* @since 2026/03/12 10:43
|
*/
|
@RestController
|
@RequestMapping("/productMaterialSku")
|
@Api(tags = "物料规格管理接口")
|
public class ProductMaterialSkuController {
|
|
@Autowired
|
private ProductMaterialSkuService productMaterialSkuService;
|
|
@GetMapping("/list")
|
@ApiOperation("物料规格数据集合")
|
@Log(title = "物料规格数据集合", businessType = BusinessType.OTHER)
|
public AjaxResult productMaterialSkuList(Page<ProductMaterialSku> page, ProductMaterialSkuDto dto) {
|
Page<ProductMaterialSkuDto> list = productMaterialSkuService.productMaterialSkuList(page, dto);
|
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<Long> ids) {
|
productMaterialSkuService.deleteProductMaterialSku(ids);
|
return AjaxResult.success();
|
}
|
|
@PostMapping("/downloadTemplate")
|
@Log(title = "下载物料规格导入模板", businessType = BusinessType.EXPORT)
|
@ApiOperation("下载物料规格导入模板")
|
public void importTemplate(HttpServletResponse response) {
|
ExcelUtil<ProductMaterialSkuImportDto> excelUtil = new ExcelUtil<>(ProductMaterialSkuImportDto.class);
|
excelUtil.importTemplateExcel(response, "下载物料规格导入模板");
|
}
|
|
@PostMapping("/import")
|
@ApiOperation("物料规格数据导入")
|
@Log(title = "物料规格数据导入", businessType = BusinessType.IMPORT)
|
public AjaxResult importProdData(@RequestParam("file") MultipartFile file, @RequestParam("materialId") Long materialId) {
|
productMaterialSkuService.importProdData(file, materialId);
|
return AjaxResult.success("导入成功");
|
}
|
|
}
|