package com.ruoyi.ems.service.impl;

import com.ruoyi.ems.domain.ElecMeterH;
import com.ruoyi.ems.domain.EnergyMeter;
import com.ruoyi.ems.mapper.ElecMeterHMapper;
import com.ruoyi.ems.model.QueryMeter;
import com.ruoyi.ems.service.IElecMeterHService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * 用电计量-小时Service业务层处理
 *
 * @author ruoyi
 * @date 2024-12-03
 */
@Service
public class ElecMeterHServiceImpl implements IElecMeterHService {
    @Autowired
    private ElecMeterHMapper elecMeterHMapper;

    @Override
    public List<ElecMeterH> staMeterDayList(QueryMeter queryMeter) {
        return elecMeterHMapper.selectElecMeterDayList(queryMeter);
    }

    @Override
    public EnergyMeter selectElecDayAvg(QueryMeter queryMeter) {
        return elecMeterHMapper.selectElecDayAvg(queryMeter);
    }

    @Override
    public ElecMeterH selectLatelyItem(String deviceCode) {
        return elecMeterHMapper.selectLatelyItem(deviceCode);
    }

    /**
     * 新增用电计量-小时
     *
     * @param elecMeterH 用电计量-小时
     * @return 结果
     */
    @Override
    public int insertElecMeterH(ElecMeterH elecMeterH) {
        return elecMeterHMapper.insertElecMeterH(elecMeterH);
    }

    @Override
    public int insertBatch(List<ElecMeterH> list) {
        return elecMeterHMapper.insertBatch(list);
    }

    /**
     * 修改用电计量-小时
     *
     * @param elecMeterH 用电计量-小时
     * @return 结果
     */
    @Override
    public int updateElecMeterH(ElecMeterH elecMeterH) {
        return elecMeterHMapper.updateElecMeterH(elecMeterH);
    }

    /**
     * 删除用电计量-小时信息
     *
     * @param date 日期
     * @return 结果
     */
    @Override
    public int deleteElecMeterHByDate(String date) {
        return elecMeterHMapper.deleteElecMeterHByDate(date);
    }

    @Override
    public EnergyMeter qryElecMeterByDate(String date, String areaCode) {
        return elecMeterHMapper.qryElecMeterByDate(new ElecMeterH() {{
            setStartRecTime(date);
            setAreaCode(areaCode);
        }});
    }

    @Override
    public List<ElecMeterH> qryTimeIndexElecMeterByDay(String dateRange, Integer timeIndex) {
        return elecMeterHMapper.qryTimeIndexElecMeterByDay(dateRange);
    }

    @Override
    public List<ElecMeterH> qryDateElecMeterByDate(String dateRange) {
        return elecMeterHMapper.qryDateElecMeterByDate(dateRange);
    }

    @Override
    public List<ElecMeterH> qryDateElecMeterByYear(String dataRange) {
        return elecMeterHMapper.qryDateElecMeterByYear(dataRange);
    }

    @Override
    public List<ElecMeterH> qryDeviceTypeElecMeterByDay(ElecMeterH elecMeterH) {
        return elecMeterHMapper.qryDeviceTypeElecMeterByDay(elecMeterH);
    }

}
