package com.ruoyi.logistics.service.impl;

import java.util.List;
import com.ruoyi.common.core.utils.DateUtils;
import com.ruoyi.common.security.utils.SecurityUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.ruoyi.logistics.mapper.BizBannerMapper;
import com.ruoyi.logistics.domain.BizBanner;
import com.ruoyi.logistics.service.IBizBannerService;

/**
 * 轮播图Service业务层处理
 * 
 * @author RuiJing
 * @date 2026-02-05
 */
@Service
public class BizBannerServiceImpl implements IBizBannerService 
{
    @Autowired
    private BizBannerMapper bizBannerMapper;

    /**
     * 查询轮播图
     * 
     * @param bannerId 轮播图主键
     * @return 轮播图
     */
    @Override
    public BizBanner selectBizBannerByBannerId(Long bannerId)
    {
        return bizBannerMapper.selectBizBannerByBannerId(bannerId);
    }

    /**
     * 查询轮播图列表
     * 
     * @param bizBanner 轮播图
     * @return 轮播图
     */
    @Override
    public List<BizBanner> selectBizBannerList(BizBanner bizBanner)
    {
        return bizBannerMapper.selectBizBannerList(bizBanner);
    }

    /**
     * 新增轮播图
     * 
     * @param bizBanner 轮播图
     * @return 结果
     */
    @Override
    public int insertBizBanner(BizBanner bizBanner)
    {
        bizBanner.setCreateTime(DateUtils.getNowDate());
        bizBanner.setCreateBy(SecurityUtils.getLoginUser().getSysUser().getNickName());
        bizBanner.setUserId(SecurityUtils.getUserId());
        bizBanner.setDeptId(SecurityUtils.getLoginUser().getSysUser().getDeptId());
        return bizBannerMapper.insertBizBanner(bizBanner);
    }

    /**
     * 修改轮播图
     * 
     * @param bizBanner 轮播图
     * @return 结果
     */
    @Override
    public int updateBizBanner(BizBanner bizBanner)
    {
        bizBanner.setUpdateTime(DateUtils.getNowDate());
        bizBanner.setUpdateBy(SecurityUtils.getLoginUser().getSysUser().getNickName());
        return bizBannerMapper.updateBizBanner(bizBanner);
    }

    /**
     * 批量删除轮播图
     * 
     * @param bannerIds 需要删除的轮播图主键
     * @return 结果
     */
    @Override
    public int deleteBizBannerByBannerIds(Long[] bannerIds)
    {
        return bizBannerMapper.deleteBizBannerByBannerIds(bannerIds);
    }

    /**
     * 删除轮播图信息
     * 
     * @param bannerId 轮播图主键
     * @return 结果
     */
    @Override
    public int deleteBizBannerByBannerId(Long bannerId)
    {
        return bizBannerMapper.deleteBizBannerByBannerId(bannerId);
    }
}
