package com.xiaopeng.operation.controller;
|
|
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
import com.xiaopeng.api.model.operation.XpCoupon;
|
import com.xiaopeng.common.core.domain.R;
|
import com.xiaopeng.operation.query.XpCouponListQuery;
|
import com.xiaopeng.operation.service.IXpCouponService;
|
import com.xiaopeng.operation.vo.XpBannerListVo;
|
import io.swagger.annotations.ApiOperation;
|
import org.springframework.web.bind.annotation.PostMapping;
|
import org.springframework.web.bind.annotation.RequestBody;
|
import org.springframework.web.bind.annotation.RequestMapping;
|
|
import org.springframework.stereotype.Controller;
|
import org.springframework.web.bind.annotation.RequestParam;
|
|
import java.util.List;
|
|
/**
|
* <p>
|
* 优惠券管理 前端控制器
|
* </p>
|
*
|
* @author mitao
|
* @since 2026-02-03
|
*/
|
@Controller
|
@RequestMapping("")
|
public class XpCouponController {
|
|
private final IXpCouponService xpCouponService;
|
|
public XpCouponController(IXpCouponService xpCouponService) {
|
this.xpCouponService = xpCouponService;
|
}
|
|
|
@PostMapping("/inner/xp-coupon/getCouponById")
|
public R<XpCoupon> getCouponById(@RequestParam Long couponId){
|
XpCoupon xpCoupon = xpCouponService.getById(couponId);
|
return R.ok(xpCoupon);
|
}
|
|
|
// 优惠券列表
|
@PostMapping("/v1/api/xp-coupon/list")
|
@ApiOperation(value = "优惠券列表",tags = {"管理后台-优惠券列表"},response = XpCoupon.class)
|
public R<Page<XpCoupon>> list(@RequestBody XpCouponListQuery query ){
|
return R.ok(xpCouponService.getList(query));
|
}
|
|
|
// 添加优惠券
|
@PostMapping("/v1/api/xp-coupon/add")
|
@ApiOperation(value = "添加优惠券",tags = {"管理后台-添加优惠券"},response = XpCoupon.class)
|
public R<?> add(@RequestBody XpCoupon xpCoupon){
|
xpCouponService.save(xpCoupon);
|
return R.ok();
|
}
|
|
}
|