营销:适配商城装修组件【优惠券】

This commit is contained in:
owen 2023-11-22 16:58:01 +08:00
parent c7a21b2a64
commit 49accc946d
3 changed files with 31 additions and 0 deletions

View File

@ -16,6 +16,9 @@ import org.springframework.web.bind.annotation.*;
import javax.annotation.Resource; import javax.annotation.Resource;
import javax.validation.Valid; import javax.validation.Valid;
import java.util.Collection;
import java.util.List;
import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success; import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success;
@Tag(name = "管理后台 - 优惠劵模板") @Tag(name = "管理后台 - 优惠劵模板")
@ -75,4 +78,14 @@ public class CouponTemplateController {
PageResult<CouponTemplateDO> pageResult = couponTemplateService.getCouponTemplatePage(pageVO); PageResult<CouponTemplateDO> pageResult = couponTemplateService.getCouponTemplatePage(pageVO);
return success(CouponTemplateConvert.INSTANCE.convertPage(pageResult)); 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<List<CouponTemplateRespVO>> getCouponTemplateList(@RequestParam("ids") Collection<Long> ids) {
List<CouponTemplateDO> list = couponTemplateService.getCouponTemplateList(ids);
return success(CouponTemplateConvert.INSTANCE.convertList(list));
}
} }

View File

@ -69,6 +69,22 @@ public class AppCouponTemplateController {
return success(CouponTemplateConvert.INSTANCE.convertAppList(list, canCanTakeMap)); return success(CouponTemplateConvert.INSTANCE.convertAppList(list, canCanTakeMap));
} }
@GetMapping("/list-by-ids")
@Operation(summary = "获得优惠劵模版列表")
@Parameters({
@Parameter(name = "ids", description = "优惠券模板编号列表")
})
public CommonResult<List<AppCouponTemplateRespVO>> getCouponTemplateList(
@RequestParam(value = "ids", required = false) Set<Long> ids) {
// 1. 查询
List<CouponTemplateDO> list = couponTemplateService.getCouponTemplateList(ids);
// 2.1 领取数量
Map<Long, Boolean> canCanTakeMap = couponService.getUserCanCanTakeMap(getLoginUserId(), list);
// 2.2 拼接返回
return success(CouponTemplateConvert.INSTANCE.convertAppList(list, canCanTakeMap));
}
@GetMapping("/page") @GetMapping("/page")
@Operation(summary = "获得优惠劵模版分页") @Operation(summary = "获得优惠劵模版分页")
public CommonResult<PageResult<AppCouponTemplateRespVO>> getCouponTemplatePage(AppCouponTemplatePageReqVO pageReqVO) { public CommonResult<PageResult<AppCouponTemplateRespVO>> getCouponTemplatePage(AppCouponTemplatePageReqVO pageReqVO) {

View File

@ -58,4 +58,6 @@ public interface CouponTemplateConvert {
} }
} }
List<CouponTemplateRespVO> convertList(List<CouponTemplateDO> list);
} }