| | |
| | | |
| | | import com.baomidou.mybatisplus.core.metadata.IPage; |
| | | import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; |
| | | import com.ruoyi.other.api.domain.Goods; |
| | | import com.ruoyi.other.mapper.CouponInfoMapper; |
| | | import com.ruoyi.other.api.domain.CouponInfo; |
| | | import com.ruoyi.other.service.CouponInfoService; |
| | | import com.ruoyi.other.service.GoodsService; |
| | | import org.springframework.stereotype.Service; |
| | | |
| | | import javax.annotation.Resource; |
| | | import java.util.Arrays; |
| | | import java.util.List; |
| | | import java.util.stream.Collectors; |
| | | |
| | | /** |
| | | * <p> |
| | |
| | | @Service |
| | | public class CouponInfoServiceImpl extends ServiceImpl<CouponInfoMapper, CouponInfo> implements CouponInfoService { |
| | | |
| | | @Resource |
| | | private GoodsService goodsService; |
| | | |
| | | |
| | | @Override |
| | | public IPage<CouponInfo> queryCouponInfoPage(IPage<CouponInfo> page, CouponInfo couponInfo) { |
| | | return this.baseMapper.queryCouponInfoPage(page, couponInfo); |
| | | IPage<CouponInfo> couponInfoIPage = this.baseMapper.queryCouponInfoPage(page, couponInfo); |
| | | for (CouponInfo record : couponInfoIPage.getRecords()) { |
| | | if(record.getCouponType() == 4){ |
| | | String[] split = record.getForGoodIds().split(","); |
| | | List<String> collect = goodsService.listByIds(Arrays.asList(split)).stream().map(Goods::getName).collect(Collectors.toList()); |
| | | record.setGoodsNameList(collect); |
| | | } |
| | | } |
| | | return couponInfoIPage; |
| | | } |
| | | } |