package com.loan.system.repository;

import com.loan.system.domain.entity.User;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.Pageable;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.Modifying;
import org.springframework.data.jpa.repository.Query;

import java.util.List;
import java.util.Set;

/**
 * @author EdwinXu
 * @date 2020/9/2 - 15:35
 * @Description
 */
public interface UserRepository extends JpaRepository<User,Long> {
    User findByMobile(String mobile);

    List<User> findByIsDelete(Boolean isDelete);

    @Query("select u from User u where u.id in ?1 and u.isDelete = ?2")
    User findByUserIdAndIsDelete(Long userId, Boolean isDelete);

    boolean existsByMobileAndIsDelete(String mobile,Boolean isDelete);

    User findByMobileAndIsDelete(String phoneNumber,Boolean isDelete);

    User findByIdAndIsDelete(Long mobile, Boolean isDelete);
}
