package com.ruoyi.system.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.system.mapper.BomanMaterialMapper;
import com.ruoyi.system.domain.BomanMaterial;
import com.ruoyi.system.service.IBomanMaterialService;

/**
 * 素材库Service业务层处理
 * 
 * @author boman
 * @date 2023-11-02
 */
@Service
public class BomanMaterialServiceImpl implements IBomanMaterialService 
{
    @Autowired
    private BomanMaterialMapper bomanMaterialMapper;

    /**
     * 查询素材库
     * 
     * @param materialId 素材库主键
     * @return 素材库
     */
    @Override
    public BomanMaterial selectBomanMaterialByMaterialId(Long materialId)
    {
        return bomanMaterialMapper.selectBomanMaterialByMaterialId(materialId);
    }

    /**
     * 查询素材库列表
     * 
     * @param bomanMaterial 素材库
     * @return 素材库
     */
    @Override
    public List<BomanMaterial> selectBomanMaterialList(BomanMaterial bomanMaterial)
    {
        return bomanMaterialMapper.selectBomanMaterialList(bomanMaterial);
    }

    /**
     * 新增素材库
     * 
     * @param bomanMaterial 素材库
     * @return 结果
     */
    @Override
    public int insertBomanMaterial(List<BomanMaterial> bomanMaterial)
    {

        return bomanMaterialMapper.batchBomanMaterial(bomanMaterial);
    }

    /**
     * 修改素材库
     * 
     * @param bomanMaterial 素材库
     * @return 结果
     */
    @Override
    public int updateBomanMaterial(BomanMaterial bomanMaterial)
    {
        bomanMaterial.setUpdateTime(DateUtils.getNowDate());
        return bomanMaterialMapper.updateBomanMaterial(bomanMaterial);
    }

    /**
     * 批量删除素材库
     * 
     * @param materialIds 需要删除的素材库主键
     * @return 结果
     */
    @Override
    public int deleteBomanMaterialByMaterialIds(Long[] materialIds)
    {
        return bomanMaterialMapper.deleteBomanMaterialByMaterialIds(materialIds);
    }

    /**
     * 删除素材库信息
     * 
     * @param materialId 素材库主键
     * @return 结果
     */
    @Override
    public int deleteBomanMaterialByMaterialId(Long materialId)
    {
        return bomanMaterialMapper.deleteBomanMaterialByMaterialId(materialId);
    }
}
