package com.its.api.its.repository.oper;

import com.its.api.its.model.entity.oper.TbUserCnncHs;
import com.its.api.its.model.entity.oper.TbUserCnncHsKey;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
import org.springframework.data.jpa.repository.Query;
import org.springframework.data.repository.query.Param;
import org.springframework.stereotype.Repository;

import java.util.List;

@Repository
public interface TbUserCnncHsRepository extends JpaRepository<TbUserCnncHs, TbUserCnncHsKey>, JpaSpecificationExecutor<TbUserCnncHs> {

/*
    @Query("select new com.its.api.op.model.dto.oper.TbUserCnncHsDto(p.loginHms, p.userId, p.logoutHms) from TbUserCnncHs p where p.loginHms between :fromDt and :toDt")
    List<TbUserCnncHsDto> findAllByDateRange(@Param("fromDt") String fromDt, @Param("toDt") String toDt);
*/
    @Query("select p from TbUserCnncHs p where p.loginHms between :fromDt and :toDt")
    List<TbUserCnncHs> findAllByDateRange(@Param("fromDt") String fromDt, @Param("toDt") String toDt);

    @Query("select p from TbUserCnncHs p where p.loginHms between :fromDt and :toDt")
    List<TbUserCnncHs> findAllByDateRangeEntity(@Param("fromDt") String fromDt, @Param("toDt") String toDt);

}
