huminmin
2026-04-25 3804a77bf599e619426255cbaff100e2d4cf4e73
src/main/java/com/ruoyi/technology/controller/TechnologyBomController.java
@@ -11,8 +11,8 @@
import com.ruoyi.technology.bean.vo.TechnologyBomVo;
import com.ruoyi.technology.pojo.TechnologyBom;
import com.ruoyi.technology.service.TechnologyBomService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.v3.oas.annotations.tags.Tag;
import io.swagger.v3.oas.annotations.Operation;
import jakarta.servlet.http.HttpServletResponse;
import lombok.RequiredArgsConstructor;
import org.springframework.security.access.prepost.PreAuthorize;
@@ -24,42 +24,42 @@
@RestController
@RequestMapping("/technologyBom")
@RequiredArgsConstructor
@Api(tags = "基础BOM")
@Tag(name = "基础BOM")
public class TechnologyBomController {
    private final TechnologyBomService technologyBomService;
    @GetMapping("/listPage")
    @Log(title = "Technology BOM page", businessType = BusinessType.OTHER)
    @ApiOperation("BOM分页查询")
    @Operation(summary = "BOM分页查询")
    public R<IPage<TechnologyBomVo>> listPage(Page<TechnologyBomDto> page, TechnologyBomDto technologyBomDto) {
        return R.ok(technologyBomService.listPage(page, technologyBomDto));
    }
    @PostMapping("/add")
    @Log(title = "Add technology BOM", businessType = BusinessType.INSERT)
    @ApiOperation("新增BOM")
    @Operation(summary = "新增BOM")
    public R add(@RequestBody TechnologyBom technologyBom) {
        return technologyBomService.add(technologyBom);
    }
    @PutMapping("/update")
    @Log(title = "Update technology BOM", businessType = BusinessType.UPDATE)
    @ApiOperation("修改BOM")
    @Operation(summary = "修改BOM")
    public R update(@RequestBody TechnologyBom technologyBom) {
        return technologyBomService.update(technologyBom);
    }
    @DeleteMapping("/batchDelete")
    @Log(title = "Delete technology BOM", businessType = BusinessType.DELETE)
    @ApiOperation("批量删除BOM")
    @Operation(summary = "批量删除BOM")
    public R batchDelete(@RequestBody List<Long> ids) {
        return R.ok(technologyBomService.batchDelete(ids));
    }
    @GetMapping("/getByModel")
    @Log(title = "List BOM by model", businessType = BusinessType.OTHER)
    @ApiOperation("根据规格查询BOM")
    @Operation(summary = "根据规格查询BOM")
    public R<List<TechnologyBomVo>> getByModel(Long productModelId) {
        return R.ok(technologyBomService.listByModel(productModelId));
    }
@@ -67,14 +67,14 @@
    @PostMapping("/uploadBom")
    @PreAuthorize("@ss.hasPermi('product:bom:import')")
    @Log(title = "根据Excel导入BOM", businessType = BusinessType.IMPORT)
    @ApiOperation("根据Excel导入BOM")
    @Operation(summary = "根据Excel导入BOM")
    public R uploadBom(@RequestParam("file") MultipartFile file) {
        return technologyBomService.uploadBom(file);
    }
    @PostMapping("/exportBom")
    @PreAuthorize("@ss.hasPermi('product:bom:export')")
    @ApiOperation("导出BOM文件")
    @Operation(summary = "导出BOM文件")
    @Log(title = "导出BOM文件", businessType = BusinessType.EXPORT)
    public void exportBom(HttpServletResponse response, @RequestParam Integer bomId) {
        technologyBomService.exportBom(response, bomId);
@@ -82,9 +82,16 @@
    @GetMapping("/downloadTemplate")
    @Log(title = "下载BOM导入模板", businessType = BusinessType.EXPORT)
    @ApiOperation("下载BOM导入模板")
    @Operation(summary = "下载BOM导入模板")
    public void importTemplate(HttpServletResponse response) {
        ExcelUtil<BomImportDto> excelUtil = new ExcelUtil<>(BomImportDto.class);
        excelUtil.importTemplateExcel(response, "BOM导入模板");
    }
    @PostMapping("/copy")
    @Log(title = "Copy technology BOM", businessType = BusinessType.INSERT)
    @Operation(summary = "复制BOM")
    public R copy(@RequestBody TechnologyBom technologyBom) {
        return technologyBomService.copy(technologyBom);
    }
}