package com.ruoyi.ems.service.impl;

import java.util.List;

import com.ruoyi.ems.domain.ElecValencyHourStrategy;
import com.ruoyi.ems.mapper.ElecValencyHourStrategyMapper;
import com.ruoyi.ems.service.IElecValencyHourStrategyService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

/**
 * 电价策略小时Service业务层处理
 *
 * @author ruoyi
 * @date 2024-07-23
 */
@Service
public class ElecValencyHourStrategyServiceImpl implements IElecValencyHourStrategyService {
    @Autowired
    private ElecValencyHourStrategyMapper hourStrategyMapper;

    /**
     * 查询电价策略小时
     *
     * @param id 电价策略小时主键
     * @return 电价策略小时
     */
    @Override
    public ElecValencyHourStrategy selectHourStrategyById(Long id) {
        return hourStrategyMapper.selectElecValencyStrategyHourById(id);
    }

    /**
     * 查询电价策略小时列表
     *
     * @param hourStrategy 电价策略小时
     * @return 电价策略小时
     */
    @Override
    public List<ElecValencyHourStrategy> selectHourStrategyList(
        ElecValencyHourStrategy hourStrategy) {
        return hourStrategyMapper.selectElecValencyStrategyHourList(hourStrategy);
    }

    /**
     * 新增电价策略小时
     *
     * @param hourStrategy 电价策略小时
     * @return 结果
     */
    @Override
    public int insertHourStrategy(ElecValencyHourStrategy hourStrategy) {
        return hourStrategyMapper.insertElecValencyStrategyHour(hourStrategy);
    }

    /**
     * 批量插入小时电价策略列表
     *
     * @param hourStrategys 小时电价策略列表
     * @return 插入成功的小时电价策略数量
     */
    @Override
    public int insertHourStrategyList(List<ElecValencyHourStrategy> hourStrategys) {
        return hourStrategyMapper.insertElecValencyStrategyHourBatch(hourStrategys);
    }

    /**
     * 修改电价策略小时
     *
     * @param hourStrategys 电价策略小时
     * @return 结果
     */
    @Override
    public int updateHourStrategy(ElecValencyHourStrategy hourStrategys) {
        return hourStrategyMapper.updateElecValencyStrategyHour(hourStrategys);
    }

    /**
     * 批量删除电价策略小时
     *
     * @param ids 需要删除的电价策略小时主键
     * @return 结果
     */
    @Override
    public int deleteHourStrategyByIds(Long[] ids) {
        return hourStrategyMapper.deleteElecValencyStrategyHourByIds(ids);
    }

    /**
     * 删除电价策略小时信息
     *
     * @param id 电价策略小时主键
     * @return 结果
     */
    @Override
    public int deleteHourStrategyById(Long id) {
        return hourStrategyMapper.deleteElecValencyStrategyHourById(id);
    }

    /**
     * 根据策略代码删除小时策略
     *
     * @param strategyCode 策略代码
     * @return 删除的小时策略数量
     */
    @Override
    public int deleteHourStrategyByStrategy(String strategyCode) {
        return hourStrategyMapper.deleteElecValencyStrategyHourByStrategy(strategyCode);
    }
}
