后端 + 前端:优惠劵列表
This commit is contained in:
@@ -4,8 +4,11 @@ import cn.iocoder.common.framework.util.DateUtil;
|
||||
import cn.iocoder.common.framework.vo.CommonResult;
|
||||
import cn.iocoder.mall.promotion.api.CouponService;
|
||||
import cn.iocoder.mall.promotion.api.bo.CouponTemplateBO;
|
||||
import cn.iocoder.mall.promotion.api.bo.CouponTemplatePageBO;
|
||||
import cn.iocoder.mall.promotion.api.dto.CouponCardTemplateAddDTO;
|
||||
import cn.iocoder.mall.promotion.api.dto.CouponTemplatePageDTO;
|
||||
import cn.iocoder.mall.promotion.application.convert.CouponTemplateConvert;
|
||||
import cn.iocoder.mall.promotion.application.vo.admins.AdminsCouponTemplatePageVO;
|
||||
import cn.iocoder.mall.promotion.application.vo.admins.AdminsCouponTemplateVO;
|
||||
import com.alibaba.dubbo.config.annotation.Reference;
|
||||
import io.swagger.annotations.Api;
|
||||
@@ -13,10 +16,7 @@ import io.swagger.annotations.ApiImplicitParam;
|
||||
import io.swagger.annotations.ApiImplicitParams;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import org.springframework.format.annotation.DateTimeFormat;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RequestParam;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import java.util.Date;
|
||||
|
||||
@@ -30,6 +30,25 @@ public class AdminsCouponTemplateController {
|
||||
|
||||
// ========== 优惠劵(码)模板 ==========
|
||||
|
||||
@GetMapping("/template/page")
|
||||
@ApiOperation(value = "Banner 分页")
|
||||
@ApiImplicitParams({
|
||||
@ApiImplicitParam(name = "title", value = "标题,模糊匹配", example = "活动 A"),
|
||||
@ApiImplicitParam(name = "pageNo", value = "页码,从 1 开始", example = "1"),
|
||||
@ApiImplicitParam(name = "pageSize", value = "每页条数", required = true, example = "10"),
|
||||
})
|
||||
public CommonResult<AdminsCouponTemplatePageVO> page(@RequestParam(value = "type", required = false) Integer type,
|
||||
@RequestParam(value = "title", required = false) String title,
|
||||
@RequestParam(value = "status", required = false) Integer status,
|
||||
@RequestParam(value = "preferentialType", required = false) Integer preferentialType,
|
||||
@RequestParam(value = "pageNo", defaultValue = "0") Integer pageNo,
|
||||
@RequestParam(value = "pageSize", defaultValue = "10") Integer pageSize) {
|
||||
CommonResult<CouponTemplatePageBO> result = couponService.getCouponTemplatePage(new CouponTemplatePageDTO()
|
||||
.setType(type).setTitle(title).setStatus(status).setPreferentialType(preferentialType)
|
||||
.setPageNo(pageNo).setPageSize(pageSize));
|
||||
return CouponTemplateConvert.INSTANCE.convert(result);
|
||||
}
|
||||
|
||||
@PostMapping("/template/add_card")
|
||||
@ApiOperation(value = "创建优惠劵模板")
|
||||
@ApiImplicitParams({
|
||||
|
||||
@@ -2,26 +2,34 @@ package cn.iocoder.mall.promotion.application.convert;
|
||||
|
||||
import cn.iocoder.common.framework.vo.CommonResult;
|
||||
import cn.iocoder.mall.promotion.api.bo.CouponTemplateBO;
|
||||
import cn.iocoder.mall.promotion.api.bo.CouponTemplatePageBO;
|
||||
import cn.iocoder.mall.promotion.application.vo.admins.AdminsCouponTemplatePageVO;
|
||||
import cn.iocoder.mall.promotion.application.vo.admins.AdminsCouponTemplateVO;
|
||||
import org.mapstruct.Mapper;
|
||||
import org.mapstruct.Mappings;
|
||||
import org.mapstruct.factory.Mappers;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@Mapper
|
||||
public interface CouponTemplateConvert {
|
||||
|
||||
CouponTemplateConvert INSTANCE = Mappers.getMapper(CouponTemplateConvert.class);
|
||||
|
||||
@Mappings({})
|
||||
AdminsCouponTemplateVO convert(CouponTemplateBO bannerBO);
|
||||
AdminsCouponTemplateVO convert(CouponTemplateBO template);
|
||||
|
||||
@Mappings({})
|
||||
CommonResult<AdminsCouponTemplateVO> convert2(CommonResult<CouponTemplateBO> result);
|
||||
|
||||
// @Mappings({})
|
||||
// CommonResult<AdminsCouponTemplatePageVO> convert(CommonResult<CouponTemplatePageBO> result);
|
||||
@Mappings({})
|
||||
CommonResult<AdminsCouponTemplatePageVO> convert(CommonResult<CouponTemplatePageBO> result);
|
||||
|
||||
@Mappings({})
|
||||
List<AdminsCouponTemplateVO> convertList(List<CouponTemplateBO> templates);
|
||||
|
||||
//
|
||||
// @Mappings({})
|
||||
// List<UsersCouponTemplateVO> convertList(List<CouponTemplateBO> banners);
|
||||
// List<UsersCouponTemplateVO> convertList2(List<CouponTemplateBO> banners);
|
||||
|
||||
}
|
||||
|
||||
@@ -0,0 +1,34 @@
|
||||
package cn.iocoder.mall.promotion.application.vo.admins;
|
||||
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@ApiModel("优惠劵(码)分页 VO")
|
||||
public class AdminsCouponTemplatePageVO {
|
||||
|
||||
@ApiModelProperty(value = "优惠劵(码)数组")
|
||||
private List<AdminsCouponTemplateVO> list;
|
||||
@ApiModelProperty(value = "优惠劵(码)总数")
|
||||
private Integer total;
|
||||
|
||||
public List<AdminsCouponTemplateVO> getList() {
|
||||
return list;
|
||||
}
|
||||
|
||||
public AdminsCouponTemplatePageVO setList(List<AdminsCouponTemplateVO> list) {
|
||||
this.list = list;
|
||||
return this;
|
||||
}
|
||||
|
||||
public Integer getTotal() {
|
||||
return total;
|
||||
}
|
||||
|
||||
public AdminsCouponTemplatePageVO setTotal(Integer total) {
|
||||
this.total = total;
|
||||
return this;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -49,7 +49,7 @@ public class AdminsCouponTemplateVO {
|
||||
@ApiModelProperty(value = "固定日期-生效结束时间")
|
||||
private Date validEndTime;
|
||||
@ApiModelProperty(value = "领取日期-开始天数", example = "例如,0-当天;1-次天")
|
||||
private Integer fixedBeginTerm;
|
||||
private Integer fixedStartTerm;
|
||||
@ApiModelProperty(value = "领取日期-结束天数")
|
||||
private Integer fixedEndTerm;
|
||||
// ========== 使用规则 END ==========
|
||||
@@ -190,12 +190,12 @@ public class AdminsCouponTemplateVO {
|
||||
return this;
|
||||
}
|
||||
|
||||
public Integer getFixedBeginTerm() {
|
||||
return fixedBeginTerm;
|
||||
public Integer getFixedStartTerm() {
|
||||
return fixedStartTerm;
|
||||
}
|
||||
|
||||
public AdminsCouponTemplateVO setFixedBeginTerm(Integer fixedBeginTerm) {
|
||||
this.fixedBeginTerm = fixedBeginTerm;
|
||||
public AdminsCouponTemplateVO setFixedStartTerm(Integer fixedStartTerm) {
|
||||
this.fixedStartTerm = fixedStartTerm;
|
||||
return this;
|
||||
}
|
||||
|
||||
@@ -261,4 +261,13 @@ public class AdminsCouponTemplateVO {
|
||||
this.createTime = createTime;
|
||||
return this;
|
||||
}
|
||||
|
||||
public Integer getTotal() {
|
||||
return total;
|
||||
}
|
||||
|
||||
public AdminsCouponTemplateVO setTotal(Integer total) {
|
||||
this.total = total;
|
||||
return this;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user