package com.younike.system.service.impl;

import java.util.List;
import java.time.LocalDateTime;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.younike.system.mapper.IndexBannerMapper;
import com.younike.system.domain.IndexBanner;
import com.younike.system.service.IIndexBannerService;

/**
 * 首页轮播Service业务层处理
 * 
 * @author elev
 * @date 2022-01-13
 */
@Service
public class IndexBannerServiceImpl implements IIndexBannerService {
    @Autowired
    private IndexBannerMapper indexBannerMapper;

    /**
     * 查询首页轮播
     * 
     * @param id 首页轮播主键
     * @return 首页轮播
     */
    @Override
    public IndexBanner selectIndexBannerById(Long id) {
        return indexBannerMapper.selectIndexBannerById(id);
    }

    /**
     * 查询首页轮播列表
     * 
     * @param indexBanner 首页轮播
     * @return 首页轮播
     */
    @Override
    public List<IndexBanner> selectIndexBannerList(IndexBanner indexBanner) {
        return indexBannerMapper.selectIndexBannerList(indexBanner);
    }

    /**
     * 新增首页轮播
     * 
     * @param indexBanner 首页轮播
     * @return 结果
     */
    @Override
    public int insertIndexBanner(IndexBanner indexBanner) {
        indexBanner.setCreateTime(LocalDateTime.now());
        return indexBannerMapper.insertIndexBanner(indexBanner);
    }

    /**
     * 修改首页轮播
     * 
     * @param indexBanner 首页轮播
     * @return 结果
     */
    @Override
    public int updateIndexBanner(IndexBanner indexBanner) {
        indexBanner.setUpdateTime(LocalDateTime.now());
        return indexBannerMapper.updateIndexBanner(indexBanner);
    }

    /**
     * 批量删除首页轮播
     * 
     * @param ids 需要删除的首页轮播主键
     * @return 结果
     */
    @Override
    public int deleteIndexBannerByIds(Long[] ids) {
        return indexBannerMapper.deleteIndexBannerByIds(ids);
    }

    /**
     * 删除首页轮播信息
     * 
     * @param id 首页轮播主键
     * @return 结果
     */
    @Override
    public int deleteIndexBannerById(Long id)
    {
        return indexBannerMapper.deleteIndexBannerById(id);
    }
}
