package com.gyee.wisdom.dao.sql.control.repository;

import com.gyee.wisdom.dao.sql.control.entity.GycpCmdInfoEntity;
import com.gyee.wisdom.dao.sql.control.entity.InputOrOutputSpeedTotalEntity;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
import org.springframework.data.jpa.repository.Query;
import org.springframework.stereotype.Repository;

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

/**
 * @author:Wanghs
 * @date:2019-09-10
 */
@Repository
public interface InputOrOutputSpeedTotalRepository  extends JpaRepository<InputOrOutputSpeedTotalEntity, String>, JpaSpecificationExecutor {
  @Query(value ="select t1 from InputOrOutputSpeedTotalEntity t1 where t1.recordDate =  (select max(t2.recordDate) from InputOrOutputSpeedTotalEntity t2)")
    List<InputOrOutputSpeedTotalEntity> latest();

  @Query(value ="select max (t1.recordDate) from InputOrOutputSpeedTotalEntity t1 ")
  Date getMaxDate ();

}
