From f16779ece045d628014a9016924f6169ce4f2072 Mon Sep 17 00:00:00 2001 From: lihongjie0209 Date: Mon, 19 May 2025 22:00:56 +0800 Subject: [PATCH] =?UTF-8?q?feat(warehouseReceipt):=20=E6=B7=BB=E5=8A=A0?= =?UTF-8?q?=E6=A0=B9=E6=8D=AE=20ID=20=E5=88=97=E8=A1=A8=E8=8E=B7=E5=8F=96?= =?UTF-8?q?=E4=BB=93=E5=BA=93=E5=8D=95=E6=8D=AE=E4=BF=A1=E6=81=AF=E7=9A=84?= =?UTF-8?q?=E5=8A=9F=E8=83=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - 在 WarehouseReceiptController 中添加了新的接口 getByIdList - 在 WarehouseReceiptService 中实现了根据 ID 列表获取仓库单据信息的方法 - 新增的方法可以批量获取仓库单据信息,提高数据查询效率 --- .../controller/WarehouseReceiptController.java | 7 +++++++ .../service/WarehouseReceiptService.java | 16 ++++++++++++++++ 2 files changed, 23 insertions(+) diff --git a/src/main/java/cn/lihongjie/coal/warehouseReceipt/controller/WarehouseReceiptController.java b/src/main/java/cn/lihongjie/coal/warehouseReceipt/controller/WarehouseReceiptController.java index 6affa9f7..20c78203 100644 --- a/src/main/java/cn/lihongjie/coal/warehouseReceipt/controller/WarehouseReceiptController.java +++ b/src/main/java/cn/lihongjie/coal/warehouseReceipt/controller/WarehouseReceiptController.java @@ -16,6 +16,8 @@ import org.springframework.web.bind.annotation.RequestBody; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RestController; +import java.util.List; + @RestController @RequestMapping("/warehouseReceipt") @SysLog(module = "仓库单据管理") @@ -45,6 +47,11 @@ public class WarehouseReceiptController { return this.service.getById(request.getId()); } + @PostMapping("/getByIdList") + public List getByIdList(@RequestBody IdRequest request) { + return this.service.getByIdList(request.getIds()); + } + @PostMapping("/list") public Page list(@RequestBody CommonQuery request) { return this.service.list(request); diff --git a/src/main/java/cn/lihongjie/coal/warehouseReceipt/service/WarehouseReceiptService.java b/src/main/java/cn/lihongjie/coal/warehouseReceipt/service/WarehouseReceiptService.java index 6bb6f6b0..67fb2717 100644 --- a/src/main/java/cn/lihongjie/coal/warehouseReceipt/service/WarehouseReceiptService.java +++ b/src/main/java/cn/lihongjie/coal/warehouseReceipt/service/WarehouseReceiptService.java @@ -1329,4 +1329,20 @@ from ( return new PageImpl<>(ans, PageRequest.of(0, request.getPageSize()), count); } + + public List getByIdList(List ids) { + + + List allById = this.repository.findAllById(ids); + + List result = new ArrayList<>(); + for (WarehouseReceiptEntity entity : allById) { + WarehouseReceiptDto dto = mapper.toDto(entity); + result.add(dto); + } + return result; + + + + } }