package com.ruoyi.mall.service.impl;

import java.util.List;
import com.ruoyi.common.utils.DateUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.ruoyi.mall.mapper.MallPosterSettingMapper;
import com.ruoyi.mall.domain.MallPosterSetting;
import com.ruoyi.mall.service.IMallPosterSettingService;

import javax.annotation.Resource;

/**
 * 海报背景图Service业务层处理
 *
 * @author ruoyi
 * @date 2023-11-07
 */
@Service
public class MallPosterSettingServiceImpl implements IMallPosterSettingService
{
    @Resource
    private MallPosterSettingMapper mallPosterSettingMapper;

    /**
     * 查询海报背景图
     *
     * @param posterId 海报背景图主键
     * @return 海报背景图
     */
    @Override
    public MallPosterSetting selectMallPosterSettingByPosterId(Integer posterId)
    {
        return mallPosterSettingMapper.selectMallPosterSettingByPosterId(posterId);
    }

    /**
     * 查询海报背景图列表
     *
     * @param mallPosterSetting 海报背景图
     * @return 海报背景图
     */
    @Override
    public List<MallPosterSetting> selectMallPosterSettingList(MallPosterSetting mallPosterSetting)
    {
        return mallPosterSettingMapper.selectMallPosterSettingList(mallPosterSetting);
    }

    /**
     * 新增海报背景图
     *
     * @param mallPosterSetting 海报背景图
     * @return 结果
     */
    @Override
    public int insertMallPosterSetting(MallPosterSetting mallPosterSetting)
    {
        mallPosterSetting.setStatus(0);
        mallPosterSetting.setCreateTime(DateUtils.getNowDate());
        mallPosterSetting.setDelFlag(0);
        return mallPosterSettingMapper.insertMallPosterSetting(mallPosterSetting);
    }

    /**
     * 修改海报背景图
     *
     * @param mallPosterSetting 海报背景图
     * @return 结果
     */
    @Override
    public int updateMallPosterSetting(MallPosterSetting mallPosterSetting)
    {
        mallPosterSetting.setUpdateTime(DateUtils.getNowDate());
        return mallPosterSettingMapper.updateMallPosterSetting(mallPosterSetting);
    }

    /**
     * 批量删除海报背景图
     *
     * @param posterIds 需要删除的海报背景图主键
     * @return 结果
     */
    @Override
    public int deleteMallPosterSettingByPosterIds(Integer[] posterIds)
    {
        return mallPosterSettingMapper.deleteMallPosterSettingByPosterIds(posterIds);
    }

    /**
     * 删除海报背景图信息
     *
     * @param posterId 海报背景图主键
     * @return 结果
     */
    @Override
    public int deleteMallPosterSettingByPosterId(Integer posterId)
    {
        return mallPosterSettingMapper.deleteMallPosterSettingByPosterId(posterId);
    }
}
