package com.phm.manage.service.impl;

import com.phm.common.utils.DateUtils;
import com.phm.manage.domain.ForecastResult;
import com.phm.manage.mapper.ForecastResultMapper;
import com.phm.manage.service.IForecastResultService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * 预测结果Service业务层处理
 *
 * @author phm
 * @date 2023-08-31
 */
@Service
public class ForecastResultServiceImpl implements IForecastResultService {
    @Autowired
    private ForecastResultMapper forecastResultMapper;

    /**
     * 查询预测结果
     *
     * @param id 预测结果主键
     * @return 预测结果
     */
    @Override
    public ForecastResult selectForecastResultById(Long id) {
        return forecastResultMapper.selectForecastResultById(id);
    }

    /**
     * 查询预测结果列表
     *
     * @param forecastResult 预测结果
     * @return 预测结果
     */
    @Override
    public List<ForecastResult> selectForecastResultList(ForecastResult forecastResult) {
        return forecastResultMapper.selectForecastResultList(forecastResult);
    }

    /**
     * 新增预测结果
     *
     * @param forecastResult 预测结果
     * @return 结果
     */
    @Override
    public int insertForecastResult(ForecastResult forecastResult) {
        forecastResult.setCreateTime(DateUtils.getNowDate());
        return forecastResultMapper.insertForecastResult(forecastResult);
    }

    /**
     * 修改预测结果
     *
     * @param forecastResult 预测结果
     * @return 结果
     */
    @Override
    public int updateForecastResult(ForecastResult forecastResult) {
        forecastResult.setUpdateTime(DateUtils.getNowDate());
        return forecastResultMapper.updateForecastResult(forecastResult);
    }

    /**
     * 批量删除预测结果
     *
     * @param ids 需要删除的预测结果主键
     * @return 结果
     */
    @Override
    public int deleteForecastResultByIds(Long[] ids) {
        return forecastResultMapper.deleteForecastResultByIds(ids);
    }

    /**
     * 删除预测结果信息
     *
     * @param id 预测结果主键
     * @return 结果
     */
    @Override
    public int deleteForecastResultById(Long id) {
        return forecastResultMapper.deleteForecastResultById(id);
    }
}
