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.ClewMaterialMapper;
import com.ruoyi.system.domain.ClewMaterial;
import com.ruoyi.system.service.IClewMaterialService;
import com.ruoyi.common.core.text.Convert;

/**
 * 素材Service业务层处理
 *
 * @author ruoyi
 * @date 2023-10-07
 */
@Service
public class ClewMaterialServiceImpl implements IClewMaterialService
{
    @Autowired
    private ClewMaterialMapper clewMaterialMapper;

    /**
     * 查询素材
     *
     * @param id 素材主键
     * @return 素材
     */
    @Override
    public ClewMaterial selectClewMaterialById(Long id)
    {
        return clewMaterialMapper.selectClewMaterialById(id);
    }

    /**
     * 查询素材列表
     *
     * @param clewMaterial 素材
     * @return 素材
     */
    @Override
    public List<ClewMaterial> selectClewMaterialList(ClewMaterial clewMaterial)
    {
        return clewMaterialMapper.selectClewMaterialList(clewMaterial);
    }

    /**
     * 新增素材
     *
     * @param clewMaterial 素材
     * @return 结果
     */
    @Override
    public int insertClewMaterial(ClewMaterial clewMaterial)
    {
        clewMaterial.setCreateTime(DateUtils.getNowDate());
        return clewMaterialMapper.insertClewMaterial(clewMaterial);
    }

    /**
     * 修改素材
     *
     * @param clewMaterial 素材
     * @return 结果
     */
    @Override
    public int updateClewMaterial(ClewMaterial clewMaterial)
    {
        clewMaterial.setUpdateTime(DateUtils.getNowDate());
        return clewMaterialMapper.updateClewMaterial(clewMaterial);
    }

    /**
     * 批量删除素材
     *
     * @param ids 需要删除的素材主键
     * @return 结果
     */
    @Override
    public int deleteClewMaterialByIds(String ids)
    {
        return clewMaterialMapper.deleteClewMaterialByIds(Convert.toStrArray(ids));
    }

    /**
     * 删除素材信息
     *
     * @param id 素材主键
     * @return 结果
     */
    @Override
    public int deleteClewMaterialById(Long id)
    {
        return clewMaterialMapper.deleteClewMaterialById(id);
    }
}
