package com.ruoyi.stock.controller; import com.baomidou.mybatisplus.core.metadata.IPage; import com.baomidou.mybatisplus.extension.plugins.pagination.Page; 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.stock.dto.StockInRecordDto; import com.ruoyi.stock.service.StockInRecordService; import io.swagger.annotations.Api; import io.swagger.annotations.ApiOperation; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.util.CollectionUtils; import org.springframework.web.bind.annotation.*; import java.util.List; @RestController @Api(tags = "采购入库") @RequestMapping("/stockInRecord") public class StockInRecordController { @Autowired private StockInRecordService stockInRecordService; @GetMapping("/listPage") @Log(title = "生产入库-入库管理-列表", businessType = BusinessType.OTHER) @ApiOperation(value = "入库管理列表") public AjaxResult listPage(Page page, StockInRecordDto stockInRecordDto) { IPage result = stockInRecordService.listPage(page, stockInRecordDto); return AjaxResult.success(result); } @PostMapping("") @Log(title = "入库管理-新增入库", businessType = BusinessType.INSERT) public AjaxResult add(@RequestBody StockInRecordDto stockInRecordDto) { return AjaxResult.success(stockInRecordService.add(stockInRecordDto)); } @PutMapping("/{id}") @Log(title = "入库管理-更新入库", businessType = BusinessType.UPDATE) public AjaxResult update(@PathVariable("id") Long id, @RequestBody StockInRecordDto stockInRecordDto) { return AjaxResult.success(stockInRecordService.update(id, stockInRecordDto)); } @DeleteMapping("") @Log(title = "入库管理-删除入库", businessType = BusinessType.DELETE) public AjaxResult delete(@RequestBody List ids) { if(CollectionUtils.isEmpty(ids)){ return AjaxResult.error("请选择至少一条数据"); } return AjaxResult.success(stockInRecordService.batchDelete(ids)); } }