liding
4 天以前 0047f8ce5986c577e6b887403dd24ea884c9ce4b
src/main/java/com/ruoyi/stock/controller/StockInRecordController.java
@@ -5,6 +5,7 @@
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.framework.web.domain.R;
import com.ruoyi.stock.dto.StockInRecordDto;
import com.ruoyi.stock.service.StockInRecordService;
import io.swagger.annotations.Api;
@@ -13,6 +14,7 @@
import org.springframework.util.CollectionUtils;
import org.springframework.web.bind.annotation.*;
import javax.servlet.http.HttpServletResponse;
import java.util.List;
@RestController
@@ -30,25 +32,40 @@
        return AjaxResult.success(result);
    }
    @PostMapping("")
    @Log(title = "入库管理-新增入库", businessType = BusinessType.INSERT)
    public AjaxResult add(@RequestBody StockInRecordDto stockInRecordDto) {
        return AjaxResult.success(stockInRecordService.add(stockInRecordDto));
    @GetMapping("/getById")
    @ApiOperation(value = "根据ID查询入库记录")
    public AjaxResult getById(@RequestParam("id") Long id) {
        if (id == null || id <= 0) {
            return AjaxResult.error("参数id不能为空");
        }
        StockInRecordDto stockInRecordDto = stockInRecordService.selectByRecord(id);
        if (stockInRecordDto == null) {
            return AjaxResult.error("记录不存在");
        }
        return AjaxResult.success(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));
    @PostMapping("/updateStockInRecord")
    @ApiOperation("入库记录审核")
    public R updateStockInRecord(@RequestBody StockInRecordDto stockInRecordDto) {
        return R.ok(stockInRecordService.updateStockInRecord(stockInRecordDto));
    }
    @DeleteMapping("")
    @Log(title = "入库管理-删除入库", businessType = BusinessType.DELETE)
    public AjaxResult delete(@RequestBody List<Long> ids) {
        if(CollectionUtils.isEmpty(ids)){
        if (CollectionUtils.isEmpty(ids)) {
            return AjaxResult.error("请选择至少一条数据");
        }
        return AjaxResult.success(stockInRecordService.batchDelete(ids));
    }
    @PostMapping("/exportStockInRecord")
    @ApiOperation("导出入库记录")
    public void exportStockInRecord(HttpServletResponse response, StockInRecordDto stockInRecordDto) {
        stockInRecordService.exportStockInRecord(response, stockInRecordDto);
    }
}