feat(warehouseReceipt): 添加根据 ID 列表获取仓库单据信息的功能

- 在 WarehouseReceiptController 中添加了新的接口 getByIdList
- 在 WarehouseReceiptService 中实现了根据 ID 列表获取仓库单据信息的方法
- 新增的方法可以批量获取仓库单据信息,提高数据查询效率
This commit is contained in:
2025-05-19 22:00:56 +08:00
parent 01336f7dc4
commit f16779ece0
2 changed files with 23 additions and 0 deletions

View File

@@ -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<WarehouseReceiptDto> getByIdList(@RequestBody IdRequest request) {
return this.service.getByIdList(request.getIds());
}
@PostMapping("/list")
public Page<WarehouseReceiptListDto> list(@RequestBody CommonQuery request) {
return this.service.list(request);

View File

@@ -1329,4 +1329,20 @@ from (
return new PageImpl<>(ans, PageRequest.of(0, request.getPageSize()), count);
}
public List<WarehouseReceiptDto> getByIdList(List<String> ids) {
List<WarehouseReceiptEntity> allById = this.repository.findAllById(ids);
List<WarehouseReceiptDto> result = new ArrayList<>();
for (WarehouseReceiptEntity entity : allById) {
WarehouseReceiptDto dto = mapper.toDto(entity);
result.add(dto);
}
return result;
}
}