| | |
| | | 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.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 org.springframework.web.bind.annotation.*; |
| | | import org.springframework.web.multipart.MultipartFile; |
| | | |
| | | import javax.servlet.http.HttpServletResponse; |
| | | import java.util.List; |
| | | |
| | | /** |
| | |
| | | */ |
| | | @RestController |
| | | @RequestMapping("/productMaterialSku") |
| | | @Api(tags = "物料规格管理接口") |
| | | public class ProductMaterialSkuController { |
| | | |
| | | @Autowired |
| | |
| | | @GetMapping("/list") |
| | | @ApiOperation("物料规格数据集合") |
| | | @Log(title = "物料规格数据集合", businessType = BusinessType.OTHER) |
| | | public AjaxResult productMaterialSkuList(@RequestParam("materialId") Long materialId) { |
| | | List<ProductMaterialSkuDto> list = productMaterialSkuService.productMaterialSkuList(materialId); |
| | | public AjaxResult productMaterialSkuList(Page<ProductMaterialSkuDto> page, ProductMaterialSkuDto dto, @RequestParam(value = "type", required = false) Integer type) { |
| | | Page<ProductMaterialSkuDto> list = productMaterialSkuService.productMaterialSkuList(page, dto, type); |
| | | return AjaxResult.success(list); |
| | | } |
| | | |
| | |
| | | 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("导入成功"); |
| | | } |
| | | |
| | | } |