package com.jcdm.main.bs.modelNumber.controller; import java.util.List; import javax.servlet.http.HttpServletResponse; import org.springframework.security.access.prepost.PreAuthorize; import org.springframework.beans.factory.annotation.Autowired; 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.DeleteMapping; import org.springframework.web.bind.annotation.PathVariable; import org.springframework.web.bind.annotation.RequestBody; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RestController; import com.jcdm.common.annotation.Log; import com.jcdm.common.core.controller.BaseController; import com.jcdm.common.core.domain.AjaxResult; import com.jcdm.common.enums.BusinessType; import com.jcdm.main.bs.modelNumber.domain.BsModelNumber; import com.jcdm.main.bs.modelNumber.service.IBsModelNumberService; import com.jcdm.common.utils.poi.ExcelUtil; import com.jcdm.common.core.page.TableDataInfo; /** * 机型序号Controller * * @author jiang * @date 2024-01-15 */ @RestController @RequestMapping("/bs/modelNumber") public class BsModelNumberController extends BaseController { @Autowired private IBsModelNumberService bsModelNumberService; /** * 查询机型序号列表 */ @PreAuthorize("@ss.hasPermi('bs:modelNumber:list')") @GetMapping("/list") public TableDataInfo list(BsModelNumber bsModelNumber) { startPage(); List list = bsModelNumberService.selectBsModelNumberList(bsModelNumber); return getDataTable(list); } /** * 导出机型序号列表 */ @PreAuthorize("@ss.hasPermi('bs:modelNumber:export')") @Log(title = "机型序号", businessType = BusinessType.EXPORT) @PostMapping("/export") public void export(HttpServletResponse response, BsModelNumber bsModelNumber) { List list = bsModelNumberService.selectBsModelNumberList(bsModelNumber); ExcelUtil util = new ExcelUtil(BsModelNumber.class); util.exportExcel(response, list, "机型序号数据"); } /** * 获取机型序号详细信息 */ @PreAuthorize("@ss.hasPermi('bs:modelNumber:query')") @GetMapping(value = "/{id}") public AjaxResult getInfo(@PathVariable("id") Long id) { return success(bsModelNumberService.selectBsModelNumberById(id)); } /** * 新增机型序号 */ @PreAuthorize("@ss.hasPermi('bs:modelNumber:add')") @Log(title = "机型序号", businessType = BusinessType.INSERT) @PostMapping public AjaxResult add(@RequestBody BsModelNumber bsModelNumber) { return toAjax(bsModelNumberService.insertBsModelNumber(bsModelNumber)); } /** * 修改机型序号 */ @PreAuthorize("@ss.hasPermi('bs:modelNumber:edit')") @Log(title = "机型序号", businessType = BusinessType.UPDATE) @PutMapping public AjaxResult edit(@RequestBody BsModelNumber bsModelNumber) { return toAjax(bsModelNumberService.updateBsModelNumber(bsModelNumber)); } /** * 删除机型序号 */ @PreAuthorize("@ss.hasPermi('bs:modelNumber:remove')") @Log(title = "机型序号", businessType = BusinessType.DELETE) @DeleteMapping("/{ids}") public AjaxResult remove(@PathVariable Long[] ids) { return toAjax(bsModelNumberService.deleteBsModelNumberByIds(ids)); } }