commit
a8e8c14ab3
|
@ -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<CouponTemplateDO> 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<List<CouponTemplateRespVO>> getCouponTemplateList(@RequestParam("ids") Collection<Long> ids) {
|
||||
List<CouponTemplateDO> list = couponTemplateService.getCouponTemplateList(ids);
|
||||
return success(CouponTemplateConvert.INSTANCE.convertList(list));
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -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<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")
|
||||
@Operation(summary = "获得优惠劵模版分页")
|
||||
public CommonResult<PageResult<AppCouponTemplateRespVO>> getCouponTemplatePage(AppCouponTemplatePageReqVO pageReqVO) {
|
||||
|
|
|
@ -58,4 +58,6 @@ public interface CouponTemplateConvert {
|
|||
}
|
||||
}
|
||||
|
||||
List<CouponTemplateRespVO> convertList(List<CouponTemplateDO> list);
|
||||
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue