From 243e976e859494cc2adca3088e04820c198eb7e8 Mon Sep 17 00:00:00 2001 From: YunaiV <> Date: Tue, 2 Apr 2019 19:50:28 +0800 Subject: [PATCH 1/2] =?UTF-8?q?=E5=90=8E=E7=AB=AF=EF=BC=9A=E4=BC=98?= =?UTF-8?q?=E6=83=A0=E5=8A=B5=20rpc=20api=20=E7=9A=84=E8=AE=BE=E8=AE=A1?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../mall/promotion/api/CouponService.java | 102 ++++++++++++++++++ .../mall/promotion/api/bo/CouponCardBO.java | 4 + .../api/bo/CouponCardTemplateBO.java | 4 + .../api/bo/CouponCardTemplatePageBO.java | 5 + .../api/bo/CouponCodeTemplateBO.java | 4 + .../api/bo/CouponCodeTemplatePageBO.java | 4 + .../api/dto/CouponCardTemplateAddDTO.java | 4 + .../api/dto/CouponCardTemplatePageDTO.java | 21 ++++ .../api/dto/CouponCardTemplateUpdateDTO.java | 4 + .../api/dto/CouponCodeTemplateAddDTO.java | 4 + .../api/dto/CouponCodeTemplatePageDTO.java | 21 ++++ .../api/dto/CouponCodeTemplateUpdateDTO.java | 4 + .../{CouponDO.java => CouponCardDO.java} | 17 ++- .../biz/dataobject/CouponTemplateDO.java | 21 ++-- .../biz/service/CouponServiceImpl.java | 4 + 15 files changed, 202 insertions(+), 21 deletions(-) create mode 100644 promotion/promotion-service-api/src/main/java/cn/iocoder/mall/promotion/api/CouponService.java create mode 100644 promotion/promotion-service-api/src/main/java/cn/iocoder/mall/promotion/api/bo/CouponCardBO.java create mode 100644 promotion/promotion-service-api/src/main/java/cn/iocoder/mall/promotion/api/bo/CouponCardTemplateBO.java create mode 100644 promotion/promotion-service-api/src/main/java/cn/iocoder/mall/promotion/api/bo/CouponCardTemplatePageBO.java create mode 100644 promotion/promotion-service-api/src/main/java/cn/iocoder/mall/promotion/api/bo/CouponCodeTemplateBO.java create mode 100644 promotion/promotion-service-api/src/main/java/cn/iocoder/mall/promotion/api/bo/CouponCodeTemplatePageBO.java create mode 100644 promotion/promotion-service-api/src/main/java/cn/iocoder/mall/promotion/api/dto/CouponCardTemplateAddDTO.java create mode 100644 promotion/promotion-service-api/src/main/java/cn/iocoder/mall/promotion/api/dto/CouponCardTemplatePageDTO.java create mode 100644 promotion/promotion-service-api/src/main/java/cn/iocoder/mall/promotion/api/dto/CouponCardTemplateUpdateDTO.java create mode 100644 promotion/promotion-service-api/src/main/java/cn/iocoder/mall/promotion/api/dto/CouponCodeTemplateAddDTO.java create mode 100644 promotion/promotion-service-api/src/main/java/cn/iocoder/mall/promotion/api/dto/CouponCodeTemplatePageDTO.java create mode 100644 promotion/promotion-service-api/src/main/java/cn/iocoder/mall/promotion/api/dto/CouponCodeTemplateUpdateDTO.java rename promotion/promotion-service-impl/src/main/java/cn/iocoder/mall/promotion/biz/dataobject/{CouponDO.java => CouponCardDO.java} (91%) create mode 100644 promotion/promotion-service-impl/src/main/java/cn/iocoder/mall/promotion/biz/service/CouponServiceImpl.java diff --git a/promotion/promotion-service-api/src/main/java/cn/iocoder/mall/promotion/api/CouponService.java b/promotion/promotion-service-api/src/main/java/cn/iocoder/mall/promotion/api/CouponService.java new file mode 100644 index 00000000..68800a93 --- /dev/null +++ b/promotion/promotion-service-api/src/main/java/cn/iocoder/mall/promotion/api/CouponService.java @@ -0,0 +1,102 @@ +package cn.iocoder.mall.promotion.api; + +import cn.iocoder.common.framework.vo.CommonResult; +import cn.iocoder.mall.promotion.api.bo.CouponCardBO; +import cn.iocoder.mall.promotion.api.bo.CouponCardTemplatePageBO; +import cn.iocoder.mall.promotion.api.bo.CouponCodeTemplateBO; +import cn.iocoder.mall.promotion.api.bo.CouponCodeTemplatePageBO; +import cn.iocoder.mall.promotion.api.dto.*; + +public interface CouponService { + + // ========== 优惠劵(码)模板 ========== + + CommonResult getCouponCodeTemplatePage(CouponCodeTemplatePageDTO couponCodeTemplatePageDTO); + + CommonResult getCouponCardTemplatePage(CouponCardTemplatePageDTO couponCardTemplatePageDTO); + + /** + * 创建优惠码模板 + * + * @param couponCodeTemplateAddDTO 优惠码模板添加 DTO + * @return 优惠码模板 + */ + CommonResult addCouponCodeTemplate(CouponCodeTemplateAddDTO couponCodeTemplateAddDTO); + + /** + * 创建优惠劵模板 + * + * @param couponCardTemplateAddDTO 优惠码模板添加 DTO + * @return 优惠劵模板 + */ + CommonResult addCouponCardTemplate(CouponCardTemplateAddDTO couponCardTemplateAddDTO); + + /** + * 更新优惠码模板 + * + * @param couponCodeTemplateUpdateDTO 优惠码模板修改 DTO + * @return 是否成功 + */ + CommonResult updateCouponCodeTemplate(CouponCodeTemplateUpdateDTO couponCodeTemplateUpdateDTO); + + /** + * 更新优惠劵模板 + * + * @param couponCardTemplateUpdateDTO 优惠劵模板修改 DTO + * @return 是否成功 + */ + CommonResult updateCouponCardTemplate(CouponCardTemplateUpdateDTO couponCardTemplateUpdateDTO); + + /** + * 更新优惠劵(码)模板的状态 + * + * @param adminId 操作管理员编号 + * @param couponTemplateId 模板编号 + * @param status 状态 + * @return 是否成功 + */ + CommonResult updateCouponTemplateStatus(Integer adminId, Integer couponTemplateId, Integer status); + + // ========== 优惠劵 ========== + + /** + * 基于优惠劵模板,领取优惠劵 + * + * @param userId 用户编号 + * @param couponTemplateId 优惠劵模板 + * @return 优惠劵 + */ + CommonResult addCouponCard(Integer userId, Integer couponTemplateId); + + /** + * 使用优惠劵下单 + * + * @param userId 用户编号 + * @param couponCardId 优惠劵编号 + * @param usedOrderId 下单的编号 + * @param usedPrice 下单的价格 + * @return 是否成功 + */ + CommonResult useCouponCard(Integer userId, Integer couponCardId, Integer usedOrderId, Integer usedPrice); + + /** + * 取消优惠劵的使用 + * + * @param userId 用户编号 + * @param couponCardId 优惠劵编号 + * @return 是否成功 + */ + CommonResult cancelUseCouponCard(Integer userId, Integer couponCardId); + + // ========== 优惠码 ========== + + /** + * 使用优惠码,兑换优惠劵 + * + * @param userId 用户编号 + * @param code 优惠码 + * @return 优惠劵 + */ + CommonResult useCouponCode(Integer userId, String code); + +} diff --git a/promotion/promotion-service-api/src/main/java/cn/iocoder/mall/promotion/api/bo/CouponCardBO.java b/promotion/promotion-service-api/src/main/java/cn/iocoder/mall/promotion/api/bo/CouponCardBO.java new file mode 100644 index 00000000..4239b9aa --- /dev/null +++ b/promotion/promotion-service-api/src/main/java/cn/iocoder/mall/promotion/api/bo/CouponCardBO.java @@ -0,0 +1,4 @@ +package cn.iocoder.mall.promotion.api.bo; + +public class CouponCardBO { +} diff --git a/promotion/promotion-service-api/src/main/java/cn/iocoder/mall/promotion/api/bo/CouponCardTemplateBO.java b/promotion/promotion-service-api/src/main/java/cn/iocoder/mall/promotion/api/bo/CouponCardTemplateBO.java new file mode 100644 index 00000000..3f83b06c --- /dev/null +++ b/promotion/promotion-service-api/src/main/java/cn/iocoder/mall/promotion/api/bo/CouponCardTemplateBO.java @@ -0,0 +1,4 @@ +package cn.iocoder.mall.promotion.api.bo; + +public class CouponCardTemplateBO { +} diff --git a/promotion/promotion-service-api/src/main/java/cn/iocoder/mall/promotion/api/bo/CouponCardTemplatePageBO.java b/promotion/promotion-service-api/src/main/java/cn/iocoder/mall/promotion/api/bo/CouponCardTemplatePageBO.java new file mode 100644 index 00000000..2f9fddbe --- /dev/null +++ b/promotion/promotion-service-api/src/main/java/cn/iocoder/mall/promotion/api/bo/CouponCardTemplatePageBO.java @@ -0,0 +1,5 @@ +package cn.iocoder.mall.promotion.api.bo; + +public class CouponCardTemplatePageBO { + +} diff --git a/promotion/promotion-service-api/src/main/java/cn/iocoder/mall/promotion/api/bo/CouponCodeTemplateBO.java b/promotion/promotion-service-api/src/main/java/cn/iocoder/mall/promotion/api/bo/CouponCodeTemplateBO.java new file mode 100644 index 00000000..bb890270 --- /dev/null +++ b/promotion/promotion-service-api/src/main/java/cn/iocoder/mall/promotion/api/bo/CouponCodeTemplateBO.java @@ -0,0 +1,4 @@ +package cn.iocoder.mall.promotion.api.bo; + +public class CouponCodeTemplateBO { +} diff --git a/promotion/promotion-service-api/src/main/java/cn/iocoder/mall/promotion/api/bo/CouponCodeTemplatePageBO.java b/promotion/promotion-service-api/src/main/java/cn/iocoder/mall/promotion/api/bo/CouponCodeTemplatePageBO.java new file mode 100644 index 00000000..48fd8c69 --- /dev/null +++ b/promotion/promotion-service-api/src/main/java/cn/iocoder/mall/promotion/api/bo/CouponCodeTemplatePageBO.java @@ -0,0 +1,4 @@ +package cn.iocoder.mall.promotion.api.bo; + +public class CouponCodeTemplatePageBO { +} diff --git a/promotion/promotion-service-api/src/main/java/cn/iocoder/mall/promotion/api/dto/CouponCardTemplateAddDTO.java b/promotion/promotion-service-api/src/main/java/cn/iocoder/mall/promotion/api/dto/CouponCardTemplateAddDTO.java new file mode 100644 index 00000000..e283db5f --- /dev/null +++ b/promotion/promotion-service-api/src/main/java/cn/iocoder/mall/promotion/api/dto/CouponCardTemplateAddDTO.java @@ -0,0 +1,4 @@ +package cn.iocoder.mall.promotion.api.dto; + +public class CouponCardTemplateAddDTO { +} diff --git a/promotion/promotion-service-api/src/main/java/cn/iocoder/mall/promotion/api/dto/CouponCardTemplatePageDTO.java b/promotion/promotion-service-api/src/main/java/cn/iocoder/mall/promotion/api/dto/CouponCardTemplatePageDTO.java new file mode 100644 index 00000000..098046c1 --- /dev/null +++ b/promotion/promotion-service-api/src/main/java/cn/iocoder/mall/promotion/api/dto/CouponCardTemplatePageDTO.java @@ -0,0 +1,21 @@ +package cn.iocoder.mall.promotion.api.dto; + +/** + * 优惠劵模板分页 DTO + */ +public class CouponCardTemplatePageDTO { + + /** + * 标题 + */ + private String title; + /** + * 状态 + */ + private Integer status; + /** + * 优惠类型 + */ + private Integer preferentialType; + +} diff --git a/promotion/promotion-service-api/src/main/java/cn/iocoder/mall/promotion/api/dto/CouponCardTemplateUpdateDTO.java b/promotion/promotion-service-api/src/main/java/cn/iocoder/mall/promotion/api/dto/CouponCardTemplateUpdateDTO.java new file mode 100644 index 00000000..e64efa7a --- /dev/null +++ b/promotion/promotion-service-api/src/main/java/cn/iocoder/mall/promotion/api/dto/CouponCardTemplateUpdateDTO.java @@ -0,0 +1,4 @@ +package cn.iocoder.mall.promotion.api.dto; + +public class CouponCardTemplateUpdateDTO { +} diff --git a/promotion/promotion-service-api/src/main/java/cn/iocoder/mall/promotion/api/dto/CouponCodeTemplateAddDTO.java b/promotion/promotion-service-api/src/main/java/cn/iocoder/mall/promotion/api/dto/CouponCodeTemplateAddDTO.java new file mode 100644 index 00000000..85a30724 --- /dev/null +++ b/promotion/promotion-service-api/src/main/java/cn/iocoder/mall/promotion/api/dto/CouponCodeTemplateAddDTO.java @@ -0,0 +1,4 @@ +package cn.iocoder.mall.promotion.api.dto; + +public class CouponCodeTemplateAddDTO { +} diff --git a/promotion/promotion-service-api/src/main/java/cn/iocoder/mall/promotion/api/dto/CouponCodeTemplatePageDTO.java b/promotion/promotion-service-api/src/main/java/cn/iocoder/mall/promotion/api/dto/CouponCodeTemplatePageDTO.java new file mode 100644 index 00000000..98552aba --- /dev/null +++ b/promotion/promotion-service-api/src/main/java/cn/iocoder/mall/promotion/api/dto/CouponCodeTemplatePageDTO.java @@ -0,0 +1,21 @@ +package cn.iocoder.mall.promotion.api.dto; + +/** + * 优惠码模板分页 DTO + */ +public class CouponCodeTemplatePageDTO { + + /** + * 标题 + */ + private String title; + /** + * 状态 + */ + private Integer status; + /** + * 优惠类型 + */ + private Integer preferentialType; + +} diff --git a/promotion/promotion-service-api/src/main/java/cn/iocoder/mall/promotion/api/dto/CouponCodeTemplateUpdateDTO.java b/promotion/promotion-service-api/src/main/java/cn/iocoder/mall/promotion/api/dto/CouponCodeTemplateUpdateDTO.java new file mode 100644 index 00000000..8a88fb15 --- /dev/null +++ b/promotion/promotion-service-api/src/main/java/cn/iocoder/mall/promotion/api/dto/CouponCodeTemplateUpdateDTO.java @@ -0,0 +1,4 @@ +package cn.iocoder.mall.promotion.api.dto; + +public class CouponCodeTemplateUpdateDTO { +} diff --git a/promotion/promotion-service-impl/src/main/java/cn/iocoder/mall/promotion/biz/dataobject/CouponDO.java b/promotion/promotion-service-impl/src/main/java/cn/iocoder/mall/promotion/biz/dataobject/CouponCardDO.java similarity index 91% rename from promotion/promotion-service-impl/src/main/java/cn/iocoder/mall/promotion/biz/dataobject/CouponDO.java rename to promotion/promotion-service-impl/src/main/java/cn/iocoder/mall/promotion/biz/dataobject/CouponCardDO.java index 9e62e583..ed966e70 100644 --- a/promotion/promotion-service-impl/src/main/java/cn/iocoder/mall/promotion/biz/dataobject/CouponDO.java +++ b/promotion/promotion-service-impl/src/main/java/cn/iocoder/mall/promotion/biz/dataobject/CouponCardDO.java @@ -7,7 +7,7 @@ import java.util.Date; /** * 优惠劵 DO */ -public class CouponDO extends BaseDO { +public class CouponCardDO extends BaseDO { // ========== 基本信息 BEGIN ========== /** @@ -25,13 +25,9 @@ public class CouponDO extends BaseDO { /** * 优惠码状态 * - * 1-生效中 - * 2-已失效 - * 3-已过期 - * 4-已删除 - * 5-已使用 - * - * TODO 需要讨论下 + * 1-未使用 + * 2-已使用 + * 3-已失效 */ private Integer status; @@ -103,6 +99,9 @@ public class CouponDO extends BaseDO { * 使用时间 */ private Date usedTime; + + // TODO 芋艿,后续要加优惠劵的使用日志,因为下单后,可能会取消。 + // ========== 使用情况 END ========== -} \ No newline at end of file +} diff --git a/promotion/promotion-service-impl/src/main/java/cn/iocoder/mall/promotion/biz/dataobject/CouponTemplateDO.java b/promotion/promotion-service-impl/src/main/java/cn/iocoder/mall/promotion/biz/dataobject/CouponTemplateDO.java index a141ff54..fb418c8d 100644 --- a/promotion/promotion-service-impl/src/main/java/cn/iocoder/mall/promotion/biz/dataobject/CouponTemplateDO.java +++ b/promotion/promotion-service-impl/src/main/java/cn/iocoder/mall/promotion/biz/dataobject/CouponTemplateDO.java @@ -7,7 +7,7 @@ import java.util.Date; /** * 优惠劵(码)模板 DO * - * 当用户领取时,会生成 {@link CouponDO} 优惠劵(码)。 + * 当用户领取时,会生成 {@link CouponCardDO} 优惠劵(码)。 */ public class CouponTemplateDO extends BaseDO { @@ -43,14 +43,11 @@ public class CouponTemplateDO extends BaseDO { /** * 优惠码状态 * - * 1-生效中 - * 2-已失效 + * 1-开启中 + * 2-禁用中 * 3-已过期 - * 4-已删除 * - * 当优惠劵(码)有效时,可以手动操作,设置成无效。 - * - * TODO 需要讨论下 + * 当优惠劵(码)开启中,可以手动操作,设置禁用中。 */ private Integer status; // /** @@ -61,10 +58,10 @@ public class CouponTemplateDO extends BaseDO { * 设置为失效时间 */ private Date invalidTime; - /** - * 删除时间 - */ - private Date deleteTime; +// /** +// * 删除时间 +// */ +// private Date deleteTime; /** * 可领取的开始时间 */ @@ -221,4 +218,4 @@ public class CouponTemplateDO extends BaseDO { // private Integer statUseNum; // // ========== 统计信息 END ========== -} \ No newline at end of file +} diff --git a/promotion/promotion-service-impl/src/main/java/cn/iocoder/mall/promotion/biz/service/CouponServiceImpl.java b/promotion/promotion-service-impl/src/main/java/cn/iocoder/mall/promotion/biz/service/CouponServiceImpl.java new file mode 100644 index 00000000..d285abc6 --- /dev/null +++ b/promotion/promotion-service-impl/src/main/java/cn/iocoder/mall/promotion/biz/service/CouponServiceImpl.java @@ -0,0 +1,4 @@ +package cn.iocoder.mall.promotion.biz.service; + +public class CouponServiceImpl { +} From e1db53e3579ef72bb27baf194d461edd9ac0db4d Mon Sep 17 00:00:00 2001 From: YunaiV <> Date: Wed, 3 Apr 2019 00:05:56 +0800 Subject: [PATCH 2/2] =?UTF-8?q?=E5=90=8E=E7=AB=AF=EF=BC=9A=E4=BC=98?= =?UTF-8?q?=E6=83=A0=E5=8A=B5=20rpc=20api=20=E7=9A=84=E8=AE=BE=E8=AE=A1=20?= =?UTF-8?q?=E5=90=8E=E7=AB=AF=EF=BC=9A=E4=BC=98=E6=83=A0=E5=8A=B5=E6=A8=A1?= =?UTF-8?q?=E6=9D=BF=20mapper=20=E7=BC=96=E5=86=99?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../api/dto/CouponCardTemplateAddDTO.java | 115 ++++++++++++++ .../biz/dao/CouponTemplateMapper.java | 28 ++++ .../biz/dataobject/CouponTemplateDO.java | 24 +-- .../resources/mapper/CouponTemplateMapper.xml | 143 ++++++++++++++++++ 4 files changed, 294 insertions(+), 16 deletions(-) create mode 100644 promotion/promotion-service-impl/src/main/java/cn/iocoder/mall/promotion/biz/dao/CouponTemplateMapper.java create mode 100644 promotion/promotion-service-impl/src/main/resources/mapper/CouponTemplateMapper.xml diff --git a/promotion/promotion-service-api/src/main/java/cn/iocoder/mall/promotion/api/dto/CouponCardTemplateAddDTO.java b/promotion/promotion-service-api/src/main/java/cn/iocoder/mall/promotion/api/dto/CouponCardTemplateAddDTO.java index e283db5f..825c01d0 100644 --- a/promotion/promotion-service-api/src/main/java/cn/iocoder/mall/promotion/api/dto/CouponCardTemplateAddDTO.java +++ b/promotion/promotion-service-api/src/main/java/cn/iocoder/mall/promotion/api/dto/CouponCardTemplateAddDTO.java @@ -1,4 +1,119 @@ package cn.iocoder.mall.promotion.api.dto; +import org.hibernate.validator.constraints.Length; + +import javax.validation.constraints.NotEmpty; +import javax.validation.constraints.NotNull; +import java.util.Date; + public class CouponCardTemplateAddDTO { + + // ========== 基本信息 BEGIN ========== + /** + * 标题 + */ + @NotEmpty(message = "标题不能为空") + @Length(min = 6, max = 16, message = "标题长度为 {min}-{max} 位") + private String title; + /** + * 使用说明 + */ + @Length(max = 255, message = "使用说明最大长度为 {max} 位") + private String description; + // ========== 基本信息 END ========== + + // ========== 领取规则 BEGIN ========== + /** + * 每人限领个数 + * + * null - 则表示不限制 + */ + private Integer quota; + /** + * 剩余可用库存 + * + * null - 则表示无限库存 + */ + private Integer stock; + // ========== 领取规则 END ========== + + // ========== 使用规则 BEGIN ========== + /** + * 是否设置满多少金额可用,单位:分 + * + * 0-不限制 + * 大于0-多少金额可用 + */ + @NotNull(message = "使用金额门槛不能为空") + private Integer priceAvailable; + /** + * 可用范围的类型 + * + * 10-全部(ALL):所有可用 + * 20-部分(PART):部分商品可用,或指定商品可用 + * 21-部分(PART):部分商品不可用,或指定商品可用 + * 30-部分(PART):部分分类可用,或指定商品可用 + * 31-部分(PART):部分分类不可用,或指定商品可用 + */ + @NotNull(message = "可用范围的类型不能为空") + private Integer rangeType; + /** + * 指定商品 / 分类列表,使用逗号分隔商品编号 + */ + private String rangeValues; + /** + * 生效日期类型 + * + * 1-固定日期 + * 2-领取日期:领到券 {@link #fixedTerm} 日开始 N 天内有效 + */ + @NotNull(message = "生效日期类型不能为空") + private Integer dateType; + /** + * 固定日期-生效开始时间 + */ + private Date validStartTime; + /** + * 固定日期-生效结束时间 + */ + private Date validEndTime; +// /** +// * 领取日期-开始天数 +// * +// * 例如,0-当天;1-次天 +// */ +// private Integer fixedBeginTerm; + /** + * 领取日期-结束天数 + */ + private Integer fixedTerm; + // ========== 使用规则 END ========== + + // ========== 使用效果 BEGIN ========== + /** + * 优惠类型 + * + * 1-代金卷 + * 2-折扣卷 + */ + private Integer preferentialType; + /** + * 折扣百分比。 + * + * 例如,80% 为 80。 + * 当 100% 为 100 ,则代表免费。 + */ + private Integer percentOff; + /** + * 优惠金额,单位:分 + */ + private Integer priceOff; + /** + * 折扣上限,仅在 {@link #preferentialType} 等于 2 时生效。 + * + * 例如,折扣上限为 20 元,当使用 8 折优惠券,订单金额为 1000 元时,最高只可折扣 20 元,而非 80 元。 + */ + private Integer discountPriceLimit; + // ========== 使用效果 END ========== + } diff --git a/promotion/promotion-service-impl/src/main/java/cn/iocoder/mall/promotion/biz/dao/CouponTemplateMapper.java b/promotion/promotion-service-impl/src/main/java/cn/iocoder/mall/promotion/biz/dao/CouponTemplateMapper.java new file mode 100644 index 00000000..524c75d0 --- /dev/null +++ b/promotion/promotion-service-impl/src/main/java/cn/iocoder/mall/promotion/biz/dao/CouponTemplateMapper.java @@ -0,0 +1,28 @@ +package cn.iocoder.mall.promotion.biz.dao; + +import cn.iocoder.mall.promotion.biz.dataobject.CouponTemplateDO; +import org.apache.ibatis.annotations.Param; +import org.springframework.stereotype.Repository; + +import java.util.List; + +@Repository +public interface CouponTemplateMapper { + + CouponTemplateDO selectById(@Param("id") Integer id); + + List selectListByPage(@Param("title") String title, + @Param("status") Integer status, + @Param("preferentialType") Integer preferentialType, + @Param("offset") Integer offset, + @Param("limit") Integer limit); + + Integer selectCountByPage(@Param("title") String title, + @Param("status") Integer status, + @Param("preferentialType") Integer preferentialType); + + void insert(CouponTemplateDO couponTemplate); + + int update(CouponTemplateDO couponTemplate); + +} diff --git a/promotion/promotion-service-impl/src/main/java/cn/iocoder/mall/promotion/biz/dataobject/CouponTemplateDO.java b/promotion/promotion-service-impl/src/main/java/cn/iocoder/mall/promotion/biz/dataobject/CouponTemplateDO.java index fb418c8d..9fb96e4a 100644 --- a/promotion/promotion-service-impl/src/main/java/cn/iocoder/mall/promotion/biz/dataobject/CouponTemplateDO.java +++ b/promotion/promotion-service-impl/src/main/java/cn/iocoder/mall/promotion/biz/dataobject/CouponTemplateDO.java @@ -54,22 +54,14 @@ public class CouponTemplateDO extends BaseDO { // * 是否可分享领取链接 // */ // private Boolean isShare; - /** - * 设置为失效时间 - */ - private Date invalidTime; +// /** +// * 设置为失效时间 +// */ +// private Date invalidTime; // /** // * 删除时间 // */ // private Date deleteTime; - /** - * 可领取的开始时间 - */ - private Date beginTime; - /** - * 可领取的结束时间 - */ - private Date endTime; // ========== 基本信息 END ========== @@ -208,10 +200,10 @@ public class CouponTemplateDO extends BaseDO { // * 领取优惠券的人数 // */ // private Integer statFetchUserNum; -// /** -// * 领取优惠券的次数 -// */ -// private Integer statFetchNum; + /** + * 领取优惠券的次数 + */ + private Integer statFetchNum; // /** // * 使用优惠券的次数 // */ diff --git a/promotion/promotion-service-impl/src/main/resources/mapper/CouponTemplateMapper.xml b/promotion/promotion-service-impl/src/main/resources/mapper/CouponTemplateMapper.xml new file mode 100644 index 00000000..049652c9 --- /dev/null +++ b/promotion/promotion-service-impl/src/main/resources/mapper/CouponTemplateMapper.xml @@ -0,0 +1,143 @@ + + + + + + id, title, description, type, code_type, + status, quota, stock, price_available, range_type, + range_values, date_type, valid_start_time, valid_end_time, fixed_term, + preferential_type, percent_off, price_off, discount_price_limit, stat_fetch_num, + create_time + + + + + + + + + + + + + + + + + + + + + + + + + + + INSERT INTO coupon_template ( + title, description, type, code_type, + status, quota, stock, price_available, range_type, + range_values, date_type, valid_start_time, valid_end_time, fixed_term, + preferential_type, percent_off, price_off, discount_price_limit, stat_fetch_num, + create_time + ) VALUES ( + #{title}, #{description, #{type, #{code_type}, + #{status}, #{quota, #{stock}, #{priceAvailable}, #{rangeType}, + #{rangeValues}, #{dateType}, #{validStartTime}, #{validEndTime, #{fixedTerm}, + #{preferentialType, #{percentOff}, #{priceOff}, #{discountPriceLimit}, #{statFetchNum}, + #{createTime} + ) + + + + UPDATE coupon_template + + + title = #{title}, + + + description = #{description}, + + + status = #{status}, + + + quota = #{quota}, + + + stock = #{stock}, + + + price_available = #{priceAvailable} + + + range_type = #{rangeType} + + + range_values = #{rangeValues} + + + date_type = #{dateType} + + + valid_start_time = #{validStartTime} + + + valid_end_time = #{validEndTime} + + + fixed_term = #{fixedTerm} + + + preferential_type = #{preferentialType} + + + percent_off = #{percentOff} + + + price_off = #{priceOff} + + + discount_price_limit = #{discountPriceLimit} + + + WHERE id = #{id} + + +