package com.ruoyi.ems.service.impl;

import com.ruoyi.ems.domain.ElecPvSupplyH;
import com.ruoyi.ems.mapper.ElecPvSupplyHMapper;
import com.ruoyi.ems.model.QueryMeter;
import com.ruoyi.ems.service.IElecPvSupplyHService;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * 光伏并网计量光伏并网计量-小时Service业务层处理
 *
 * @author ruoyi
 * @date 2024-08-02
 */
@Service
public class ElecPvSupplyHServiceImpl implements IElecPvSupplyHService {
    @Autowired
    private ElecPvSupplyHMapper pvSupplyHMapper;

    /**
     * 查询光伏并网计量光伏并网计量-小时
     *
     * @param id 光伏并网计量光伏并网计量-小时主键
     * @return 光伏并网计量光伏并网计量-小时
     */
    @Override
    public ElecPvSupplyH selectPvSupplyHById(Long id) {
        return pvSupplyHMapper.selectPvSupplyHById(id);
    }

    /**
     * 查询光伏并网计量光伏并网计量-小时列表
     *
     * @param pvSupplyH 光伏并网计量光伏并网计量-小时
     * @return 光伏并网计量光伏并网计量-小时
     */
    @Override
    public List<ElecPvSupplyH> selectPvSupplyHList(ElecPvSupplyH pvSupplyH) {
        if (StringUtils.equals("-1", pvSupplyH.getAreaCode())) {
            return pvSupplyHMapper.selectPvSupplyHAll(pvSupplyH);
        }
        else {
            return pvSupplyHMapper.selectPvSupplyHList(pvSupplyH);
        }
    }

    @Override
    public List<ElecPvSupplyH> selectPvSupplyDayList(QueryMeter param) {
        return pvSupplyHMapper.selectPvSupplyDayList(param);
    }

    /**
     * 新增光伏并网计量光伏并网计量-小时
     *
     * @param pvSupplyH 光伏并网计量光伏并网计量-小时
     * @return 结果
     */
    @Override
    public int insertPvSupplyH(ElecPvSupplyH pvSupplyH) {
        return pvSupplyHMapper.insertPvSupplyH(pvSupplyH);
    }

    /**
     * 修改光伏并网计量光伏并网计量-小时
     *
     * @param pvSupplyH 光伏并网计量光伏并网计量-小时
     * @return 结果
     */
    @Override
    public int updatePvSupplyH(ElecPvSupplyH pvSupplyH) {
        return pvSupplyHMapper.updatePvSupplyH(pvSupplyH);
    }

    /**
     * 批量删除光伏并网计量光伏并网计量-小时
     *
     * @param ids 需要删除的光伏并网计量光伏并网计量-小时主键
     * @return 结果
     */
    @Override
    public int deletePvSupplyHByIds(Long[] ids) {
        return pvSupplyHMapper.deletePvSupplyHByIds(ids);
    }

    /**
     * 删除光伏并网计量光伏并网计量-小时信息
     *
     * @param id 光伏并网计量光伏并网计量-小时主键
     * @return 结果
     */
    @Override
    public int deletePvSupplyHById(Long id) {
        return pvSupplyHMapper.deletePvSupplyHById(id);
    }
}
