| 对比新文件 |
| | |
| | | package com.ruoyi.technology.controller; |
| | | |
| | | import com.baomidou.mybatisplus.core.metadata.IPage; |
| | | 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.R; |
| | | import com.ruoyi.technology.bean.dto.BomImportDto; |
| | | import com.ruoyi.technology.bean.dto.TechnologyBomDto; |
| | | import com.ruoyi.technology.bean.vo.TechnologyBomVo; |
| | | import com.ruoyi.technology.pojo.TechnologyBom; |
| | | import com.ruoyi.technology.service.TechnologyBomService; |
| | | 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; |
| | | import org.springframework.web.bind.annotation.*; |
| | | import org.springframework.web.multipart.MultipartFile; |
| | | |
| | | import java.util.List; |
| | | |
| | | @RestController |
| | | @RequestMapping("/technologyBom") |
| | | @RequiredArgsConstructor |
| | | @Tag(name = "鍩虹BOM") |
| | | public class TechnologyBomController { |
| | | |
| | | private final TechnologyBomService technologyBomService; |
| | | |
| | | @GetMapping("/listPage") |
| | | @Log(title = "Technology BOM page", businessType = BusinessType.OTHER) |
| | | @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) |
| | | @Operation(summary = "鏂板BOM") |
| | | public R add(@RequestBody TechnologyBom technologyBom) { |
| | | return technologyBomService.add(technologyBom); |
| | | } |
| | | |
| | | @PutMapping("/update") |
| | | @Log(title = "Update technology BOM", businessType = BusinessType.UPDATE) |
| | | @Operation(summary = "淇敼BOM") |
| | | public R update(@RequestBody TechnologyBom technologyBom) { |
| | | return technologyBomService.update(technologyBom); |
| | | } |
| | | |
| | | @DeleteMapping("/batchDelete") |
| | | @Log(title = "Delete technology BOM", businessType = BusinessType.DELETE) |
| | | @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) |
| | | @Operation(summary = "鏍规嵁瑙勬牸鏌ヨBOM") |
| | | public R<List<TechnologyBomVo>> getByModel(Long productModelId) { |
| | | return R.ok(technologyBomService.listByModel(productModelId)); |
| | | } |
| | | |
| | | @PostMapping("/uploadBom") |
| | | @PreAuthorize("@ss.hasPermi('product:bom:import')") |
| | | @Log(title = "鏍规嵁Excel瀵煎叆BOM", businessType = BusinessType.IMPORT) |
| | | @Operation(summary = "鏍规嵁Excel瀵煎叆BOM") |
| | | public R uploadBom(@RequestParam("file") MultipartFile file) { |
| | | return technologyBomService.uploadBom(file); |
| | | } |
| | | |
| | | @PostMapping("/exportBom") |
| | | @PreAuthorize("@ss.hasPermi('product:bom:export')") |
| | | @Operation(summary = "瀵煎嚭BOM鏂囦欢") |
| | | @Log(title = "瀵煎嚭BOM鏂囦欢", businessType = BusinessType.EXPORT) |
| | | public void exportBom(HttpServletResponse response, @RequestParam Integer bomId) { |
| | | technologyBomService.exportBom(response, bomId); |
| | | } |
| | | |
| | | @GetMapping("/downloadTemplate") |
| | | @Log(title = "涓嬭浇BOM瀵煎叆妯℃澘", businessType = BusinessType.EXPORT) |
| | | @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); |
| | | } |
| | | } |