75 lines
2.8 KiB
Java
75 lines
2.8 KiB
Java
|
|
package com.klp.erp.controller;
|
||
|
|
|
||
|
|
import com.klp.common.annotation.Log;
|
||
|
|
import com.klp.common.annotation.RepeatSubmit;
|
||
|
|
import com.klp.common.core.controller.BaseController;
|
||
|
|
import com.klp.common.core.domain.PageQuery;
|
||
|
|
import com.klp.common.core.domain.R;
|
||
|
|
import com.klp.common.core.page.TableDataInfo;
|
||
|
|
import com.klp.common.core.validate.AddGroup;
|
||
|
|
import com.klp.common.core.validate.EditGroup;
|
||
|
|
import com.klp.common.enums.BusinessType;
|
||
|
|
import com.klp.common.utils.poi.ExcelUtil;
|
||
|
|
import com.klp.erp.domain.bo.ErpPurchaseReceiptBo;
|
||
|
|
import com.klp.erp.domain.vo.ErpPurchaseReceiptVo;
|
||
|
|
import com.klp.erp.service.IErpPurchaseReceiptService;
|
||
|
|
import lombok.RequiredArgsConstructor;
|
||
|
|
import org.springframework.validation.annotation.Validated;
|
||
|
|
import org.springframework.web.bind.annotation.*;
|
||
|
|
|
||
|
|
import javax.servlet.http.HttpServletResponse;
|
||
|
|
import javax.validation.constraints.NotEmpty;
|
||
|
|
import javax.validation.constraints.NotNull;
|
||
|
|
import java.util.Arrays;
|
||
|
|
import java.util.List;
|
||
|
|
|
||
|
|
@Validated
|
||
|
|
@RequiredArgsConstructor
|
||
|
|
@RestController
|
||
|
|
@RequestMapping("/erp/purchaseReceipt")
|
||
|
|
public class ErpPurchaseReceiptController extends BaseController {
|
||
|
|
|
||
|
|
private final IErpPurchaseReceiptService receiptService;
|
||
|
|
|
||
|
|
@GetMapping("/list")
|
||
|
|
public TableDataInfo<ErpPurchaseReceiptVo> list(ErpPurchaseReceiptBo bo, PageQuery pageQuery) {
|
||
|
|
return receiptService.queryPageList(bo, pageQuery);
|
||
|
|
}
|
||
|
|
|
||
|
|
@Log(title = "采购收货记录", businessType = BusinessType.EXPORT)
|
||
|
|
@PostMapping("/export")
|
||
|
|
public void export(ErpPurchaseReceiptBo bo, HttpServletResponse response) {
|
||
|
|
List<ErpPurchaseReceiptVo> list = receiptService.queryList(bo);
|
||
|
|
ExcelUtil.exportExcel(list, "采购收货记录", ErpPurchaseReceiptVo.class, response);
|
||
|
|
}
|
||
|
|
|
||
|
|
@GetMapping("/{receiptId}")
|
||
|
|
public R<ErpPurchaseReceiptVo> getInfo(@NotNull(message = "主键不能为空")
|
||
|
|
@PathVariable Long receiptId) {
|
||
|
|
return R.ok(receiptService.queryById(receiptId));
|
||
|
|
}
|
||
|
|
|
||
|
|
@Log(title = "采购收货记录", businessType = BusinessType.INSERT)
|
||
|
|
@RepeatSubmit
|
||
|
|
@PostMapping
|
||
|
|
public R<Void> add(@Validated(AddGroup.class) @RequestBody ErpPurchaseReceiptBo bo) {
|
||
|
|
return toAjax(receiptService.insertByBo(bo));
|
||
|
|
}
|
||
|
|
|
||
|
|
@Log(title = "采购收货记录", businessType = BusinessType.UPDATE)
|
||
|
|
@RepeatSubmit
|
||
|
|
@PutMapping
|
||
|
|
public R<Void> edit(@Validated(EditGroup.class) @RequestBody ErpPurchaseReceiptBo bo) {
|
||
|
|
return toAjax(receiptService.updateByBo(bo));
|
||
|
|
}
|
||
|
|
|
||
|
|
@Log(title = "采购收货记录", businessType = BusinessType.DELETE)
|
||
|
|
@DeleteMapping("/{receiptIds}")
|
||
|
|
public R<Void> remove(@NotEmpty(message = "主键不能为空")
|
||
|
|
@PathVariable Long[] receiptIds) {
|
||
|
|
return toAjax(receiptService.deleteWithValidByIds(Arrays.asList(receiptIds), true));
|
||
|
|
}
|
||
|
|
}
|
||
|
|
|
||
|
|
|