package com.bonus.material.basic.service.impl;

import java.util.List;
import com.bonus.common.core.utils.DateUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.bonus.material.basic.mapper.BmFileInfoMapper;
import com.bonus.common.biz.domain.BmFileInfo;
import com.bonus.material.basic.service.IBmFileInfoService;

/**
 * 附件
Service业务层处理
 * 
 * @author xsheng
 * @date 2024-09-26
 */
@Service
public class BmFileInfoServiceImpl implements IBmFileInfoService 
{
    @Autowired
    private BmFileInfoMapper bmFileInfoMapper;

    /**
     * 查询附件

     * 
     * @param id 附件
主键
     * @return 附件

     */
    @Override
    public BmFileInfo selectBmFileInfoById(Long id)
    {
        return bmFileInfoMapper.selectBmFileInfoById(id);
    }

    /**
     * 查询附件
列表
     * 
     * @param bmFileInfo 附件

     * @return 附件

     */
    @Override
    public List<BmFileInfo> selectBmFileInfoList(BmFileInfo bmFileInfo)
    {
        return bmFileInfoMapper.selectBmFileInfoList(bmFileInfo);
    }

    /**
     * 新增附件

     * 
     * @param bmFileInfo 附件

     * @return 结果
     */
    @Override
    public int insertBmFileInfo(BmFileInfo bmFileInfo)
    {
        bmFileInfo.setCreateTime(DateUtils.getNowDate());
        return bmFileInfoMapper.insertBmFileInfo(bmFileInfo);
    }

    @Override
    public int insertBmFileInfos(List<BmFileInfo> bmFileInfos)
    {
        bmFileInfos.stream().forEach(o -> o.setCreateTime(DateUtils.getNowDate()));
        return bmFileInfoMapper.insertBmFileInfos(bmFileInfos);
    }

    /**
     * 修改附件

     * 
     * @param bmFileInfo 附件

     * @return 结果
     */
    @Override
    public int updateBmFileInfo(BmFileInfo bmFileInfo)
    {
        return bmFileInfoMapper.updateBmFileInfo(bmFileInfo);
    }

    /**
     * 批量删除附件

     * 
     * @param ids 需要删除的附件
主键
     * @return 结果
     */
    @Override
    public int deleteBmFileInfoByIds(Long[] ids)
    {
        return bmFileInfoMapper.deleteBmFileInfoByIds(ids);
    }

    /**
     * 删除附件
信息
     * 
     * @param id 附件
主键
     * @return 结果
     */
    @Override
    public int deleteBmFileInfoById(Long id)
    {
        return bmFileInfoMapper.deleteBmFileInfoById(id);
    }
}
