package com.pwt.web.service.impl;

import java.util.List;

import com.pwt.web.domain.ChangePowerModel;
import com.pwt.web.domain.ExchangeStatistics;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.pwt.web.mapper.PwtChangeBatteryRecordMapper;
import com.pwt.web.domain.PwtChangeBatteryRecord;
import com.pwt.web.service.IPwtChangeBatteryRecordService;
import org.springframework.transaction.annotation.Transactional;

/**
 * 换电记录Service业务层处理
 *
 * @author linyun
 * @date 2022-11-17
 */
@Service
@Transactional(rollbackFor = Exception.class)
public class PwtChangeBatteryRecordServiceImpl implements IPwtChangeBatteryRecordService {
    @Autowired
    private PwtChangeBatteryRecordMapper pwtChangeBatteryRecordMapper;

    /**
     * 查询换电记录
     *
     * @param recordId 换电记录ID
     * @return 换电记录
     */
    @Override
    public PwtChangeBatteryRecord selectPwtChangeBatteryRecordById(Long recordId) {
        return pwtChangeBatteryRecordMapper.selectPwtChangeBatteryRecordById(recordId);
    }

    /**
     * 查询换电记录列表
     *
     * @param pwtChangeBatteryRecord 换电记录
     * @return 换电记录
     */
    @Override
    public List<PwtChangeBatteryRecord> selectPwtChangeBatteryRecordList(PwtChangeBatteryRecord pwtChangeBatteryRecord) {
        return pwtChangeBatteryRecordMapper.selectPwtChangeBatteryRecordList(pwtChangeBatteryRecord);
    }

    /**
     * 新增换电记录
     *
     * @param pwtChangeBatteryRecord 换电记录
     * @return 结果
     */
    @Override
    public int insertPwtChangeBatteryRecord(PwtChangeBatteryRecord pwtChangeBatteryRecord) {
        return pwtChangeBatteryRecordMapper.insertPwtChangeBatteryRecord(pwtChangeBatteryRecord);
    }

    /**
     * 修改换电记录
     *
     * @param pwtChangeBatteryRecord 换电记录
     * @return 结果
     */
    @Override
    public int updatePwtChangeBatteryRecord(PwtChangeBatteryRecord pwtChangeBatteryRecord) {
        return pwtChangeBatteryRecordMapper.updatePwtChangeBatteryRecord(pwtChangeBatteryRecord);
    }

    /**
     * 批量删除换电记录
     *
     * @param recordIds 需要删除的换电记录ID
     * @return 结果
     */
    @Override
    public int deletePwtChangeBatteryRecordByIds(Long[] recordIds) {
        return pwtChangeBatteryRecordMapper.deletePwtChangeBatteryRecordByIds(recordIds);
    }

    /**
     * 删除换电记录信息
     *
     * @param recordId 换电记录ID
     * @return 结果
     */
    @Override
    public int deletePwtChangeBatteryRecordById(Long recordId) {
        return pwtChangeBatteryRecordMapper.deletePwtChangeBatteryRecordById(recordId);
    }

    /**
     * @Description: 查询日换电量/换电次数
     * @Author: linyun
     * @Date: 2022/11/23 15:31
     * @Return:java.util.List<com.pwt.web.domain.ChangePowerModel>
     **/
    @Override
    public List<ChangePowerModel> getDayDataInfo() {
        return pwtChangeBatteryRecordMapper.getDayDataInfo();
    }

    /**
     * @Description: 查询月换电量/换电次数
     * @Author: linyun
     * @Date: 2022/11/23 15:31
     * @Return:java.util.List<com.pwt.web.domain.ChangePowerModel>
     **/
    @Override
    public List<ChangePowerModel> getMonthDataInfo() {
        return pwtChangeBatteryRecordMapper.getMonthDataInfo();
    }

    /**
     * @Description: 查询年换电量/换电次数
     * @Author: linyun
     * @Date: 2022/11/23 15:31
     * @Return:java.util.List<com.pwt.web.domain.ChangePowerModel>
     **/
    @Override
    public List<ChangePowerModel> getYearDataInfo() {
        return pwtChangeBatteryRecordMapper.getYearDataInfo();
    }

    @Override
    public ExchangeStatistics getExchangeStatistics() {
        return pwtChangeBatteryRecordMapper.getExchangeStatistics();
    }

    @Override
    public int getChangeCount(String batterySn) {
        return pwtChangeBatteryRecordMapper.getChangeCount(batterySn);
    }

    @Override
    public PwtChangeBatteryRecord getLastestRecord() {
        return pwtChangeBatteryRecordMapper.getLastestRecord();
    }


}
