xuhy
2025-01-15 c27c1f2beb4ca89a94eaa854fce6b4553db8f2f8
ruoyi-service/ruoyi-order/src/main/java/com/ruoyi/order/controller/OrderGoodController.java
New file
@@ -0,0 +1,44 @@
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, Integer goodsId){
        return R.ok(orderGoodService.getOrderListByUserIdAndGoodsId(userId, goodsId));
    }
}