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

import java.util.List;
import com.bonus.common.core.exception.ServiceException;
import com.bonus.common.core.utils.DateUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.bonus.material.task.mapper.TmTaskStorageAnalyzeMapper;
import com.bonus.material.task.domain.TmTaskStorageAnalyze;
import com.bonus.material.task.service.ITmTaskStorageAnalyzeService;

/**
 * 定期库存分析Service业务层处理
 * 
 * @author xsheng
 * @date 2024-10-16
 */
@Service
public class TmTaskStorageAnalyzeServiceImpl implements ITmTaskStorageAnalyzeService {
    @Autowired
    private TmTaskStorageAnalyzeMapper tmTaskStorageAnalyzeMapper;

    /**
     * 查询定期库存分析
     * 
     * @param id 定期库存分析主键
     * @return 定期库存分析
     */
    @Override
    public TmTaskStorageAnalyze selectTmTaskStorageAnalyzeById(Long id) {
        return tmTaskStorageAnalyzeMapper.selectTmTaskStorageAnalyzeById(id);
    }

    /**
     * 查询定期库存分析列表
     * 
     * @param tmTaskStorageAnalyze 定期库存分析
     * @return 定期库存分析
     */
    @Override
    public List<TmTaskStorageAnalyze> selectTmTaskStorageAnalyzeList(TmTaskStorageAnalyze tmTaskStorageAnalyze) {
        return tmTaskStorageAnalyzeMapper.selectTmTaskStorageAnalyzeList(tmTaskStorageAnalyze);
    }

    /**
     * 新增定期库存分析
     * 
     * @param tmTaskStorageAnalyze 定期库存分析
     * @return 结果
     */
    @Override
    public int insertTmTaskStorageAnalyze(TmTaskStorageAnalyze tmTaskStorageAnalyze) {
        tmTaskStorageAnalyze.setCreateTime(DateUtils.getNowDate());
        try {
            return tmTaskStorageAnalyzeMapper.insertTmTaskStorageAnalyze(tmTaskStorageAnalyze);
        } catch (Exception e) {
            throw new ServiceException("错误信息描述");
        }
    }

    /**
     * 修改定期库存分析
     * 
     * @param tmTaskStorageAnalyze 定期库存分析
     * @return 结果
     */
    @Override
    public int updateTmTaskStorageAnalyze(TmTaskStorageAnalyze tmTaskStorageAnalyze) {
        tmTaskStorageAnalyze.setUpdateTime(DateUtils.getNowDate());
        try {
            return tmTaskStorageAnalyzeMapper.updateTmTaskStorageAnalyze(tmTaskStorageAnalyze);
        } catch (Exception e) {
            throw new ServiceException("错误信息描述");
        }
    }

    /**
     * 批量删除定期库存分析
     * 
     * @param ids 需要删除的定期库存分析主键
     * @return 结果
     */
    @Override
    public int deleteTmTaskStorageAnalyzeByIds(Long[] ids) {
        return tmTaskStorageAnalyzeMapper.deleteTmTaskStorageAnalyzeByIds(ids);
    }

    /**
     * 删除定期库存分析信息
     * 
     * @param id 定期库存分析主键
     * @return 结果
     */
    @Override
    public int deleteTmTaskStorageAnalyzeById(Long id) {
        return tmTaskStorageAnalyzeMapper.deleteTmTaskStorageAnalyzeById(id);
    }
}
