/**
 * Copyright 2019 DH
 * All right reserved.
 * 项目名称:
 * 创建日期:2023/8/22
 */
package org.springblade.modules.business.data.service.impl;

import org.springblade.core.mp.base.BaseServiceImpl;
import org.springblade.modules.business.data.dto.RtuDataWaterLevelDTO;
import org.springblade.modules.business.data.entity.RtuDataWaterLevelStoreEntity;
import org.springblade.modules.business.data.mapper.RtuDataWaterLevelStoreMapper;
import org.springblade.modules.business.data.service.IRtuDataWaterLevelStoreService;
import org.springblade.modules.etl.entity.EtlRiverDataEntity;
import org.springblade.modules.etl.entity.EtlRsvrDataEntity;
import org.springframework.stereotype.Service;

import java.util.List;

/***
 * Date:2023/8/22
 * Title:文件所属模块（必须填写）
 * Description：对本文件的详细描述，原则上不能少于30字
 * @author dylan
 * @version 1.0
 * Remark：认为有必要的其他信息
 */
@Service
public class RtuDataWaterLevelStoreServiceImpl extends BaseServiceImpl<RtuDataWaterLevelStoreMapper, RtuDataWaterLevelStoreEntity> implements IRtuDataWaterLevelStoreService {
	@Override
	public boolean saveRiverData(EtlRiverDataEntity etlRiverDataEntity) {
		RtuDataWaterLevelStoreEntity entity = new RtuDataWaterLevelStoreEntity();
		entity.setRtuCode(etlRiverDataEntity.getRtuCode());
		entity.setStatus(1);
		entity.setIsDeleted(0);
		entity.setIsRiver(1);
		entity.setIsRes(0);
		entity.setTm(etlRiverDataEntity.getTm());
		entity.setFromTime(etlRiverDataEntity.getFromDate());
		entity.setWaterLevel(etlRiverDataEntity.getZ());
		return this.save(entity);
	}

	@Override
	public boolean saveRsvrData(EtlRsvrDataEntity etlRsvrDataEntity) {
		RtuDataWaterLevelStoreEntity entity = new RtuDataWaterLevelStoreEntity();
		entity.setRtuCode(etlRsvrDataEntity.getRtuCode());
		entity.setStatus(1);
		entity.setIsDeleted(0);
		entity.setIsRiver(0);
		entity.setIsRes(1);
		entity.setTm(etlRsvrDataEntity.getTm());
		entity.setFromTime(etlRsvrDataEntity.getFromDate());
		entity.setWaterLevel(etlRsvrDataEntity.getRz());
		return this.save(entity);
	}

	@Override
	public long rtuUpDataCount(RtuDataWaterLevelDTO dto) {
		return this.baseMapper.rtuUpDataCount(dto);
	}

	@Override
	public List<RtuDataWaterLevelStoreEntity> selectList(RtuDataWaterLevelDTO dto) {
		return this.baseMapper.selectList(dto);
	}

	@Override
	public List<RtuDataWaterLevelStoreEntity> selectLast(RtuDataWaterLevelDTO dto) {
		return this.baseMapper.selectLast(dto);
	}
}
