| | |
| | | package com.jilongda.applet.service.impl; |
| | | |
| | | import com.baomidou.mybatisplus.core.toolkit.Wrappers; |
| | | import com.jilongda.applet.mapper.TStoreMapper; |
| | | import com.jilongda.applet.model.TCouponReceive; |
| | | import com.jilongda.applet.mapper.TCouponReceiveMapper; |
| | | import com.jilongda.applet.model.TStore; |
| | | import com.jilongda.applet.query.TCouponQuery; |
| | | import com.jilongda.applet.service.TCouponReceiveService; |
| | | import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; |
| | | import com.jilongda.applet.service.TStoreService; |
| | | import com.jilongda.applet.vo.TCouponReceiveVO; |
| | | import com.jilongda.common.basic.PageInfo; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.stereotype.Service; |
| | | import org.springframework.util.StringUtils; |
| | | |
| | | import java.util.Arrays; |
| | | import java.util.List; |
| | | |
| | | /** |
| | | * <p> |
| | |
| | | */ |
| | | @Service |
| | | public class TCouponReceiveServiceImpl extends ServiceImpl<TCouponReceiveMapper, TCouponReceive> implements TCouponReceiveService { |
| | | |
| | | @Autowired |
| | | private TStoreMapper storeMapper; |
| | | @Override |
| | | public PageInfo<TCouponReceiveVO> pageList(TCouponQuery query) { |
| | | PageInfo<TCouponReceiveVO> pageInfo = new PageInfo<>(query.getPageNum(), query.getPageSize()); |
| | | List<TCouponReceiveVO> list = this.baseMapper.pageList(query,pageInfo); |
| | | for (TCouponReceiveVO tCouponReceiveVO : list) { |
| | | if(StringUtils.hasLength(tCouponReceiveVO.getStoreId())){ |
| | | List<TStore> tStores = storeMapper.selectList(Wrappers.lambdaQuery(TStore.class) |
| | | .in(TStore::getId, Arrays.asList(tCouponReceiveVO.getStoreId().split(",")))); |
| | | tCouponReceiveVO.setStoreName(tStores.stream().map(TStore::getName).reduce((a, b) -> a + "," + b).orElse("")); |
| | | }else { |
| | | tCouponReceiveVO.setStoreName("全部门店"); |
| | | } |
| | | } |
| | | pageInfo.setRecords(list); |
| | | return pageInfo; |
| | | } |
| | | } |