io.rocketbase.commons.repository.AppUserJpaRepository Maven / Gradle / Ivy
package io.rocketbase.commons.repository;
import io.rocketbase.commons.model.AppUserJpaEntity;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.Pageable;
import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
import org.springframework.data.jpa.repository.Query;
import org.springframework.data.repository.PagingAndSortingRepository;
import org.springframework.data.repository.query.Param;
import org.springframework.data.repository.query.QueryByExampleExecutor;
import java.util.Optional;
public interface AppUserJpaRepository extends PagingAndSortingRepository, QueryByExampleExecutor, JpaSpecificationExecutor {
@Query("select a from AppUserJpaEntity a left join fetch a.keyValueMap left join fetch a.roles where a.id = :id")
Optional findById(@Param("id") String id);
@Query("select a from AppUserJpaEntity a left join fetch a.keyValueMap left join fetch a.roles where a.username = :username")
Optional findByUsername(@Param("username") String username);
@Query("select a from AppUserJpaEntity a left join fetch a.keyValueMap left join fetch a.roles where a.email = :email")
Optional findByEmail(@Param("email") String email);
@Query(value = "select a from AppUserJpaEntity a left join fetch a.keyValueMap left join fetch a.roles",
countQuery = "select count(a) from AppUserJpaEntity a")
Page findAll(Pageable pageable);
}