1.
phpcjl
2024-12-09 3d6c34f45d76b78151d6586f93acca2943698b08
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
package com.ruoyi.order.controller;
 
 
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.ruoyi.common.core.domain.R;
import com.ruoyi.common.core.web.controller.BaseController;
import com.ruoyi.order.model.OrderGood;
import com.ruoyi.order.service.OrderGoodService;
import org.springframework.web.bind.annotation.*;
 
import javax.annotation.Resource;
import java.util.List;
 
/**
 * <p>
 *  前端控制器
 * </p>
 *
 * @author luodangjia
 * @since 2024-11-21
 */
@RestController
@RequestMapping("/order-good")
public class OrderGoodController extends BaseController {
    @Resource
    private OrderGoodService orderGoodService;
 
    /**
     * 查询指定商品订单
     */
    @PostMapping("/selectGoodsOrder")
    public R<List<OrderGood>> selectGoodsOrder(@RequestBody List<Long> goodsIds){
        startPage();
        List<OrderGood> orderGoods = orderGoodService.list(new LambdaQueryWrapper<OrderGood>()
                .in(OrderGood::getGoodsId, goodsIds));
        return R.ok(orderGoods);
    }
 
    @GetMapping("/getOrderListByUserIdAndGoodsId")
    public R<List<OrderGood>> getOrderListByUserIdAndGoodsId(Long userId, Long goodsId){
        return R.ok(orderGoodService.getOrderListByUserIdAndGoodsId(userId, goodsId));
    }
}