zss
17 小时以前 b4b1e13d6cb732c32df34e6ef978c77a4f3623b9
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
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("导入成功");
    }
 
}