package com.fs.store.service.impl;

import java.util.List;
import com.fs.common.utils.DateUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.fs.store.mapper.FsMaterialMapper;
import com.fs.store.domain.FsMaterial;
import com.fs.store.service.IFsMaterialService;

/**
 * 素材库Service业务层处理
 * 
 * @author fs
 * @date 2022-03-15
 */
@Service
public class FsMaterialServiceImpl implements IFsMaterialService 
{
    @Autowired
    private FsMaterialMapper fsMaterialMapper;

    /**
     * 查询素材库
     * 
     * @param materialId 素材库ID
     * @return 素材库
     */
    @Override
    public FsMaterial selectFsMaterialById(Long materialId)
    {
        return fsMaterialMapper.selectFsMaterialById(materialId);
    }

    /**
     * 查询素材库列表
     * 
     * @param fsMaterial 素材库
     * @return 素材库
     */
    @Override
    public List<FsMaterial> selectFsMaterialList(FsMaterial fsMaterial)
    {
        return fsMaterialMapper.selectFsMaterialList(fsMaterial);
    }

    /**
     * 新增素材库
     * 
     * @param fsMaterial 素材库
     * @return 结果
     */
    @Override
    public int insertFsMaterial(FsMaterial fsMaterial)
    {
        fsMaterial.setCreateTime(DateUtils.getNowDate());
        return fsMaterialMapper.insertFsMaterial(fsMaterial);
    }

    /**
     * 修改素材库
     * 
     * @param fsMaterial 素材库
     * @return 结果
     */
    @Override
    public int updateFsMaterial(FsMaterial fsMaterial)
    {
        fsMaterial.setUpdateTime(DateUtils.getNowDate());
        return fsMaterialMapper.updateFsMaterial(fsMaterial);
    }

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

    /**
     * 删除素材库信息
     * 
     * @param materialId 素材库ID
     * @return 结果
     */
    @Override
    public int deleteFsMaterialById(Long materialId)
    {
        return fsMaterialMapper.deleteFsMaterialById(materialId);
    }
}
