Commit 58c2a6478fb14c618cdb59ff3c2d15716037ca21
Merge remote-tracking branch 'origin/dev' into feature_v20240912
# Conflicts: # etrade-shop/src/main/java/com/diligrp/etrade/shop/api/StockApi.java
Showing
1 changed file
with
16 additions
and
0 deletions
etrade-shop/src/main/java/com/diligrp/etrade/shop/api/StockApi.java
1 | 1 | package com.diligrp.etrade.shop.api; |
2 | 2 | |
3 | +import cn.hutool.core.collection.CollUtil; | |
3 | 4 | import com.diligrp.etrade.core.domain.Message; |
4 | 5 | import com.diligrp.etrade.shop.domain.request.StockAddRequest; |
5 | 6 | import com.diligrp.etrade.shop.domain.request.StockDeductRequest; |
7 | +import com.diligrp.etrade.shop.model.Stock; | |
6 | 8 | import com.diligrp.etrade.shop.service.StockService; |
7 | 9 | import com.diligrp.idempotent.spring.boot.annotation.Idempotent; |
8 | 10 | import org.springframework.web.bind.annotation.*; |
9 | 11 | |
12 | +import java.util.Collections; | |
10 | 13 | import java.util.List; |
11 | 14 | |
12 | 15 | /** |
... | ... | @@ -52,4 +55,17 @@ public class StockApi { |
52 | 55 | return Message.success(); |
53 | 56 | } |
54 | 57 | |
58 | + | |
59 | + /** | |
60 | + * Batch query stock data | |
61 | + * | |
62 | + * @param productIds List of product IDs to query stock for | |
63 | + * @return List of Stock information associated with the given product IDs | |
64 | + */ | |
65 | + @PostMapping("/batch-query") | |
66 | + public Message<List<Stock>> batchQuery(@RequestBody List<Long> productIds) { | |
67 | + List<Stock> stockList = stockService.listByProductIds(productIds); | |
68 | + return Message.success(stockList); | |
69 | + } | |
70 | + | |
55 | 71 | } | ... | ... |