diff --git a/yudao-module-mall/yudao-module-promotion-biz/src/main/java/cn/iocoder/yudao/module/promotion/controller/admin/coupon/CouponTemplateController.java b/yudao-module-mall/yudao-module-promotion-biz/src/main/java/cn/iocoder/yudao/module/promotion/controller/admin/coupon/CouponTemplateController.java index 69e39d13ce..271d71131c 100755 --- a/yudao-module-mall/yudao-module-promotion-biz/src/main/java/cn/iocoder/yudao/module/promotion/controller/admin/coupon/CouponTemplateController.java +++ b/yudao-module-mall/yudao-module-promotion-biz/src/main/java/cn/iocoder/yudao/module/promotion/controller/admin/coupon/CouponTemplateController.java @@ -16,6 +16,9 @@ import org.springframework.web.bind.annotation.*; import javax.annotation.Resource; import javax.validation.Valid; +import java.util.Collection; +import java.util.List; + import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success; @Tag(name = "管理后台 - 优惠劵模板") @@ -75,4 +78,14 @@ public class CouponTemplateController { PageResult pageResult = couponTemplateService.getCouponTemplatePage(pageVO); return success(CouponTemplateConvert.INSTANCE.convertPage(pageResult)); } + + @GetMapping("/list") + @Operation(summary = "获得优惠劵模板列表") + @Parameter(name = "ids", description = "编号列表", required = true, example = "1024,2048") + @PreAuthorize("@ss.hasPermission('promotion:coupon-template:query')") + public CommonResult> getCouponTemplateList(@RequestParam("ids") Collection ids) { + List list = couponTemplateService.getCouponTemplateList(ids); + return success(CouponTemplateConvert.INSTANCE.convertList(list)); + } + } diff --git a/yudao-module-mall/yudao-module-promotion-biz/src/main/java/cn/iocoder/yudao/module/promotion/controller/app/coupon/AppCouponTemplateController.java b/yudao-module-mall/yudao-module-promotion-biz/src/main/java/cn/iocoder/yudao/module/promotion/controller/app/coupon/AppCouponTemplateController.java index 16ddb7a5b0..b4bab466a6 100755 --- a/yudao-module-mall/yudao-module-promotion-biz/src/main/java/cn/iocoder/yudao/module/promotion/controller/app/coupon/AppCouponTemplateController.java +++ b/yudao-module-mall/yudao-module-promotion-biz/src/main/java/cn/iocoder/yudao/module/promotion/controller/app/coupon/AppCouponTemplateController.java @@ -69,6 +69,20 @@ public class AppCouponTemplateController { return success(CouponTemplateConvert.INSTANCE.convertAppList(list, canCanTakeMap)); } + @GetMapping("/list-by-ids") + @Operation(summary = "获得优惠劵模版列表") + @Parameter(name = "ids", description = "优惠券模板编号列表") + public CommonResult> getCouponTemplateList( + @RequestParam(value = "ids", required = false) Set ids) { + // 1. 查询 + List list = couponTemplateService.getCouponTemplateList(ids); + + // 2.1 领取数量 + Map canCanTakeMap = couponService.getUserCanCanTakeMap(getLoginUserId(), list); + // 2.2 拼接返回 + return success(CouponTemplateConvert.INSTANCE.convertAppList(list, canCanTakeMap)); + } + @GetMapping("/page") @Operation(summary = "获得优惠劵模版分页") public CommonResult> getCouponTemplatePage(AppCouponTemplatePageReqVO pageReqVO) { diff --git a/yudao-module-mall/yudao-module-promotion-biz/src/main/java/cn/iocoder/yudao/module/promotion/convert/coupon/CouponTemplateConvert.java b/yudao-module-mall/yudao-module-promotion-biz/src/main/java/cn/iocoder/yudao/module/promotion/convert/coupon/CouponTemplateConvert.java index e09d0f0137..c6b86da38f 100755 --- a/yudao-module-mall/yudao-module-promotion-biz/src/main/java/cn/iocoder/yudao/module/promotion/convert/coupon/CouponTemplateConvert.java +++ b/yudao-module-mall/yudao-module-promotion-biz/src/main/java/cn/iocoder/yudao/module/promotion/convert/coupon/CouponTemplateConvert.java @@ -58,4 +58,6 @@ public interface CouponTemplateConvert { } } + List convertList(List list); + }