package com.xingxi.business.Banner.service.impl;

import com.xingxi.common.core.text.Convert;
import com.xingxi.common.utils.DateUtils;
import com.xingxi.business.Banner.domain.Banner;
import com.xingxi.business.Banner.mapper.BannerMapper;
import com.xingxi.business.Banner.service.IBannerService;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.List;

/**
 * bannerService业务层处理
 *
 * @author xingxi
 * @date 2025-03-06
 */
@Service
public class BannerServiceImpl implements IBannerService {
    @Resource
    private BannerMapper bannerMapper;

    /**
     * 查询banner
     *
     * @param bannerId banner主键
     * @return banner
     */
    @Override
    public Banner selectBannerByBannerId(Long bannerId) {
        return bannerMapper.selectBannerByBannerId(bannerId);
    }

    /**
     * 查询banner列表
     *
     * @param Banner banner
     * @return banner
     */
    @Override
    public List<Banner> selectBannerList(Banner Banner) {
        return bannerMapper.selectBannerList(Banner);
    }

    /**
     * 新增banner
     *
     * @param Banner banner
     * @return 结果
     */
    @Override
    public int insertBanner(Banner Banner) {
        Banner.setCreateTime(DateUtils.getNowDate());
        return bannerMapper.insertBanner(Banner);
    }

    /**
     * 新增banner
     *
     * @param BannerList banner
     * @return 结果
     */
    @Override
    public int batchInsertBanner(List<Banner> BannerList) {
        return bannerMapper.batchInsertBanner(BannerList);
    }

    /**
     * 修改banner
     *
     * @param Banner banner
     * @return 结果
     */
    @Override
    public int updateBanner(Banner Banner) {
        Banner.setUpdateTime(DateUtils.getNowDate());
        return bannerMapper.updateBanner(Banner);
    }

    /**
     * 批量删除banner
     *
     * @param bannerIds 需要删除的banner主键
     * @return 结果
     */
    @Override
    public int deleteBannerByBannerIds(String bannerIds) {
        return bannerMapper.deleteBannerByBannerIds(Convert.toStrArray(bannerIds));
    }

    /**
     * 删除banner信息
     *
     * @param bannerId banner主键
     * @return 结果
     */
    @Override
    public int deleteBannerByBannerId(Long bannerId) {
        return bannerMapper.deleteBannerByBannerId(bannerId);
    }

    /**
     * 逻辑删除banner
     *
     * @param bannerId banner主键
     * @return 结果
     */
    @Override
    public int logicDeleteBannerByBannerId(Long bannerId) {
        return bannerMapper.logicDeleteBannerByBannerId(bannerId);
    }

    /**
     * 逻辑批量删除banner
     *
     * @param bannerIds 需要删除的数据主键集合
     * @return 结果
     */
    @Override
    public int logicDeleteBannerByBannerIds(String[] bannerIds) {
        return bannerMapper.logicDeleteBannerByBannerIds(bannerIds);
    }

    /**
     * 逻辑批量删除banner
     *
     * @param Banner banner
     * @return 结果
     */
    @Override
    public int logicDeleteBannerByCondition(Banner Banner) {
        return bannerMapper.logicDeleteBannerByCondition(Banner);
    }
}
