1
This commit is contained in:
@@ -6,7 +6,9 @@ import javax.servlet.http.HttpServletRequest;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
|
||||
import com.ruoyi.jarvis.domain.GiftCoupon;
|
||||
import com.ruoyi.jarvis.domain.OrderRows;
|
||||
import com.ruoyi.jarvis.service.IGiftCouponService;
|
||||
import com.ruoyi.jarvis.service.IOrderRowsService;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
import com.ruoyi.common.annotation.Log;
|
||||
import com.ruoyi.common.core.controller.BaseController;
|
||||
@@ -25,9 +27,11 @@ import com.ruoyi.common.core.page.TableDataInfo;
|
||||
public class GiftCouponController extends BaseController {
|
||||
|
||||
private final IGiftCouponService giftCouponService;
|
||||
private final IOrderRowsService orderRowsService;
|
||||
|
||||
public GiftCouponController(IGiftCouponService giftCouponService) {
|
||||
public GiftCouponController(IGiftCouponService giftCouponService, IOrderRowsService orderRowsService) {
|
||||
this.giftCouponService = giftCouponService;
|
||||
this.orderRowsService = orderRowsService;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -79,7 +83,31 @@ public class GiftCouponController extends BaseController {
|
||||
*/
|
||||
@GetMapping(value = "/{giftCouponKey}")
|
||||
public AjaxResult getInfo(@PathVariable("giftCouponKey") String giftCouponKey) {
|
||||
return success(giftCouponService.selectGiftCouponByKey(giftCouponKey));
|
||||
GiftCoupon giftCoupon = giftCouponService.selectGiftCouponByKey(giftCouponKey);
|
||||
if (giftCoupon != null) {
|
||||
// 查询关联的订单
|
||||
OrderRows query = new OrderRows();
|
||||
query.setGiftCouponKey(giftCouponKey);
|
||||
List<OrderRows> orders = orderRowsService.selectOrderRowsList(query);
|
||||
// 将订单列表添加到返回数据中
|
||||
java.util.Map<String, Object> result = new java.util.HashMap<>();
|
||||
result.put("giftCoupon", giftCoupon);
|
||||
result.put("orders", orders);
|
||||
return success(result);
|
||||
}
|
||||
return success(giftCoupon);
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询礼金关联的订单列表
|
||||
*/
|
||||
@GetMapping("/{giftCouponKey}/orders")
|
||||
public TableDataInfo getOrders(@PathVariable("giftCouponKey") String giftCouponKey) {
|
||||
startPage();
|
||||
OrderRows query = new OrderRows();
|
||||
query.setGiftCouponKey(giftCouponKey);
|
||||
List<OrderRows> list = orderRowsService.selectOrderRowsList(query);
|
||||
return getDataTable(list);
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user