后端 + 前端:优惠劵列表
This commit is contained in:
@@ -8,6 +8,8 @@ import org.mapstruct.Mapper;
|
||||
import org.mapstruct.Mappings;
|
||||
import org.mapstruct.factory.Mappers;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@Mapper
|
||||
public interface CouponTemplateConvert {
|
||||
|
||||
@@ -16,8 +18,8 @@ public interface CouponTemplateConvert {
|
||||
// @Mappings({})
|
||||
// CouponTemplateBO convertToBO(CouponTemplateDO banner);
|
||||
//
|
||||
// @Mappings({})
|
||||
// List<CouponTemplateBO> convertToBO(List<CouponTemplateDO> bannerList);
|
||||
@Mappings({})
|
||||
List<CouponTemplateBO> convertToBO(List<CouponTemplateDO> templateList);
|
||||
|
||||
@Mappings({})
|
||||
CouponTemplateDO convert(CouponCodeTemplateAddDTO template);
|
||||
|
||||
@@ -11,13 +11,15 @@ public interface CouponTemplateMapper {
|
||||
|
||||
CouponTemplateDO selectById(@Param("id") Integer id);
|
||||
|
||||
List<CouponTemplateDO> selectListByPage(@Param("title") String title,
|
||||
List<CouponTemplateDO> selectListByPage(@Param("type") Integer type,
|
||||
@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,
|
||||
Integer selectCountByPage(@Param("type") Integer type,
|
||||
@Param("title") String title,
|
||||
@Param("status") Integer status,
|
||||
@Param("preferentialType") Integer preferentialType);
|
||||
|
||||
|
||||
@@ -120,7 +120,7 @@ public class CouponTemplateDO extends BaseDO {
|
||||
* 生效日期类型
|
||||
*
|
||||
* 1-固定日期
|
||||
* 2-领取日期:领到券 {@link #fixedTerm} 日开始 N 天内有效
|
||||
* 2-领取日期:领到券 {@link #fixedStartTerm} 日开始 N 天内有效
|
||||
*/
|
||||
private Integer dateType;
|
||||
/**
|
||||
@@ -131,16 +131,16 @@ public class CouponTemplateDO extends BaseDO {
|
||||
* 固定日期-生效结束时间
|
||||
*/
|
||||
private Date validEndTime;
|
||||
// /**
|
||||
// * 领取日期-开始天数
|
||||
// *
|
||||
// * 例如,0-当天;1-次天
|
||||
// */
|
||||
// private Integer fixedBeginTerm;
|
||||
/**
|
||||
* 领取日期-开始天数
|
||||
*
|
||||
* 例如,0-当天;1-次天
|
||||
*/
|
||||
private Integer fixedStartTerm;
|
||||
/**
|
||||
* 领取日期-结束天数
|
||||
*/
|
||||
private Integer fixedTerm;
|
||||
private Integer fixedEndTerm;
|
||||
// /**
|
||||
// * 是否到期前4天发送提醒
|
||||
// *
|
||||
@@ -335,12 +335,21 @@ public class CouponTemplateDO extends BaseDO {
|
||||
return this;
|
||||
}
|
||||
|
||||
public Integer getFixedTerm() {
|
||||
return fixedTerm;
|
||||
public Integer getFixedStartTerm() {
|
||||
return fixedStartTerm;
|
||||
}
|
||||
|
||||
public CouponTemplateDO setFixedTerm(Integer fixedTerm) {
|
||||
this.fixedTerm = fixedTerm;
|
||||
public CouponTemplateDO setFixedStartTerm(Integer fixedStartTerm) {
|
||||
this.fixedStartTerm = fixedStartTerm;
|
||||
return this;
|
||||
}
|
||||
|
||||
public Integer getFixedEndTerm() {
|
||||
return fixedEndTerm;
|
||||
}
|
||||
|
||||
public CouponTemplateDO setFixedEndTerm(Integer fixedEndTerm) {
|
||||
this.fixedEndTerm = fixedEndTerm;
|
||||
return this;
|
||||
}
|
||||
|
||||
|
||||
@@ -28,7 +28,18 @@ public class CouponServiceImpl implements CouponService {
|
||||
|
||||
@Override
|
||||
public CommonResult<CouponTemplatePageBO> getCouponTemplatePage(CouponTemplatePageDTO couponTemplatePageDTO) {
|
||||
return null;
|
||||
CouponTemplatePageBO couponTemplatePageBO = new CouponTemplatePageBO();
|
||||
// 查询分页数据
|
||||
int offset = (couponTemplatePageDTO.getPageNo() - 1) * couponTemplatePageDTO.getPageSize();
|
||||
couponTemplatePageBO.setList(CouponTemplateConvert.INSTANCE.convertToBO(couponTemplateMapper.selectListByPage(
|
||||
couponTemplatePageDTO.getType(), couponTemplatePageDTO.getTitle(),
|
||||
couponTemplatePageDTO.getStatus(), couponTemplatePageDTO.getPreferentialType(),
|
||||
offset, couponTemplatePageDTO.getPageSize())));
|
||||
// 查询分页总数
|
||||
couponTemplatePageBO.setTotal(couponTemplateMapper.selectCountByPage(
|
||||
couponTemplatePageDTO.getType(), couponTemplatePageDTO.getTitle(),
|
||||
couponTemplatePageDTO.getStatus(), couponTemplatePageDTO.getPreferentialType()));
|
||||
return CommonResult.success(couponTemplatePageBO);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -5,7 +5,7 @@
|
||||
<sql id="FIELDS">
|
||||
id, title, description, type, code_type,
|
||||
status, quota, total, price_available, range_type,
|
||||
range_values, date_type, valid_start_time, valid_end_time, fixed_term,
|
||||
range_values, date_type, valid_start_time, valid_end_time, fixed_start_term, fixed_end_term,
|
||||
preferential_type, percent_off, price_off, discount_price_limit, stat_fetch_num,
|
||||
create_time
|
||||
</sql>
|
||||
@@ -39,8 +39,11 @@
|
||||
<include refid="FIELDS" />
|
||||
FROM coupon_template
|
||||
<where>
|
||||
<if test="type != null">
|
||||
AND type = #{type}
|
||||
</if>
|
||||
<if test="title != null">
|
||||
title LIKE "%"#{title}"%"
|
||||
AND title LIKE "%"#{title}"%"
|
||||
</if>
|
||||
<if test="status != null">
|
||||
AND status = #{status}
|
||||
@@ -57,8 +60,11 @@
|
||||
COUNT(1)
|
||||
FROM coupon_template
|
||||
<where>
|
||||
<if test="type != null">
|
||||
AND type = #{type}
|
||||
</if>
|
||||
<if test="title != null">
|
||||
title LIKE "%"#{title}"%"
|
||||
AND title LIKE "%"#{title}"%"
|
||||
</if>
|
||||
<if test="status != null">
|
||||
AND status = #{status}
|
||||
@@ -73,13 +79,13 @@
|
||||
INSERT INTO coupon_template (
|
||||
title, description, type, code_type,
|
||||
status, quota, total, price_available, range_type,
|
||||
range_values, date_type, valid_start_time, valid_end_time, fixed_term,
|
||||
range_values, date_type, valid_start_time, valid_end_time, fixed_start_term, fixed_end_term,
|
||||
preferential_type, percent_off, price_off, discount_price_limit, stat_fetch_num,
|
||||
create_time
|
||||
) VALUES (
|
||||
#{title}, #{description}, #{type}, #{codeType},
|
||||
#{status}, #{quota}, #{total}, #{priceAvailable}, #{rangeType},
|
||||
#{rangeValues}, #{dateType}, #{validStartTime}, #{validEndTime}, #{fixedTerm},
|
||||
#{rangeValues}, #{dateType}, #{validStartTime}, #{validEndTime}, #{fixedStartTerm}, #{fixedEndTerm}
|
||||
#{preferentialType}, #{percentOff}, #{priceOff}, #{discountPriceLimit}, #{statFetchNum},
|
||||
#{createTime}
|
||||
)
|
||||
@@ -121,8 +127,11 @@
|
||||
<if test="validEndTime != null">
|
||||
valid_end_time = #{validEndTime},
|
||||
</if>
|
||||
<if test="fixedTerm != null">
|
||||
fixed_term = #{fixedTerm},
|
||||
<if test="fixedStartTerm != null">
|
||||
fixed_start_term = #{fixedStartTerm},
|
||||
</if>
|
||||
<if test="fixedEndTerm != null">
|
||||
fixed_end_term = #{fixedEndTerm},
|
||||
</if>
|
||||
<if test="preferentialType != null">
|
||||
preferential_type = #{preferentialType},
|
||||
|
||||
Reference in New Issue
Block a user