|  |  |  | 
|---|
|  |  |  | package cc.mrbird.febs.mall.service.impl; | 
|---|
|  |  |  |  | 
|---|
|  |  |  | import cc.mrbird.febs.common.entity.FebsResponse; | 
|---|
|  |  |  | import cc.mrbird.febs.mall.dto.NewsListDto; | 
|---|
|  |  |  | import cc.mrbird.febs.mall.entity.MallNewsCategory; | 
|---|
|  |  |  | import cc.mrbird.febs.mall.entity.MallNewsInfo; | 
|---|
|  |  |  | import cc.mrbird.febs.mall.entity.PlatformBanner; | 
|---|
|  |  |  | import cc.mrbird.febs.mall.mapper.MallNewsCategoryMapper; | 
|---|
|  |  |  | import cc.mrbird.febs.mall.mapper.MallNewsInfoMapper; | 
|---|
|  |  |  | import cc.mrbird.febs.mall.mapper.PlatformBannerMapper; | 
|---|
|  |  |  | import cc.mrbird.febs.mall.service.IApiMallNewsService; | 
|---|
|  |  |  | import cc.mrbird.febs.mall.vo.NewsListVo; | 
|---|
|  |  |  | import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; | 
|---|
|  |  |  | import com.baomidou.mybatisplus.core.metadata.IPage; | 
|---|
|  |  |  | import com.baomidou.mybatisplus.extension.plugins.pagination.Page; | 
|---|
|  |  |  | import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; | 
|---|
|  |  |  | import lombok.RequiredArgsConstructor; | 
|---|
|  |  |  | import lombok.extern.slf4j.Slf4j; | 
|---|
|  |  |  | import org.springframework.stereotype.Service; | 
|---|
|  |  |  |  | 
|---|
|  |  |  | import java.util.List; | 
|---|
|  |  |  |  | 
|---|
|  |  |  | /** | 
|---|
|  |  |  | * @author wzy | 
|---|
|  |  |  | 
|---|
|  |  |  | @RequiredArgsConstructor | 
|---|
|  |  |  | public class ApiMallNewsServiceImpl extends ServiceImpl<MallNewsInfoMapper, MallNewsInfo> implements IApiMallNewsService { | 
|---|
|  |  |  |  | 
|---|
|  |  |  | private final MallNewsCategoryMapper mallNewsCategoryMapper; | 
|---|
|  |  |  | private final PlatformBannerMapper platformBannerMapper; | 
|---|
|  |  |  |  | 
|---|
|  |  |  | @Override | 
|---|
|  |  |  | public List<MallNewsCategory> findNewsCategoryList() { | 
|---|
|  |  |  | return mallNewsCategoryMapper.selectList(null); | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | @Override | 
|---|
|  |  |  | public IPage<NewsListVo> findNewsInPage(NewsListDto newsListDto) { | 
|---|
|  |  |  | Page<NewsListVo> page = new Page<>(newsListDto.getPageNum(), newsListDto.getPageSize()); | 
|---|
|  |  |  |  | 
|---|
|  |  |  | MallNewsInfo mallNewsInfo = new MallNewsInfo(); | 
|---|
|  |  |  | mallNewsInfo.setCategoryId(newsListDto.getCategoryId()); | 
|---|
|  |  |  | return this.baseMapper.selectNewsVoInPage(page, mallNewsInfo); | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | @Override | 
|---|
|  |  |  | public List<NewsListVo> findTopNews() { | 
|---|
|  |  |  | Page<NewsListVo> page = new Page<>(1, 999); | 
|---|
|  |  |  | MallNewsInfo mallNewsInfo = new MallNewsInfo(); | 
|---|
|  |  |  | mallNewsInfo.setIsTop(1); | 
|---|
|  |  |  |  | 
|---|
|  |  |  | IPage<NewsListVo> pageList = this.baseMapper.selectNewsVoInPage(page, mallNewsInfo); | 
|---|
|  |  |  | return pageList.getRecords(); | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | @Override | 
|---|
|  |  |  | public FebsResponse findAllBanner() { | 
|---|
|  |  |  | QueryWrapper<PlatformBanner> queryWrapper = new QueryWrapper<>(); | 
|---|
|  |  |  | queryWrapper.orderByAsc("is_top"); | 
|---|
|  |  |  | List<PlatformBanner> paymentMethodList = platformBannerMapper.selectList(queryWrapper); | 
|---|
|  |  |  | return new FebsResponse().success().data(paymentMethodList); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | } | 
|---|