/*
 * Author: wangjian
 * 生成ServiceImpl
 */
package com.tofly.xrtygis.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;

import com.tofly.xrtygis.entity.DmaRemoteMeter;
import com.tofly.xrtygis.mapper.DmaRemoteMeterMapper;
import com.tofly.xrtygis.service.DmaRemoteMeterService;
import org.springframework.stereotype.Service;

import java.math.BigDecimal;
import java.util.HashMap;
import java.util.List;
import java.util.Map;


/**
 * DMA分区数据填报远传记录表
 *
 * @author admin
 * @date Tue May 17 00:00:00 CST 2022
 */
@Service("dmaRemoteMeterService")
public class DmaRemoteMeterServiceImpl extends ServiceImpl<DmaRemoteMeterMapper, DmaRemoteMeter> implements DmaRemoteMeterService {

    @Override
    public Map<String, Object> getHisTableReading(Long tableId) {
        Map<String,Object> readingMap = new HashMap<>(12);
        List<DmaRemoteMeter> list = this.list(new QueryWrapper<DmaRemoteMeter>().lambda().eq(DmaRemoteMeter::getTableId, tableId));
        if(null!=list && list.size()>0){
            DmaRemoteMeter dmaRemoteMeter = list.get(0);
            readingMap.put("startVal",dmaRemoteMeter.getStartVal());
            readingMap.put("startDate",dmaRemoteMeter.getStartDate());
        }
        return readingMap;
    }
}
