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

import java.util.List;
import com.bonus.common.core.utils.DateUtils;
import com.bonus.common.security.utils.SecurityUtils;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.bonus.material.basic.mapper.BmStorageLogMapper;
import com.bonus.common.biz.domain.BmStorageLog;
import com.bonus.material.basic.service.IBmStorageLogService;

/**
 * 库存日志Service业务层处理
 * 
 * @author xsheng
 * @date 2024-09-26
 */
@Service
@Slf4j
public class BmStorageLogServiceImpl implements IBmStorageLogService {

    @Autowired
    private BmStorageLogMapper bmStorageLogMapper;

    /**
     * 查询库存日志
     * 
     * @param id 库存日志主键
     * @return 库存日志
     */
    @Override
    public BmStorageLog selectBmStorageLogById(Long id)
    {
        return bmStorageLogMapper.selectBmStorageLogById(id);
    }

    /**
     * 查询库存日志列表
     * 
     * @param bmStorageLog 库存日志
     * @return 库存日志
     */
    @Override
    public List<BmStorageLog> selectBmStorageLogList(BmStorageLog bmStorageLog)
    {
        return bmStorageLogMapper.selectBmStorageLogList(bmStorageLog);
    }

    /**
     * 新增库存日志
     * 
     * @param bmStorageLog 库存日志
     * @return 结果
     */
    @Override
    public int insertBmStorageLog(BmStorageLog bmStorageLog)
    {
        bmStorageLog.setCreateTime(DateUtils.getNowDate());
        return bmStorageLogMapper.insertBmStorageLog(bmStorageLog);
    }

    /**
     * 修改库存日志
     * 
     * @param bmStorageLog 库存日志
     * @return 结果
     */
    @Override
    public int updateBmStorageLog(BmStorageLog bmStorageLog)
    {
        bmStorageLog.setUpdateTime(DateUtils.getNowDate());
        return bmStorageLogMapper.updateBmStorageLog(bmStorageLog);
    }

    /**
     * 批量删除库存日志
     * 
     * @param ids 需要删除的库存日志主键
     * @return 结果
     */
    @Override
    public int deleteBmStorageLogByIds(Long[] ids)
    {
        return bmStorageLogMapper.deleteBmStorageLogByIds(ids);
    }

    /**
     * 删除库存日志信息
     * 
     * @param id 库存日志主键
     * @return 结果
     */
    @Override
    public int deleteBmStorageLogById(Long id)
    {
        return bmStorageLogMapper.deleteBmStorageLogById(id);
    }

    @Override
    public int batchInsert(List<BmStorageLog> records) {
        log.info("batch insert log {}", records);
        return bmStorageLogMapper.batchInsert(records);
    }
}
