后端 + 前端:优惠劵列表
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;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,122 @@
|
||||
package cn.iocoder.mall.promotion.application.convert;
|
||||
|
||||
import cn.iocoder.common.framework.vo.CommonResult;
|
||||
import cn.iocoder.mall.promotion.api.bo.BannerBO;
|
||||
import cn.iocoder.mall.promotion.api.bo.BannerPageBO;
|
||||
import cn.iocoder.mall.promotion.application.vo.admins.AdminsBannerPageVO;
|
||||
import cn.iocoder.mall.promotion.application.vo.admins.AdminsBannerVO;
|
||||
import cn.iocoder.mall.promotion.application.vo.users.UsersBannerVO;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import javax.annotation.Generated;
|
||||
|
||||
@Generated(
|
||||
value = "org.mapstruct.ap.MappingProcessor",
|
||||
date = "2019-04-05T22:26:04+0800",
|
||||
comments = "version: 1.3.0.Final, compiler: javac, environment: Java 11.0.1 (Oracle Corporation)"
|
||||
)
|
||||
public class BannerConvertImpl implements BannerConvert {
|
||||
|
||||
@Override
|
||||
public AdminsBannerVO convert(BannerBO bannerBO) {
|
||||
if ( bannerBO == null ) {
|
||||
return null;
|
||||
}
|
||||
|
||||
AdminsBannerVO adminsBannerVO = new AdminsBannerVO();
|
||||
|
||||
adminsBannerVO.setId( bannerBO.getId() );
|
||||
adminsBannerVO.setTitle( bannerBO.getTitle() );
|
||||
adminsBannerVO.setUrl( bannerBO.getUrl() );
|
||||
adminsBannerVO.setSort( bannerBO.getSort() );
|
||||
adminsBannerVO.setStatus( bannerBO.getStatus() );
|
||||
adminsBannerVO.setMemo( bannerBO.getMemo() );
|
||||
adminsBannerVO.setCreateTime( bannerBO.getCreateTime() );
|
||||
adminsBannerVO.setPicUrl( bannerBO.getPicUrl() );
|
||||
|
||||
return adminsBannerVO;
|
||||
}
|
||||
|
||||
@Override
|
||||
public CommonResult<AdminsBannerVO> convert2(CommonResult<BannerBO> result) {
|
||||
if ( result == null ) {
|
||||
return null;
|
||||
}
|
||||
|
||||
CommonResult<AdminsBannerVO> commonResult = new CommonResult<AdminsBannerVO>();
|
||||
|
||||
commonResult.setCode( result.getCode() );
|
||||
commonResult.setMessage( result.getMessage() );
|
||||
commonResult.setData( convert( result.getData() ) );
|
||||
|
||||
return commonResult;
|
||||
}
|
||||
|
||||
@Override
|
||||
public CommonResult<AdminsBannerPageVO> convert(CommonResult<BannerPageBO> result) {
|
||||
if ( result == null ) {
|
||||
return null;
|
||||
}
|
||||
|
||||
CommonResult<AdminsBannerPageVO> commonResult = new CommonResult<AdminsBannerPageVO>();
|
||||
|
||||
commonResult.setCode( result.getCode() );
|
||||
commonResult.setMessage( result.getMessage() );
|
||||
commonResult.setData( bannerPageBOToAdminsBannerPageVO( result.getData() ) );
|
||||
|
||||
return commonResult;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<UsersBannerVO> convertList(List<BannerBO> banners) {
|
||||
if ( banners == null ) {
|
||||
return null;
|
||||
}
|
||||
|
||||
List<UsersBannerVO> list = new ArrayList<UsersBannerVO>( banners.size() );
|
||||
for ( BannerBO bannerBO : banners ) {
|
||||
list.add( bannerBOToUsersBannerVO( bannerBO ) );
|
||||
}
|
||||
|
||||
return list;
|
||||
}
|
||||
|
||||
protected List<AdminsBannerVO> bannerBOListToAdminsBannerVOList(List<BannerBO> list) {
|
||||
if ( list == null ) {
|
||||
return null;
|
||||
}
|
||||
|
||||
List<AdminsBannerVO> list1 = new ArrayList<AdminsBannerVO>( list.size() );
|
||||
for ( BannerBO bannerBO : list ) {
|
||||
list1.add( convert( bannerBO ) );
|
||||
}
|
||||
|
||||
return list1;
|
||||
}
|
||||
|
||||
protected AdminsBannerPageVO bannerPageBOToAdminsBannerPageVO(BannerPageBO bannerPageBO) {
|
||||
if ( bannerPageBO == null ) {
|
||||
return null;
|
||||
}
|
||||
|
||||
AdminsBannerPageVO adminsBannerPageVO = new AdminsBannerPageVO();
|
||||
|
||||
adminsBannerPageVO.setList( bannerBOListToAdminsBannerVOList( bannerPageBO.getList() ) );
|
||||
adminsBannerPageVO.setTotal( bannerPageBO.getTotal() );
|
||||
|
||||
return adminsBannerPageVO;
|
||||
}
|
||||
|
||||
protected UsersBannerVO bannerBOToUsersBannerVO(BannerBO bannerBO) {
|
||||
if ( bannerBO == null ) {
|
||||
return null;
|
||||
}
|
||||
|
||||
UsersBannerVO usersBannerVO = new UsersBannerVO();
|
||||
|
||||
usersBannerVO.setUrl( bannerBO.getUrl() );
|
||||
usersBannerVO.setPicUrl( bannerBO.getPicUrl() );
|
||||
|
||||
return usersBannerVO;
|
||||
}
|
||||
}
|
||||
@@ -81,7 +81,7 @@ public class CouponTemplateBO {
|
||||
* 生效日期类型
|
||||
*
|
||||
* 1-固定日期
|
||||
* 2-领取日期:领到券 {@link #fixedBeginTerm} 日开始 N 天内有效
|
||||
* 2-领取日期:领到券 {@link #fixedStartTerm} 日开始 N 天内有效
|
||||
*/
|
||||
private Integer dateType;
|
||||
/**
|
||||
@@ -97,7 +97,7 @@ public class CouponTemplateBO {
|
||||
*
|
||||
* 例如,0-当天;1-次天
|
||||
*/
|
||||
private Integer fixedBeginTerm;
|
||||
private Integer fixedStartTerm;
|
||||
/**
|
||||
* 领取日期-结束天数
|
||||
*/
|
||||
@@ -323,12 +323,12 @@ public class CouponTemplateBO {
|
||||
return this;
|
||||
}
|
||||
|
||||
public Integer getFixedBeginTerm() {
|
||||
return fixedBeginTerm;
|
||||
public Integer getFixedStartTerm() {
|
||||
return fixedStartTerm;
|
||||
}
|
||||
|
||||
public CouponTemplateBO setFixedBeginTerm(Integer fixedBeginTerm) {
|
||||
this.fixedBeginTerm = fixedBeginTerm;
|
||||
public CouponTemplateBO setFixedStartTerm(Integer fixedStartTerm) {
|
||||
this.fixedStartTerm = fixedStartTerm;
|
||||
return this;
|
||||
}
|
||||
|
||||
|
||||
@@ -1,5 +1,33 @@
|
||||
package cn.iocoder.mall.promotion.api.bo;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public class CouponTemplatePageBO {
|
||||
|
||||
/**
|
||||
* 优惠劵(码)数组
|
||||
*/
|
||||
private List<CouponTemplateBO> list;
|
||||
/**
|
||||
* 总量
|
||||
*/
|
||||
private Integer total;
|
||||
|
||||
public CouponTemplatePageBO setList(List<CouponTemplateBO> list) {
|
||||
this.list = list;
|
||||
return this;
|
||||
}
|
||||
|
||||
public CouponTemplatePageBO setTotal(Integer total) {
|
||||
this.total = total;
|
||||
return this;
|
||||
}
|
||||
|
||||
public List<CouponTemplateBO> getList() {
|
||||
return list;
|
||||
}
|
||||
|
||||
public Integer getTotal() {
|
||||
return total;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -6,7 +6,7 @@ public enum CouponTemplateStatusEnum {
|
||||
|
||||
ENABLE(1, "开启中"),
|
||||
DISABLE(2, "禁用中"),
|
||||
EXPIRE(3, "已过期"),
|
||||
// EXPIRE(3, "已过期"), TODO 芋艿,暂时不考虑过期的
|
||||
;
|
||||
|
||||
public static final int[] ARRAYS = Arrays.stream(values()).mapToInt(CouponTemplateStatusEnum::getValue).toArray();
|
||||
|
||||
@@ -1,10 +1,16 @@
|
||||
package cn.iocoder.mall.promotion.api.dto;
|
||||
|
||||
import javax.validation.constraints.NotNull;
|
||||
|
||||
/**
|
||||
* 优惠劵模板分页 DTO
|
||||
*/
|
||||
public class CouponTemplatePageDTO {
|
||||
|
||||
/**
|
||||
* 类型
|
||||
*/
|
||||
private Integer type;
|
||||
/**
|
||||
* 标题
|
||||
*/
|
||||
@@ -18,4 +24,62 @@ public class CouponTemplatePageDTO {
|
||||
*/
|
||||
private Integer preferentialType;
|
||||
|
||||
@NotNull(message = "页码不能为空")
|
||||
private Integer pageNo;
|
||||
@NotNull(message = "每页条数不能为空")
|
||||
private Integer pageSize;
|
||||
|
||||
public Integer getType() {
|
||||
return type;
|
||||
}
|
||||
|
||||
public CouponTemplatePageDTO setType(Integer type) {
|
||||
this.type = type;
|
||||
return this;
|
||||
}
|
||||
|
||||
public String getTitle() {
|
||||
return title;
|
||||
}
|
||||
|
||||
public CouponTemplatePageDTO setTitle(String title) {
|
||||
this.title = title;
|
||||
return this;
|
||||
}
|
||||
|
||||
public Integer getStatus() {
|
||||
return status;
|
||||
}
|
||||
|
||||
public CouponTemplatePageDTO setStatus(Integer status) {
|
||||
this.status = status;
|
||||
return this;
|
||||
}
|
||||
|
||||
public Integer getPreferentialType() {
|
||||
return preferentialType;
|
||||
}
|
||||
|
||||
public CouponTemplatePageDTO setPreferentialType(Integer preferentialType) {
|
||||
this.preferentialType = preferentialType;
|
||||
return this;
|
||||
}
|
||||
|
||||
public Integer getPageNo() {
|
||||
return pageNo;
|
||||
}
|
||||
|
||||
public CouponTemplatePageDTO setPageNo(Integer pageNo) {
|
||||
this.pageNo = pageNo;
|
||||
return this;
|
||||
}
|
||||
|
||||
public Integer getPageSize() {
|
||||
return pageSize;
|
||||
}
|
||||
|
||||
public CouponTemplatePageDTO setPageSize(Integer pageSize) {
|
||||
this.pageSize = pageSize;
|
||||
return this;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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