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

import org.springblade.core.mp.base.BaseServiceImpl;
import org.springblade.modules.business.data.dto.RtuDataRiverDTO;
import org.springblade.modules.business.data.entity.RtuDataRiverStoreEntity;
import org.springblade.modules.business.data.mapper.RtuDataRiverStoreMapper;
import org.springblade.modules.business.data.service.IRtuDataRiverStoreService;
import org.springblade.modules.etl.entity.EtlRiverDataEntity;
import org.springframework.stereotype.Service;

import java.util.Date;
import java.util.List;


/***
 * Date:2022/8/28
 * Title:文件所属模块（必须填写）
 * Description：对本文件的详细描述，原则上不能少于30字
 * @author dylan
 * @version 1.0
 * Remark：认为有必要的其他信息
 */
@Service
public class RtuDataRiverStoreServiceImpl extends BaseServiceImpl<RtuDataRiverStoreMapper, RtuDataRiverStoreEntity> implements IRtuDataRiverStoreService {

	@Override
	public boolean saveRiverData(EtlRiverDataEntity etlRiverDataEntity) {
		RtuDataRiverStoreEntity riverEntity = new RtuDataRiverStoreEntity();
		riverEntity.setRtuCode(etlRiverDataEntity.getRtuCode());
		riverEntity.setCreateTime(new Date());
		riverEntity.setStatus(1);
		riverEntity.setIsDeleted(0);
		riverEntity.setUpdateTime(new Date());
		riverEntity.setZ(etlRiverDataEntity.getZ());
		riverEntity.setTm(etlRiverDataEntity.getTm());
		riverEntity.setFromTime(etlRiverDataEntity.getFromDate());
		return this.save(riverEntity);
	}

	@Override
	public long rtuUpDataCount(RtuDataRiverDTO riverDTO) {
		return this.baseMapper.rtuUpDataCount(riverDTO);
	}

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

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