package com.billion.main.bs.controller; import com.billion.common.annotation.Log; import com.billion.common.core.controller.BaseController; import com.billion.common.core.domain.AjaxResult; import com.billion.common.core.page.TableDataInfo; import com.billion.common.enums.BusinessType; import com.billion.common.utils.poi.ExcelUtil; import com.billion.main.bs.domain.BsBomInfo; import com.billion.main.bs.service.IBsBomInfoService; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.security.access.prepost.PreAuthorize; import org.springframework.web.bind.annotation.*; import javax.servlet.http.HttpServletResponse; import java.util.List; /** * 基础BOMController * * @author HDY * @date 2024-11-25 */ @RestController @RequestMapping("/bs/bomInfo") public class BsBomInfoController extends BaseController { @Autowired private IBsBomInfoService bsBomInfoService; /** * 查询基础BOM列表 */ @PreAuthorize("@ss.hasPermi('bs:bomInfo:list')") @GetMapping("/list") public TableDataInfo list(BsBomInfo bsBomInfo) { startPage(); List list = bsBomInfoService.selectBsBomInfoList(bsBomInfo); return getDataTable(list); } /** * 导出基础BOM列表 */ @PreAuthorize("@ss.hasPermi('bs:bomInfo:export')") @Log(title = "基础BOM", businessType = BusinessType.EXPORT) @PostMapping("/export") public void export(HttpServletResponse response, BsBomInfo bsBomInfo) { List list = bsBomInfoService.selectBsBomInfoList(bsBomInfo); ExcelUtil util = new ExcelUtil(BsBomInfo.class); util.exportExcel(response, list, "基础BOM数据"); } /** * 获取基础BOM详细信息 */ @PreAuthorize("@ss.hasPermi('bs:bomInfo:query')") @GetMapping(value = "/{id}") public AjaxResult getInfo(@PathVariable("id") Long id) { return success(bsBomInfoService.selectBsBomInfoById(id)); } /** * 新增基础BOM */ @PreAuthorize("@ss.hasPermi('bs:bomInfo:add')") @Log(title = "基础BOM", businessType = BusinessType.INSERT) @PostMapping public void add(@RequestBody BsBomInfo bsBomInfo) { bsBomInfoService.insertBsBomInfo(bsBomInfo); } /** * 修改基础BOM */ @PreAuthorize("@ss.hasPermi('bs:bomInfo:edit')") @Log(title = "基础BOM", businessType = BusinessType.UPDATE) @PutMapping public AjaxResult edit(@RequestBody BsBomInfo bsBomInfo) { return toAjax(bsBomInfoService.updateBsBomInfo(bsBomInfo)); } /** * 删除基础BOM */ @PreAuthorize("@ss.hasPermi('bs:bomInfo:remove')") @Log(title = "基础BOM", businessType = BusinessType.DELETE) @DeleteMapping("/{ids}") public AjaxResult remove(@PathVariable Long[] ids) { return toAjax(bsBomInfoService.deleteBsBomInfoByIds(ids)); } }