后端 + 前端:优惠劵更新功能
This commit is contained in:
@@ -2,7 +2,9 @@ package cn.iocoder.mall.promotion.biz.convert;
|
||||
|
||||
import cn.iocoder.mall.promotion.api.bo.CouponTemplateBO;
|
||||
import cn.iocoder.mall.promotion.api.dto.CouponCardTemplateAddDTO;
|
||||
import cn.iocoder.mall.promotion.api.dto.CouponCardTemplateUpdateDTO;
|
||||
import cn.iocoder.mall.promotion.api.dto.CouponCodeTemplateAddDTO;
|
||||
import cn.iocoder.mall.promotion.api.dto.CouponCodeTemplateUpdateDTO;
|
||||
import cn.iocoder.mall.promotion.biz.dataobject.CouponTemplateDO;
|
||||
import org.mapstruct.Mapper;
|
||||
import org.mapstruct.Mappings;
|
||||
@@ -22,11 +24,17 @@ public interface CouponTemplateConvert {
|
||||
List<CouponTemplateBO> convertToBO(List<CouponTemplateDO> templateList);
|
||||
|
||||
@Mappings({})
|
||||
CouponTemplateDO convert(CouponCodeTemplateAddDTO template);
|
||||
CouponTemplateDO convert(CouponCodeTemplateUpdateDTO template);
|
||||
|
||||
@Mappings({})
|
||||
CouponTemplateDO convert(CouponCardTemplateAddDTO template);
|
||||
|
||||
@Mappings({})
|
||||
CouponTemplateDO convert(CouponCardTemplateUpdateDTO template);
|
||||
|
||||
@Mappings({})
|
||||
CouponTemplateDO convert(CouponCodeTemplateAddDTO template);
|
||||
|
||||
@Mappings({})
|
||||
CouponTemplateBO convert(CouponTemplateDO template);
|
||||
|
||||
|
||||
@@ -1,15 +1,13 @@
|
||||
package cn.iocoder.mall.promotion.biz.service;
|
||||
|
||||
import cn.iocoder.common.framework.constant.SysErrorCodeEnum;
|
||||
import cn.iocoder.common.framework.util.ServiceExceptionUtil;
|
||||
import cn.iocoder.common.framework.vo.CommonResult;
|
||||
import cn.iocoder.mall.promotion.api.CouponService;
|
||||
import cn.iocoder.mall.promotion.api.bo.CouponCardBO;
|
||||
import cn.iocoder.mall.promotion.api.bo.CouponTemplateBO;
|
||||
import cn.iocoder.mall.promotion.api.bo.CouponTemplatePageBO;
|
||||
import cn.iocoder.mall.promotion.api.constant.CouponTemplateDateTypeEnum;
|
||||
import cn.iocoder.mall.promotion.api.constant.CouponTemplatePreferentialTypeEnum;
|
||||
import cn.iocoder.mall.promotion.api.constant.CouponTemplateStatusEnum;
|
||||
import cn.iocoder.mall.promotion.api.constant.CouponTemplateTypeEnum;
|
||||
import cn.iocoder.mall.promotion.api.constant.*;
|
||||
import cn.iocoder.mall.promotion.api.dto.*;
|
||||
import cn.iocoder.mall.promotion.biz.convert.CouponTemplateConvert;
|
||||
import cn.iocoder.mall.promotion.biz.dao.CouponTemplateMapper;
|
||||
@@ -82,7 +80,24 @@ public class CouponServiceImpl implements CouponService {
|
||||
|
||||
@Override
|
||||
public CommonResult<Boolean> updateCouponCardTemplate(CouponCardTemplateUpdateDTO couponCardTemplateUpdateDTO) {
|
||||
return null;
|
||||
// 校验 CouponCardTemplate 存在
|
||||
CouponTemplateDO template = couponTemplateMapper.selectById(couponCardTemplateUpdateDTO.getId());
|
||||
if (template == null) {
|
||||
return ServiceExceptionUtil.error(PromotionErrorCodeEnum.PRODUCT_TEMPLATE_NOT_EXISTS.getCode());
|
||||
}
|
||||
// 校验 CouponCardTemplate 是 CARD
|
||||
if (!CouponTemplateTypeEnum.CARD.getValue().equals(template.getType())) {
|
||||
return ServiceExceptionUtil.error(PromotionErrorCodeEnum.PRODUCT_TEMPLATE_NOT_CARD.getCode());
|
||||
}
|
||||
// 校验发放数量不能减少
|
||||
if (couponCardTemplateUpdateDTO.getTotal() < template.getTotal()) {
|
||||
return ServiceExceptionUtil.error(PromotionErrorCodeEnum.PRODUCT_TEMPLATE_TOTAL_CAN_NOT_REDUCE.getCode());
|
||||
}
|
||||
// 更新优惠劵模板到数据库
|
||||
CouponTemplateDO updateTemplateDO = CouponTemplateConvert.INSTANCE.convert(couponCardTemplateUpdateDTO);
|
||||
couponTemplateMapper.update(updateTemplateDO);
|
||||
// 返回成功
|
||||
return CommonResult.success(true);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -0,0 +1,152 @@
|
||||
<?xml version="1.0" encoding="UTF-8" ?>
|
||||
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd" >
|
||||
<mapper namespace="cn.iocoder.mall.promotion.biz.dao.CouponTemplateMapper">
|
||||
|
||||
<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_start_term, fixed_end_term,
|
||||
preferential_type, percent_off, price_off, discount_price_limit, stat_fetch_num,
|
||||
create_time
|
||||
</sql>
|
||||
|
||||
<!-- <select id="selectListByPidAndStatusOrderBySort" resultType="CouponTemplateDO">-->
|
||||
<!-- SELECT-->
|
||||
<!-- <include refid="FIELDS" />-->
|
||||
<!-- FROM coupon_template-->
|
||||
<!-- WHERE pid = #{pid}-->
|
||||
<!-- AND status = #{status}-->
|
||||
<!-- AND deleted = 0-->
|
||||
<!-- ORDER BY sort ASC-->
|
||||
<!-- </select>-->
|
||||
|
||||
<!-- <select id="selectList" resultType="CouponTemplateDO">-->
|
||||
<!-- SELECT-->
|
||||
<!-- <include refid="FIELDS" />-->
|
||||
<!-- FROM coupon_template-->
|
||||
<!-- WHERE deleted = 0-->
|
||||
<!-- </select>-->
|
||||
|
||||
<select id="selectById" parameterType="Integer" resultType="CouponTemplateDO">
|
||||
SELECT
|
||||
<include refid="FIELDS" />
|
||||
FROM coupon_template
|
||||
WHERE id = #{id}
|
||||
</select>
|
||||
|
||||
<select id="selectListByPage" resultType="CouponTemplateDO">
|
||||
SELECT
|
||||
<include refid="FIELDS" />
|
||||
FROM coupon_template
|
||||
<where>
|
||||
<if test="type != null">
|
||||
AND type = #{type}
|
||||
</if>
|
||||
<if test="title != null">
|
||||
AND title LIKE "%"#{title}"%"
|
||||
</if>
|
||||
<if test="status != null">
|
||||
AND status = #{status}
|
||||
</if>
|
||||
<if test="preferentialType != null">
|
||||
AND preferential_type = #{preferentialType}
|
||||
</if>
|
||||
</where>
|
||||
LIMIT #{offset}, #{limit}
|
||||
</select>
|
||||
|
||||
<select id="selectCountByPage" resultType="Integer">
|
||||
SELECT
|
||||
COUNT(1)
|
||||
FROM coupon_template
|
||||
<where>
|
||||
<if test="type != null">
|
||||
AND type = #{type}
|
||||
</if>
|
||||
<if test="title != null">
|
||||
AND title LIKE "%"#{title}"%"
|
||||
</if>
|
||||
<if test="status != null">
|
||||
AND status = #{status}
|
||||
</if>
|
||||
<if test="preferentialType != null">
|
||||
AND preferential_type = #{preferentialType}
|
||||
</if>
|
||||
</where>
|
||||
</select>
|
||||
|
||||
<insert id="insert" parameterType="CouponTemplateDO" useGeneratedKeys="true" keyColumn="id" keyProperty="id">
|
||||
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_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}, #{fixedStartTerm}, #{fixedEndTerm}
|
||||
#{preferentialType}, #{percentOff}, #{priceOff}, #{discountPriceLimit}, #{statFetchNum},
|
||||
#{createTime}
|
||||
)
|
||||
</insert>
|
||||
|
||||
<update id="update" parameterType="CouponTemplateDO">
|
||||
UPDATE coupon_template
|
||||
<set>
|
||||
<if test="title != null">
|
||||
title = #{title},
|
||||
</if>
|
||||
<if test="description != null">
|
||||
description = #{description},
|
||||
</if>
|
||||
<if test="status != null">
|
||||
status = #{status},
|
||||
</if>
|
||||
<if test="quota != null">
|
||||
quota = #{quota},
|
||||
</if>
|
||||
<if test="total != null">
|
||||
total = #{total},
|
||||
</if>
|
||||
<if test="priceAvailable != null">
|
||||
price_available = #{priceAvailable},
|
||||
</if>
|
||||
<if test="rangeType != null">
|
||||
range_type = #{rangeType},
|
||||
</if>
|
||||
<if test="rangeValues != null">
|
||||
range_values = #{rangeValues},
|
||||
</if>
|
||||
<if test="dateType != null">
|
||||
date_type = #{dateType},
|
||||
</if>
|
||||
<if test="validStartTime != null">
|
||||
valid_start_time = #{validStartTime},
|
||||
</if>
|
||||
<if test="validEndTime != null">
|
||||
valid_end_time = #{validEndTime},
|
||||
</if>
|
||||
<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},
|
||||
</if>
|
||||
<if test="percentOff != null">
|
||||
percent_off = #{percentOff},
|
||||
</if>
|
||||
<if test="priceOff != null">
|
||||
price_off = #{priceOff},
|
||||
</if>
|
||||
<if test="discountPriceLimit != null">
|
||||
discount_price_limit = #{discountPriceLimit},
|
||||
</if>
|
||||
</set>
|
||||
WHERE id = #{id}
|
||||
</update>
|
||||
|
||||
</mapper>
|
||||
@@ -0,0 +1,125 @@
|
||||
<?xml version="1.0" encoding="UTF-8" ?>
|
||||
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd" >
|
||||
<mapper namespace="cn.iocoder.mall.promotion.biz.dao.ProductRecommendMapper">
|
||||
|
||||
<sql id="FIELDS">
|
||||
id, type, product_spu_id, sort,
|
||||
status, memo, create_time
|
||||
</sql>
|
||||
|
||||
<!-- <select id="selectListByPidAndStatusOrderBySort" resultType="ProductRecommendDO">-->
|
||||
<!-- SELECT-->
|
||||
<!-- <include refid="FIELDS" />-->
|
||||
<!-- FROM product_recommend-->
|
||||
<!-- WHERE pid = #{pid}-->
|
||||
<!-- AND status = #{status}-->
|
||||
<!-- AND deleted = 0-->
|
||||
<!-- ORDER BY sort ASC-->
|
||||
<!-- </select>-->
|
||||
|
||||
<!-- <select id="selectList" resultType="ProductRecommendDO">-->
|
||||
<!-- SELECT-->
|
||||
<!-- <include refid="FIELDS" />-->
|
||||
<!-- FROM product_recommend-->
|
||||
<!-- WHERE deleted = 0-->
|
||||
<!-- </select>-->
|
||||
|
||||
<select id="selectById" parameterType="Integer" resultType="ProductRecommendDO">
|
||||
SELECT
|
||||
<include refid="FIELDS" />
|
||||
FROM product_recommend
|
||||
WHERE id = #{id}
|
||||
AND deleted = 0
|
||||
</select>
|
||||
|
||||
<select id="selectByProductSpuIdAndType" resultType="ProductRecommendDO">
|
||||
SELECT
|
||||
<include refid="FIELDS" />
|
||||
FROM product_recommend
|
||||
<where>
|
||||
<if test="productSpuId != null">
|
||||
product_spu_id = #{productSpuId}
|
||||
</if>
|
||||
<if test="type != null">
|
||||
AND type = #{type}
|
||||
</if>
|
||||
AND deleted = 0
|
||||
</where>
|
||||
</select>
|
||||
|
||||
<select id="selectListByTypeAndStatus" parameterType="Integer" resultType="ProductRecommendDO">
|
||||
SELECT
|
||||
<include refid="FIELDS" />
|
||||
FROM product_recommend
|
||||
<where>
|
||||
<if test="type != null">
|
||||
type = #{type}
|
||||
</if>
|
||||
<if test="status != null">
|
||||
AND status = #{status}
|
||||
</if>
|
||||
AND deleted = 0
|
||||
</where>
|
||||
</select>
|
||||
|
||||
<select id="selectPageByType" resultType="ProductRecommendDO">
|
||||
SELECT
|
||||
<include refid="FIELDS" />
|
||||
FROM product_recommend
|
||||
<where>
|
||||
<if test="type != null">
|
||||
type = #{type}
|
||||
</if>
|
||||
AND deleted = 0
|
||||
</where>
|
||||
LIMIT #{offset}, #{limit}
|
||||
</select>
|
||||
|
||||
<select id="selectCountByType" resultType="Integer">
|
||||
SELECT
|
||||
COUNT(1)
|
||||
FROM product_recommend
|
||||
<where>
|
||||
<if test="type != null">
|
||||
type = #{type}
|
||||
</if>
|
||||
AND deleted = 0
|
||||
</where>
|
||||
</select>
|
||||
|
||||
<insert id="insert" parameterType="ProductRecommendDO" useGeneratedKeys="true" keyColumn="id" keyProperty="id">
|
||||
INSERT INTO product_recommend (
|
||||
type, product_spu_id, sort, status, memo,
|
||||
create_time, deleted
|
||||
) VALUES (
|
||||
#{type}, #{productSpuId}, #{sort}, #{status}, #{memo},
|
||||
#{createTime}, #{deleted}
|
||||
)
|
||||
</insert>
|
||||
|
||||
<update id="update" parameterType="ProductRecommendDO">
|
||||
UPDATE product_recommend
|
||||
<set>
|
||||
<if test="type != null">
|
||||
type = #{type},
|
||||
</if>
|
||||
<if test="productSpuId != null">
|
||||
product_spu_id = #{productSpuId},
|
||||
</if>
|
||||
<if test="sort != null">
|
||||
sort = #{sort},
|
||||
</if>
|
||||
<if test="status != null">
|
||||
status = #{status},
|
||||
</if>
|
||||
<if test="memo != null">
|
||||
memo = #{memo},
|
||||
</if>
|
||||
<if test="deleted != null">
|
||||
deleted = #{deleted}
|
||||
</if>
|
||||
</set>
|
||||
WHERE id = #{id}
|
||||
</update>
|
||||
|
||||
</mapper>
|
||||
@@ -0,0 +1,135 @@
|
||||
package cn.iocoder.mall.promotion.biz.convert;
|
||||
|
||||
import cn.iocoder.mall.promotion.api.bo.CouponTemplateBO;
|
||||
import cn.iocoder.mall.promotion.api.dto.CouponCardTemplateAddDTO;
|
||||
import cn.iocoder.mall.promotion.api.dto.CouponCardTemplateUpdateDTO;
|
||||
import cn.iocoder.mall.promotion.api.dto.CouponCodeTemplateAddDTO;
|
||||
import cn.iocoder.mall.promotion.api.dto.CouponCodeTemplateUpdateDTO;
|
||||
import cn.iocoder.mall.promotion.biz.dataobject.CouponTemplateDO;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import javax.annotation.Generated;
|
||||
|
||||
@Generated(
|
||||
value = "org.mapstruct.ap.MappingProcessor",
|
||||
date = "2019-04-06T00:20:10+0800",
|
||||
comments = "version: 1.3.0.Final, compiler: javac, environment: Java 11.0.1 (Oracle Corporation)"
|
||||
)
|
||||
public class CouponTemplateConvertImpl implements CouponTemplateConvert {
|
||||
|
||||
@Override
|
||||
public List<CouponTemplateBO> convertToBO(List<CouponTemplateDO> templateList) {
|
||||
if ( templateList == null ) {
|
||||
return null;
|
||||
}
|
||||
|
||||
List<CouponTemplateBO> list = new ArrayList<CouponTemplateBO>( templateList.size() );
|
||||
for ( CouponTemplateDO couponTemplateDO : templateList ) {
|
||||
list.add( convert( couponTemplateDO ) );
|
||||
}
|
||||
|
||||
return list;
|
||||
}
|
||||
|
||||
@Override
|
||||
public CouponTemplateDO convert(CouponCodeTemplateUpdateDTO template) {
|
||||
if ( template == null ) {
|
||||
return null;
|
||||
}
|
||||
|
||||
CouponTemplateDO couponTemplateDO = new CouponTemplateDO();
|
||||
|
||||
return couponTemplateDO;
|
||||
}
|
||||
|
||||
@Override
|
||||
public CouponTemplateDO convert(CouponCardTemplateAddDTO template) {
|
||||
if ( template == null ) {
|
||||
return null;
|
||||
}
|
||||
|
||||
CouponTemplateDO couponTemplateDO = new CouponTemplateDO();
|
||||
|
||||
couponTemplateDO.setTitle( template.getTitle() );
|
||||
couponTemplateDO.setDescription( template.getDescription() );
|
||||
couponTemplateDO.setQuota( template.getQuota() );
|
||||
couponTemplateDO.setTotal( template.getTotal() );
|
||||
couponTemplateDO.setPriceAvailable( template.getPriceAvailable() );
|
||||
couponTemplateDO.setRangeType( template.getRangeType() );
|
||||
couponTemplateDO.setRangeValues( template.getRangeValues() );
|
||||
couponTemplateDO.setDateType( template.getDateType() );
|
||||
couponTemplateDO.setValidStartTime( template.getValidStartTime() );
|
||||
couponTemplateDO.setValidEndTime( template.getValidEndTime() );
|
||||
couponTemplateDO.setFixedEndTerm( template.getFixedEndTerm() );
|
||||
couponTemplateDO.setPreferentialType( template.getPreferentialType() );
|
||||
couponTemplateDO.setPercentOff( template.getPercentOff() );
|
||||
couponTemplateDO.setPriceOff( template.getPriceOff() );
|
||||
couponTemplateDO.setDiscountPriceLimit( template.getDiscountPriceLimit() );
|
||||
|
||||
return couponTemplateDO;
|
||||
}
|
||||
|
||||
@Override
|
||||
public CouponTemplateDO convert(CouponCardTemplateUpdateDTO template) {
|
||||
if ( template == null ) {
|
||||
return null;
|
||||
}
|
||||
|
||||
CouponTemplateDO couponTemplateDO = new CouponTemplateDO();
|
||||
|
||||
couponTemplateDO.setId( template.getId() );
|
||||
couponTemplateDO.setTitle( template.getTitle() );
|
||||
couponTemplateDO.setDescription( template.getDescription() );
|
||||
couponTemplateDO.setQuota( template.getQuota() );
|
||||
couponTemplateDO.setTotal( template.getTotal() );
|
||||
couponTemplateDO.setRangeType( template.getRangeType() );
|
||||
couponTemplateDO.setRangeValues( template.getRangeValues() );
|
||||
|
||||
return couponTemplateDO;
|
||||
}
|
||||
|
||||
@Override
|
||||
public CouponTemplateDO convert(CouponCodeTemplateAddDTO template) {
|
||||
if ( template == null ) {
|
||||
return null;
|
||||
}
|
||||
|
||||
CouponTemplateDO couponTemplateDO = new CouponTemplateDO();
|
||||
|
||||
return couponTemplateDO;
|
||||
}
|
||||
|
||||
@Override
|
||||
public CouponTemplateBO convert(CouponTemplateDO template) {
|
||||
if ( template == null ) {
|
||||
return null;
|
||||
}
|
||||
|
||||
CouponTemplateBO couponTemplateBO = new CouponTemplateBO();
|
||||
|
||||
couponTemplateBO.setId( template.getId() );
|
||||
couponTemplateBO.setTitle( template.getTitle() );
|
||||
couponTemplateBO.setDescription( template.getDescription() );
|
||||
couponTemplateBO.setType( template.getType() );
|
||||
couponTemplateBO.setCodeType( template.getCodeType() );
|
||||
couponTemplateBO.setStatus( template.getStatus() );
|
||||
couponTemplateBO.setQuota( template.getQuota() );
|
||||
couponTemplateBO.setTotal( template.getTotal() );
|
||||
couponTemplateBO.setPriceAvailable( template.getPriceAvailable() );
|
||||
couponTemplateBO.setRangeType( template.getRangeType() );
|
||||
couponTemplateBO.setRangeValues( template.getRangeValues() );
|
||||
couponTemplateBO.setDateType( template.getDateType() );
|
||||
couponTemplateBO.setValidStartTime( template.getValidStartTime() );
|
||||
couponTemplateBO.setValidEndTime( template.getValidEndTime() );
|
||||
couponTemplateBO.setPreferentialType( template.getPreferentialType() );
|
||||
couponTemplateBO.setPercentOff( template.getPercentOff() );
|
||||
couponTemplateBO.setPriceOff( template.getPriceOff() );
|
||||
couponTemplateBO.setDiscountPriceLimit( template.getDiscountPriceLimit() );
|
||||
couponTemplateBO.setStatFetchNum( template.getStatFetchNum() );
|
||||
couponTemplateBO.setCreateTime( template.getCreateTime() );
|
||||
couponTemplateBO.setFixedStartTerm( template.getFixedStartTerm() );
|
||||
couponTemplateBO.setFixedEndTerm( template.getFixedEndTerm() );
|
||||
|
||||
return couponTemplateBO;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,83 @@
|
||||
package cn.iocoder.mall.promotion.biz.convert;
|
||||
|
||||
import cn.iocoder.mall.promotion.api.bo.ProductRecommendBO;
|
||||
import cn.iocoder.mall.promotion.api.dto.ProductRecommendAddDTO;
|
||||
import cn.iocoder.mall.promotion.api.dto.ProductRecommendUpdateDTO;
|
||||
import cn.iocoder.mall.promotion.biz.dataobject.ProductRecommendDO;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import javax.annotation.Generated;
|
||||
|
||||
@Generated(
|
||||
value = "org.mapstruct.ap.MappingProcessor",
|
||||
date = "2019-04-06T00:20:10+0800",
|
||||
comments = "version: 1.3.0.Final, compiler: javac, environment: Java 11.0.1 (Oracle Corporation)"
|
||||
)
|
||||
public class ProductRecommendConvertImpl implements ProductRecommendConvert {
|
||||
|
||||
@Override
|
||||
public ProductRecommendBO convertToBO(ProductRecommendDO banner) {
|
||||
if ( banner == null ) {
|
||||
return null;
|
||||
}
|
||||
|
||||
ProductRecommendBO productRecommendBO = new ProductRecommendBO();
|
||||
|
||||
productRecommendBO.setId( banner.getId() );
|
||||
productRecommendBO.setType( banner.getType() );
|
||||
productRecommendBO.setProductSpuId( banner.getProductSpuId() );
|
||||
productRecommendBO.setSort( banner.getSort() );
|
||||
productRecommendBO.setStatus( banner.getStatus() );
|
||||
productRecommendBO.setMemo( banner.getMemo() );
|
||||
productRecommendBO.setCreateTime( banner.getCreateTime() );
|
||||
|
||||
return productRecommendBO;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<ProductRecommendBO> convertToBO(List<ProductRecommendDO> bannerList) {
|
||||
if ( bannerList == null ) {
|
||||
return null;
|
||||
}
|
||||
|
||||
List<ProductRecommendBO> list = new ArrayList<ProductRecommendBO>( bannerList.size() );
|
||||
for ( ProductRecommendDO productRecommendDO : bannerList ) {
|
||||
list.add( convertToBO( productRecommendDO ) );
|
||||
}
|
||||
|
||||
return list;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ProductRecommendDO convert(ProductRecommendAddDTO bannerAddDTO) {
|
||||
if ( bannerAddDTO == null ) {
|
||||
return null;
|
||||
}
|
||||
|
||||
ProductRecommendDO productRecommendDO = new ProductRecommendDO();
|
||||
|
||||
productRecommendDO.setType( bannerAddDTO.getType() );
|
||||
productRecommendDO.setProductSpuId( bannerAddDTO.getProductSpuId() );
|
||||
productRecommendDO.setSort( bannerAddDTO.getSort() );
|
||||
productRecommendDO.setMemo( bannerAddDTO.getMemo() );
|
||||
|
||||
return productRecommendDO;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ProductRecommendDO convert(ProductRecommendUpdateDTO bannerUpdateDTO) {
|
||||
if ( bannerUpdateDTO == null ) {
|
||||
return null;
|
||||
}
|
||||
|
||||
ProductRecommendDO productRecommendDO = new ProductRecommendDO();
|
||||
|
||||
productRecommendDO.setId( bannerUpdateDTO.getId() );
|
||||
productRecommendDO.setType( bannerUpdateDTO.getType() );
|
||||
productRecommendDO.setProductSpuId( bannerUpdateDTO.getProductSpuId() );
|
||||
productRecommendDO.setSort( bannerUpdateDTO.getSort() );
|
||||
productRecommendDO.setMemo( bannerUpdateDTO.getMemo() );
|
||||
|
||||
return productRecommendDO;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user