package com.ruoyi.web.modules.home.service.impl;

import java.util.Collections;
import java.util.List;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.ruoyi.web.modules.home.constant.HomeConstants;
import com.ruoyi.web.modules.home.mapper.HomeAppMapper;
import com.ruoyi.web.modules.home.service.IHomeAppService;
import com.ruoyi.web.modules.home.vo.HomeBannerVO;
import com.ruoyi.web.modules.home.vo.HomeCategoryNavVO;
import com.ruoyi.web.modules.home.vo.HomeHotGoodsVO;

/**
 * C 端商城首页 Service 实现
 */
@Service
public class HomeAppServiceImpl implements IHomeAppService
{
    @Autowired
    private HomeAppMapper homeAppMapper;

    @Override
    public List<HomeBannerVO> listBanners()
    {
        List<HomeBannerVO> list = homeAppMapper.selectBannersForHome(HomeConstants.BANNER_LIST_LIMIT);
        return list != null ? list : Collections.emptyList();
    }

    @Override
    public List<HomeCategoryNavVO> listPlatformLevel1Nav()
    {
        List<HomeCategoryNavVO> list = homeAppMapper.selectPlatformLevel1Nav();
        return list != null ? list : Collections.emptyList();
    }

    @Override
    public List<HomeHotGoodsVO> listHotGoods()
    {
        List<HomeHotGoodsVO> list = homeAppMapper.selectHotGoodsForHome(HomeConstants.HOT_GOODS_LIMIT);
        return list != null ? list : Collections.emptyList();
    }
}
