活动 添加优惠券名称字段
This commit is contained in:
@@ -19,6 +19,7 @@ public class TbActivate extends Model<TbActivate> {
|
||||
private Integer isUseCoupon;
|
||||
//优惠卷id
|
||||
private Integer couponId;
|
||||
private String couponName;
|
||||
//优惠卷数量
|
||||
private Integer num;
|
||||
|
||||
@@ -76,6 +77,14 @@ public class TbActivate extends Model<TbActivate> {
|
||||
this.couponId = couponId;
|
||||
}
|
||||
|
||||
public String getCouponName() {
|
||||
return couponName;
|
||||
}
|
||||
|
||||
public void setCouponName(String couponName) {
|
||||
this.couponName = couponName;
|
||||
}
|
||||
|
||||
public Integer getNum() {
|
||||
return num;
|
||||
}
|
||||
|
||||
@@ -1,16 +1,15 @@
|
||||
package cn.ysk.cashier.mybatis.service.impl;
|
||||
|
||||
import cn.ysk.cashier.mybatis.entity.TbActivate;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import cn.ysk.cashier.mybatis.entity.TbShopCoupon;
|
||||
import cn.ysk.cashier.mybatis.mapper.TbActivateMapper;
|
||||
import cn.ysk.cashier.mybatis.service.TbActivateService;
|
||||
import cn.ysk.cashier.mybatis.service.TbShopCouponService;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import cn.ysk.cashier.mybatis.service.TbActivateService;
|
||||
import cn.ysk.cashier.mybatis.mapper.TbActivateMapper;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.util.CollectionUtils;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Objects;
|
||||
|
||||
@@ -24,6 +23,8 @@ public class TbActivateServiceImpl extends ServiceImpl<TbActivateMapper, TbActiv
|
||||
|
||||
@Autowired
|
||||
private TbActivateMapper activateMapper;
|
||||
@Autowired
|
||||
private TbShopCouponService tbShopCouponService;
|
||||
|
||||
@Override
|
||||
public Object findActivate(String shopId) {
|
||||
@@ -31,6 +32,12 @@ public class TbActivateServiceImpl extends ServiceImpl<TbActivateMapper, TbActiv
|
||||
queryWrapper.eq("shop_id", shopId);
|
||||
queryWrapper.orderByDesc("id");
|
||||
List<TbActivate> list = activateMapper.selectList(queryWrapper);
|
||||
for (TbActivate tbActivate : list) {
|
||||
if (tbActivate.getCouponId() != null) {
|
||||
TbShopCoupon coupon = tbShopCouponService.findById(tbActivate.getCouponId());
|
||||
tbActivate.setCouponName(coupon != null ? coupon.getTitle() : "");
|
||||
}
|
||||
}
|
||||
return list;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user