活动 置空问题
This commit is contained in:
@@ -1,6 +1,7 @@
|
||||
package cn.ysk.cashier.mybatis.entity;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.FieldFill;
|
||||
import com.baomidou.mybatisplus.annotation.FieldStrategy;
|
||||
import com.baomidou.mybatisplus.annotation.TableField;
|
||||
import com.baomidou.mybatisplus.extension.activerecord.Model;
|
||||
|
||||
@@ -17,10 +18,12 @@ public class TbActivate extends Model<TbActivate> {
|
||||
//赠送金额
|
||||
private Integer giftAmount;
|
||||
//赠送积分
|
||||
@TableField(updateStrategy = FieldStrategy.ALWAYS)
|
||||
private Integer giftPoints;
|
||||
//是否使用优惠卷 0否 1是
|
||||
private Integer isUseCoupon;
|
||||
//优惠卷id
|
||||
@TableField(updateStrategy = FieldStrategy.ALWAYS)
|
||||
private Integer couponId;
|
||||
@TableField(exist = false)
|
||||
private String couponName;
|
||||
|
||||
@@ -45,15 +45,7 @@ public class TbActivateServiceImpl extends ServiceImpl<TbActivateMapper, TbActiv
|
||||
@Override
|
||||
public void modifyActivate(TbActivate activate) {
|
||||
if (Objects.nonNull(activate.getId()) && activate.getId() > 0) {
|
||||
UpdateWrapper<TbActivate> updateWrapper = new UpdateWrapper<>();
|
||||
updateWrapper.setEntity(activate);
|
||||
if (Objects.isNull(activate.getCouponId())) {
|
||||
updateWrapper.set("coupon_id", null);
|
||||
}
|
||||
if (Objects.isNull(activate.getGiftPoints())) {
|
||||
updateWrapper.set("gift_points", null);
|
||||
}
|
||||
activateMapper.update(updateWrapper);
|
||||
activateMapper.updateById(activate);
|
||||
} else {
|
||||
activateMapper.insert(activate);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user