Commit 10adbc0b by 吕明尚

增加次卡,月卡的订单计算

parent 4942f11f
......@@ -13,7 +13,9 @@ public enum ReceiptRdeisEnum {
//房间15分钟过期
ROOM_EXPIRE_TIME(9, "ROOM_EXPIRE_TIME."),
ORDER_CANCEL_PAY(10, "ORDER_CANCEL_PAY."),
EQUITY_MEMBERS_TIME(11, "EQUITY_MEMBERS_TIME.")
EQUITY_MEMBERS_TIME(11, "EQUITY_MEMBERS_TIME."),
MONTHLY_CARD(12, "MONTHLY_CARD."),
SECONDARY_CARD(13, "SECONDARY_CARD.")
;
......
package share.system.domain;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import com.baomidou.mybatisplus.annotation.*;
import com.fasterxml.jackson.annotation.JsonFormat;
import lombok.Data;
import org.apache.commons.lang3.builder.ToStringBuilder;
......@@ -10,6 +8,7 @@ import org.apache.commons.lang3.builder.ToStringStyle;
import share.common.annotation.Excel;
import share.common.core.domain.BaseEntity;
import java.math.BigDecimal;
import java.util.Date;
/**
......@@ -51,7 +50,7 @@ public class ConsumerMonthlyCard extends BaseEntity {
* 免费时长
*/
@Excel(name = "免费时长")
private Long freeDuration;
private BigDecimal freeDuration;
/**
* 月卡天数
......@@ -69,7 +68,10 @@ public class ConsumerMonthlyCard extends BaseEntity {
/**
* 删除标记:1-删除,0-正常
*/
private Long isDelete;
//逻辑删除注解(0 未删除 1 已删除)
@TableLogic
@TableField(select = false)
private Integer isDelete;
@Override
......
......@@ -43,7 +43,7 @@ public class MonthlyCardConf extends BaseEntity {
* 免费时长
*/
@Excel(name = "免费时长")
private Long freeDuration;
private BigDecimal freeDuration;
/**
* 月卡天数
......
......@@ -9,6 +9,8 @@ import org.apache.commons.lang3.builder.ToStringStyle;
import share.common.annotation.Excel;
import share.common.core.domain.BaseEntity;
import java.math.BigDecimal;
/**
* 月卡使用记录对象 s_monthly_card_log
*
......@@ -47,13 +49,13 @@ public class MonthlyCardLog extends BaseEntity {
* 使用时长
*/
@Excel(name = "使用时长")
private Long useDuration;
private BigDecimal useDuration;
/**
* 剩余时长
*/
@Excel(name = "剩余时长")
private Long residueDuration;
private BigDecimal residueDuration;
/**
* 删除标记:1-删除,0-正常
......
......@@ -81,6 +81,12 @@ public class SOrder extends BaseEntity
@Excel(name = "优惠券金额")
private BigDecimal couponPrice;
@Excel(name = "次卡ID")
private Long secondaryCardId;
@Excel(name = "月卡ID")
private Long monthlyCardId;
@Excel(name = "订单总价")
private BigDecimal totalPrice;
......
......@@ -2,9 +2,10 @@ package share.system.domain.vo;
import lombok.Data;
import share.system.domain.ConsumerMember;
import share.system.domain.ConsumerWallet;
import share.system.domain.SConsumer;
import java.util.List;
/**
* @className: share.system.domain.vo.SConsumerVo
* @description: 会员
......@@ -46,7 +47,8 @@ public class SConsumerVo extends SConsumer {
private Long newId;
private List<ConsumerMonthlyCardVo> monthlyCardList;
private List<ConsumerSecondaryCardVo> secondaryCardList;
}
......@@ -61,5 +61,5 @@ public interface ConsumerMonthlyCardMapper extends BaseMapper<ConsumerMonthlyCar
*/
public int deleteConsumerMonthlyCardByIds(Long[] ids);
ConsumerMonthlyCardVo selectByConsumerId(ConsumerMonthlyCardVo consumerMemberVo);
List<ConsumerMonthlyCardVo> selectByConsumerId(ConsumerMonthlyCardVo consumerMemberVo);
}
......@@ -89,4 +89,12 @@ public class CreateOrderRequest {
@ApiModelProperty(value = "使用时长")
private BigDecimal duration;
//次卡ID
@ApiModelProperty(value = "次卡ID")
private Long secondaryCardId;
//月卡ID
@ApiModelProperty(value = "月卡ID")
private Long monthlyCardId;
}
......@@ -68,5 +68,12 @@ public class ComputedOrderPriceResponse implements Serializable {
@ApiModelProperty(value = "剩余余额")
private BigDecimal remainingBalance;
//次卡ID
@ApiModelProperty(value = "次卡ID")
private Long secondaryCardId;
//月卡ID
@ApiModelProperty(value = "月卡ID")
private Long monthlyCardId;
}
......@@ -61,5 +61,5 @@ public interface ConsumerMonthlyCardService extends IService<ConsumerMonthlyCard
*/
public int deleteConsumerMonthlyCardById(Long id);
ConsumerMonthlyCardVo selectByConsumerId();
List<ConsumerMonthlyCardVo> selectByConsumerId();
}
......@@ -95,7 +95,7 @@ public class ConsumerMonthlyCardServiceImpl extends ServiceImpl<ConsumerMonthlyC
}
@Override
public ConsumerMonthlyCardVo selectByConsumerId() {
public List<ConsumerMonthlyCardVo> selectByConsumerId() {
SConsumer info = sConsumerService.getInfo();
ConsumerMonthlyCardVo vo = new ConsumerMonthlyCardVo();
vo.setConsumerId(info.getId());
......
package share.system.service.impl;
import cn.hutool.core.util.ObjectUtil;
import cn.hutool.json.JSONObject;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import share.common.core.redis.RedisUtil;
import share.common.enums.ReceiptRdeisEnum;
import share.common.enums.YesNoEnum;
import share.common.exception.base.BaseException;
import share.common.utils.BaseUtil;
......@@ -24,7 +27,9 @@ import share.system.response.MonthlyyCardPayResultResponse;
import share.system.service.*;
import java.util.Date;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
/**
* 月卡订单Service业务层处理
......@@ -44,6 +49,8 @@ public class MonthlyCardOrderServiceImpl extends ServiceImpl<MonthlyCardOrderMap
private MonthlyCardConfService monthlyCardConfService;
@Autowired
private ConsumerMonthlyCardService consumerMonthlyCardService;
@Autowired
private RedisUtil redisUtil;
/**
* 查询月卡订单
......@@ -170,6 +177,18 @@ public class MonthlyCardOrderServiceImpl extends ServiceImpl<MonthlyCardOrderMap
consumerMonthlyCard.setMonthlyCardDays(byId.getMonthlyCardDays());
consumerMonthlyCard.setCreateTime(new Date());
consumerMonthlyCardService.save(consumerMonthlyCard);
Map<String, String> map = new HashMap<>();
map.put("consumerMonthlyCardId", String.valueOf(consumerMonthlyCard.getId()));
map.put("expirationTime", consumerMonthlyCard.getExpirationDate().toString());
JSONObject jsonObject = new JSONObject(map);
new Thread(() -> {
try {
Thread.sleep(1000);
redisUtil.set(ReceiptRdeisEnum.MONTHLY_CARD.getValue() + consumerMonthlyCard.getId(), jsonObject.toString());
} catch (InterruptedException e) {
e.printStackTrace();
}
}).start();
}
@Override
......
......@@ -25,7 +25,6 @@ import share.common.utils.DateUtils;
import share.common.utils.StringUtils;
import share.system.domain.*;
import share.system.domain.vo.*;
import share.system.mapper.ConsumerMemberMapper;
import share.system.mapper.SConsumerMapper;
import share.system.mapper.SStoreConsumerMapper;
import share.system.request.RegisterThirdSConsumerRequest;
......@@ -63,6 +62,10 @@ public class SConsumerServiceImpl extends ServiceImpl<SConsumerMapper, SConsumer
private MemberConfigService memberConfigService;
@Autowired
private MemberProgressLogService memberProgressLogService;
@Autowired
private ConsumerSecondaryCardService consumerSecondaryCardService;
@Autowired
private ConsumerMonthlyCardService consumerMonthlyCardService;
@Autowired
......@@ -214,6 +217,8 @@ public class SConsumerServiceImpl extends ServiceImpl<SConsumerMapper, SConsumer
BeanUtils.copyProperties(currentUser, vo);
ConsumerMember consumerMember = consumerMemberService.getOne(new LambdaQueryWrapper<ConsumerMember>().eq(ConsumerMember::getConsumerId, currentUser.getId()));
ConsumerWallet consumerWallet = consumerWalletService.getOne(new LambdaQueryWrapper<ConsumerWallet>().eq(ConsumerWallet::getConsumerId, currentUser.getId()));
List<ConsumerSecondaryCardVo> consumerSecondaryCardVos = consumerSecondaryCardService.selectByConsumerId();
List<ConsumerMonthlyCardVo> consumerMonthlyCardVo = consumerMonthlyCardService.selectByConsumerId();
if (ObjectUtil.isNotEmpty(consumerMember)) {
vo.setConsumerMember(consumerMember);
MemberConfig memberConfig = memberConfigService.getOne(new LambdaQueryWrapper<MemberConfig>().eq(MemberConfig::getMembershipLevel, consumerMember.getMembershipLevel()));
......@@ -277,9 +282,12 @@ public class SConsumerServiceImpl extends ServiceImpl<SConsumerMapper, SConsumer
} else {
vo.setIsManage(true);
}
if (!CollectionUtils.isEmpty(consumerSecondaryCardVos)) {
vo.setSecondaryCardList(consumerSecondaryCardVos);
}
if (!CollectionUtils.isEmpty(consumerMonthlyCardVo)) {
vo.setMonthlyCardList(consumerMonthlyCardVo);
}
return vo;
}
......@@ -350,10 +358,10 @@ public class SConsumerServiceImpl extends ServiceImpl<SConsumerMapper, SConsumer
@Override
public TableDataInfo selectConsumernotById(SConsumerVo sConsumer) {
List<ConsumerMember> consumerMembers = consumerMemberService
List<ConsumerMember> consumerMembers = consumerMemberService
.list(new LambdaQueryWrapper<ConsumerMember>()
.eq(ConsumerMember::getIsRights,YesNoEnum.yes.getIndex())
.ne(ConsumerMember::getConsumerId,sConsumer.getNewId()));
.eq(ConsumerMember::getIsRights, YesNoEnum.yes.getIndex())
.ne(ConsumerMember::getConsumerId, sConsumer.getNewId()));
List<Long> collect = consumerMembers.stream().map(ConsumerMember::getConsumerId).collect(Collectors.toList());
LambdaQueryWrapper<SConsumer> uSConsumer = new LambdaQueryWrapper<SConsumer>();
if (StringUtils.isNotEmpty(sConsumer.getPhone())){
......
......@@ -172,6 +172,14 @@ public class SOrderServiceImpl extends ServiceImpl<SOrderMapper, SOrder> impleme
@Autowired
private RechargeService rechargeService;
@Autowired
private ConsumerMonthlyCardService consumerMonthlyCardService;
@Autowired
private MonthlyCardLogService monthlyCardLogService;
@Autowired
private ConsumerSecondaryCardService consumerSecondaryCardService;
@Autowired
private SecondaryCardLogService secondaryCardLogService;
@Autowired
private SharingActivitiesService sharingActivitiesService;
......@@ -2480,10 +2488,16 @@ public class SOrderServiceImpl extends ServiceImpl<SOrderMapper, SOrder> impleme
Activity activity = null;
ConsumerMember consumerMember = null;
ConsumerWallet consumerWallet = null;
ConsumerMonthlyCard consumerMonthlyCard = null;
List<ConsumerSecondaryCard> consumerSecondaryCardList = null;
LambdaQueryWrapper<Activity> queryWrapper = new LambdaQueryWrapper<>();
if (ObjectUtil.isNotEmpty(user)) {
consumerWallet = consumerWalletService.getOne(new LambdaQueryWrapper<ConsumerWallet>().eq(ConsumerWallet::getConsumerId, user.getId()));
consumerMember = consumerMemberService.getOne(new LambdaQueryWrapper<ConsumerMember>().eq(ConsumerMember::getConsumerId, user.getId()));
consumerMonthlyCard = consumerMonthlyCardService.getOne(new LambdaQueryWrapper<ConsumerMonthlyCard>().eq(ConsumerMonthlyCard::getConsumerId, user.getId()));
consumerSecondaryCardList = consumerSecondaryCardService.list(new LambdaQueryWrapper<ConsumerSecondaryCard>().eq(ConsumerSecondaryCard::getConsumerId, user.getId())
.ne(ConsumerSecondaryCard::getNumber, YesNoEnum.no.getIndex())
);
if (ObjectUtil.isNotEmpty(consumerMember)) {
queryWrapper.eq(Activity::getIsOpen, YesNoEnum.yes.getIndex());
// if (consumerMember.getIsRights().equals(YesNoEnum.yes.getIndex())) {
......@@ -2532,6 +2546,9 @@ public class SOrderServiceImpl extends ServiceImpl<SOrderMapper, SOrder> impleme
priceResponse.setDiscountRatio(priceResponse.getDiscount());
totalFee = getBigDecimal(consumerWallet, activity, timeLong, priceResponse, totalFee, room, request, consumerMember);
}
if (ObjectUtil.isNotEmpty(consumerMonthlyCard)) {
totalFee = getBigDecimal(consumerMonthlyCard, timeLong, priceResponse, totalPrice, room);
}
} else {
SPack byId = packService.getById(roomLabel.getPackId());
if (!ObjectUtils.isEmpty(byId) && byId.getIsOpen().equals(YesNoEnum.yes.getIndex())) {
......@@ -2549,6 +2566,12 @@ public class SOrderServiceImpl extends ServiceImpl<SOrderMapper, SOrder> impleme
priceResponse.setDiscountRatio(priceResponse.getDiscount());
totalFee = getBigDecimal(consumerWallet, activity, timeLong, priceResponse, totalFee, byId, request);
}
if (CollectionUtils.isNotEmpty(consumerSecondaryCardList)) {
totalFee = getBigDecimal(consumerSecondaryCardList, priceResponse, byId, payPrice);
}
// if(ObjectUtil.isNotEmpty(consumerMonthlyCard)){
// totalFee = getBigDecimal(consumerMonthlyCard,timeLong,priceResponse,totalFee,room);
// }
// totalFee = getBigDecimal(consumerWallet, timeLong, priceResponse, totalFee, byId);
} else {
......@@ -2566,6 +2589,9 @@ public class SOrderServiceImpl extends ServiceImpl<SOrderMapper, SOrder> impleme
priceResponse.setDiscountRatio(priceResponse.getDiscount());
totalFee = getBigDecimal(consumerWallet, activity, timeLong, priceResponse, totalFee, room, request, consumerMember);
}
if (ObjectUtil.isNotEmpty(consumerMonthlyCard)) {
totalFee = getBigDecimal(consumerMonthlyCard, timeLong, priceResponse, totalPrice, room);
}
// totalFee = getBigDecimal(consumerWallet, timeLong, priceResponse, totalFee, room);
}
......@@ -2586,6 +2612,9 @@ public class SOrderServiceImpl extends ServiceImpl<SOrderMapper, SOrder> impleme
priceResponse.setDiscountRatio(priceResponse.getDiscount());
totalFee = getBigDecimal(consumerWallet, activity, timeLong, priceResponse, totalFee, byId, request);
}
if (CollectionUtils.isNotEmpty(consumerSecondaryCardList)) {
totalFee = getBigDecimal(consumerSecondaryCardList, priceResponse, byId, payPrice);
}
}
priceResponse.setTotalFee(payPrice);
......@@ -2914,6 +2943,46 @@ public class SOrderServiceImpl extends ServiceImpl<SOrderMapper, SOrder> impleme
return payPrice;
}
private BigDecimal getBigDecimal(ConsumerMonthlyCard consumerMonthlyCard, BigDecimal timeLong,
ComputedOrderPriceResponse priceResponse, BigDecimal totalFee, SRoom room) {
if (consumerMonthlyCard.getFreeDuration().compareTo(timeLong) >= 0) {
priceResponse.setDuration(timeLong);
priceResponse.setRemainingDuration(consumerMonthlyCard.getFreeDuration().subtract(timeLong));
priceResponse.setDiscount(BigDecimal.ZERO);
totalFee = new BigDecimal(0);
priceResponse.setMemberDiscount(new BigDecimal(0.00));
priceResponse.setTotalFeeNow(priceResponse.getTotalFee());
priceResponse.setPayFee(BigDecimal.ZERO);
priceResponse.setMonthlyCardId(consumerMonthlyCard.getId());
} else if (consumerMonthlyCard.getFreeDuration().compareTo(timeLong) < 0) {
priceResponse.setDuration(consumerMonthlyCard.getFreeDuration());
priceResponse.setRemainingDuration(new BigDecimal(0));
BigDecimal remainingBalance = consumerMonthlyCard.getFreeDuration().multiply(room.getPrice());
remainingBalance = totalFee.subtract(remainingBalance);
priceResponse.setTotalFeeNow(remainingBalance);
priceResponse.setMemberDiscount(totalFee.subtract(remainingBalance));
totalFee = remainingBalance;
priceResponse.setPayFee(remainingBalance);
priceResponse.setMonthlyCardId(consumerMonthlyCard.getId());
}
return totalFee;
}
private BigDecimal getBigDecimal(List<ConsumerSecondaryCard> consumerSecondaryCardList,
ComputedOrderPriceResponse priceResponse, SPack byId, BigDecimal payPrice) {
//获取集合中次数最少的次卡,次数不低于0
ConsumerSecondaryCard consumerSecondaryCard = consumerSecondaryCardList.stream().min(Comparator.comparing(ConsumerSecondaryCard::getNumber)).get();
if (consumerSecondaryCard.getPackId().equals(byId.getId())) {
priceResponse.setDiscount(BigDecimal.ZERO);
priceResponse.setMemberDiscount(BigDecimal.ZERO);
priceResponse.setTotalFeeNow(payPrice);
priceResponse.setPayFee(BigDecimal.ZERO);
priceResponse.setSecondaryCardId(consumerSecondaryCard.getId());
payPrice = BigDecimal.ZERO;
}
return payPrice;
}
private BigDecimal computeTotalPrice(Long packId, BigDecimal totalPrice) {
SPack pack = packService.getById(packId);
if (Objects.isNull(pack)) {
......
package share.system.service.impl;
import cn.hutool.core.util.ObjectUtil;
import cn.hutool.json.JSONObject;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import share.common.core.redis.RedisUtil;
import share.common.enums.ReceiptRdeisEnum;
import share.common.enums.YesNoEnum;
import share.common.exception.base.BaseException;
import share.common.utils.BaseUtil;
......@@ -23,7 +26,9 @@ import share.system.response.SecondaryCardOrderPayResultResponse;
import share.system.service.*;
import java.util.Date;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
/**
* 次卡购买记录Service业务层处理
......@@ -43,6 +48,8 @@ public class SecondaryCardOrderServiceImpl extends ServiceImpl<SecondaryCardOrde
private SecondaryCardConfService secondaryCardConfService;
@Autowired
private ConsumerSecondaryCardService consumerSecondaryCardService;
@Autowired
private RedisUtil redisUtil;
/**
* 查询次卡购买记录
......@@ -160,6 +167,18 @@ public class SecondaryCardOrderServiceImpl extends ServiceImpl<SecondaryCardOrde
consumerSecondaryCard.setNumber(secondaryCardConf.getNumber());
consumerSecondaryCard.setCreateTime(new Date());
consumerSecondaryCardService.save(consumerSecondaryCard);
Map<String, String> map = new HashMap<>();
map.put("consumerSecondaryCardId", String.valueOf(consumerSecondaryCard.getId()));
map.put("expirationTime", consumerSecondaryCard.getExpirationDate().toString());
JSONObject jsonObject = new JSONObject(map);
new Thread(() -> {
try {
Thread.sleep(1000);
redisUtil.set(ReceiptRdeisEnum.SECONDARY_CARD.getValue() + consumerSecondaryCard.getId(), jsonObject.toString());
} catch (InterruptedException e) {
e.printStackTrace();
}
}).start();
}
@Override
......
......@@ -21,6 +21,8 @@
<result property="packPrice" column="pack_price"/>
<result property="couponId" column="coupon_id"/>
<result property="couponPrice" column="coupon_price"/>
<result property="secondaryCardId" column="secondary_card_id"/>
<result property="monthlyCardId" column="monthly_card_id"/>
<result property="totalPrice" column="total_price"/>
<result property="duration" column="duration"/>
<result property="balance" column="balance"/>
......@@ -63,6 +65,8 @@
pack_price,
coupon_id,
coupon_price,
secondary_card_id,
monthly_card_id,
total_price,
pay_price,
duration,
......@@ -106,6 +110,8 @@
pack_price,
coupon_id,
coupon_price,
secondary_card_id,
monthly_card_id,
total_price,
pay_price,
duration,
......@@ -149,6 +155,8 @@
<if test="packPrice != null and packPrice != ''">and pack_price = #{packPrice}</if>
<if test="couponId != null and couponId != ''">and coupon_id = #{couponId}</if>
<if test="couponPrice != null and couponPrice != ''">and coupon_price = #{couponPrice}</if>
<if test="secondaryCardId != null and secondaryCardId != ''">and secondary_card_id = #{secondaryCardId}</if>
<if test="monthlyCardId != null and monthlyCardId != ''">and monthly_card_id = #{monthlyCardId}</if>
<if test="totalPrice != null and totalPrice != ''">and total_price = #{totalPrice}</if>
<if test="payPrice != null and payPrice != ''">and pay_price = #{payPrice}</if>
<if test="duration != null and duration != ''">and duration = #{duration}</if>
......@@ -230,6 +238,8 @@
s.pack_price,
s.coupon_id,
s.coupon_price,
s.secondary_card_id,
s.monthly_card_id,
s.total_price,
s.pay_price,
s.discount_ratio,
......@@ -278,6 +288,8 @@
s.pack_price,
s.coupon_id,
s.coupon_price,
s.secondary_card_id,
s.monthly_card_id,
s.total_price,
s.pay_price,
s.discount_ratio,
......@@ -339,6 +351,8 @@
<if test="packPrice != null and packPrice != ''">and pack_price = #{packPrice}</if>
<if test="couponId != null and couponId != ''">and coupon_id = #{couponId}</if>
<if test="couponPrice != null and couponPrice != ''">and coupon_price = #{couponPrice}</if>
<if test="secondaryCardId != null and secondaryCardId != ''">and secondary_card_id = #{secondaryCardId}</if>
<if test="monthlyCardId != null and monthlyCardId != ''">and monthly_card_id = #{monthlyCardId}</if>
<if test="totalPrice != null and totalPrice != ''">and total_price = #{totalPrice}</if>
<if test="payPrice != null and payPrice != ''">and pay_price = #{payPrice}</if>
<if test="duration != null and duration != ''">and duration = #{duration}</if>
......@@ -401,6 +415,8 @@
<if test="packPrice != null and packPrice != ''">and pack_price = #{packPrice}</if>
<if test="couponId != null and couponId != ''">and coupon_id = #{couponId}</if>
<if test="couponPrice != null and couponPrice != ''">and coupon_price = #{couponPrice}</if>
<if test="secondaryCardId != null and secondaryCardId != ''">and secondary_card_id = #{secondaryCardId}</if>
<if test="monthlyCardId != null and monthlyCardId != ''">and monthly_card_id = #{monthlyCardId}</if>
<if test="totalPrice != null and totalPrice != ''">and total_price = #{totalPrice}</if>
<if test="payPrice != null and payPrice != ''">and pay_price = #{payPrice}</if>
<if test="duration != null and duration != ''">and duration = #{duration}</if>
......@@ -480,6 +496,8 @@
<if test="discountRatio != null and discountRatio != ''">discount_ratio,</if>
<if test="duration != null and duration != ''">duration,</if>
<if test="balance != null and balance != '' ">balance,</if>
<if test="secondaryCardId != null and secondaryCardId != ''">secondary_card_id,</if>
<if test="monthlyCardId != null and monthlyCardId != ''">monthly_card_id,</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="orderNo != null">#{orderNo},</if>
......@@ -517,6 +535,8 @@
<if test="discountRatio != null">#{discountRatio},</if>
<if test="duration != null">#{duration},</if>
<if test="balance != null">#{balance},</if>
<if test="secondaryCardId != null">#{secondary_card_id},</if>
<if test="monthlyCardId != null">#{monthly_card_id},</if>
</trim>
</insert>
......@@ -559,6 +579,8 @@
<if test="discountRatio != null">discount_ratio = #{discountRatio},</if>
<if test="duration != null">duration = #{duration},</if>
<if test="balance != null">balance = #{balance},</if>
<if test="monthlyCardId != null">monthly_card_id = #{monthlyCardId},</if>
<if test="secondaryCardId != null">secondary_card_id = #{secondaryCardId},</if>
</trim>
where id = #{id}
</update>
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment