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