package com.ruoyi.ems.service.impl;

import com.ruoyi.ems.domain.ElecGwPriceConfig;
import com.ruoyi.ems.domain.ElecPvPriceConfig;
import com.ruoyi.ems.mapper.ElecGwPriceConfigMapper;
import com.ruoyi.ems.mapper.ElecPvPriceConfigMapper;
import com.ruoyi.ems.service.IElecPriceConfigService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * 电价配置Service业务层处理
 *
 * @author ruoyi
 * @date 2024-07-23
 */
@Service
public class ElecPriceConfigServiceImpl implements IElecPriceConfigService {
    @Autowired
    private ElecGwPriceConfigMapper gwPriceConfigMapper;

    @Autowired
    private ElecPvPriceConfigMapper pvPriceConfigMapper;

    /**
     * 查询电价配置
     *
     * @param id 电价配置主键
     * @return 电价配置
     */
    @Override
    public ElecGwPriceConfig selectGwElecPriceCfgById(Long id) {
        return gwPriceConfigMapper.selectElecPriceConfigById(id);
    }

    @Override
    public ElecGwPriceConfig selectGwElecPriceCfgByCode(String code) {
        return gwPriceConfigMapper.selectElecPriceConfigByCode(code);
    }

    /**
     * 查询电价配置列表
     *
     * @param elecPriceConfig 电价配置
     * @return 电价配置
     */
    @Override
    public List<ElecGwPriceConfig> selectGwElecPriceCfgList(ElecGwPriceConfig elecPriceConfig) {
        return gwPriceConfigMapper.selectElecPriceConfigList(elecPriceConfig);
    }

    /**
     * 新增电价配置
     *
     * @param elecPriceConfig 电价配置
     * @return 结果
     */
    @Override
    public int insertGwElecPriceCfg(ElecGwPriceConfig elecPriceConfig) {
        return gwPriceConfigMapper.insertElecPriceConfig(elecPriceConfig);
    }

    /**
     * 修改电价配置
     *
     * @param elecPriceConfig 电价配置
     * @return 结果
     */
    @Override
    public int updateGwElecPriceCfg(ElecGwPriceConfig elecPriceConfig) {
        return gwPriceConfigMapper.updateElecPriceConfig(elecPriceConfig);
    }

    /**
     * 批量删除电价配置
     *
     * @param ids 需要删除的电价配置主键
     * @return 结果
     */
    @Override
    public int deleteGwElecPriceCfgByIds(Long[] ids) {
        return gwPriceConfigMapper.deleteElecPriceConfigByIds(ids);
    }

    /**
     * 删除电价配置信息
     *
     * @param id 电价配置主键
     * @return 结果
     */
    @Override
    public int deleteGwElecPriceCfgById(Long id) {
        return gwPriceConfigMapper.deleteElecPriceConfigById(id);
    }

    /**
     * 查询光伏电价配置
     *
     * @param id 光伏电价配置主键
     * @return 光伏电价配置
     */
    @Override
    public ElecPvPriceConfig selectPvPriceCfgById(Long id) {
        return pvPriceConfigMapper.selectPvPriceConfigById(id);
    }

    /**
     * 查询光伏电价配置列表
     *
     * @param elecPvPriceConfig 光伏电价配置
     * @return 光伏电价配置
     */
    @Override
    public List<ElecPvPriceConfig> selectPvPriceCfgList(ElecPvPriceConfig elecPvPriceConfig) {
        return pvPriceConfigMapper.selectPvPriceConfigList(elecPvPriceConfig);
    }

    /**
     * 新增光伏电价配置
     *
     * @param elecPvPriceConfig 光伏电价配置
     * @return 结果
     */
    @Override
    public int insertPvPriceCfg(ElecPvPriceConfig elecPvPriceConfig) {
        return pvPriceConfigMapper.insertPvPriceConfig(elecPvPriceConfig);
    }

    /**
     * 修改光伏电价配置
     *
     * @param elecPvPriceConfig 光伏电价配置
     * @return 结果
     */
    @Override
    public int updatePvPriceCfg(ElecPvPriceConfig elecPvPriceConfig) {
        return pvPriceConfigMapper.updatePvPriceConfig(elecPvPriceConfig);
    }

    /**
     * 批量删除光伏电价配置
     *
     * @param ids 需要删除的光伏电价配置主键
     * @return 结果
     */
    @Override
    public int deletePvPriceCfgByIds(Long[] ids) {
        return pvPriceConfigMapper.deletePvPriceConfigByIds(ids);
    }

    /**
     * 删除光伏电价配置信息
     *
     * @param id 光伏电价配置主键
     * @return 结果
     */
    @Override
    public int deletePvPriceCfgById(Long id) {
        return pvPriceConfigMapper.deletePvPriceConfigById(id);
    }
}
