package cn.com.capcloud.core.system.user;

import java.util.List;

import org.springframework.data.domain.Page;
import org.springframework.data.domain.Pageable;
import org.springframework.data.jpa.repository.Query;
import org.springframework.data.repository.PagingAndSortingRepository;
import org.springframework.data.repository.query.Param;


public interface UserPageSortRepository extends PagingAndSortingRepository<User,Long> {
	@Query(value="select u from User u where  u.userName like:userName and u.id in (:userList)")
	public Page<User> findByConvenienceName(@Param("userName") String userName,@Param("userList") List<Long> userList, Pageable pageable);
	@Query(value="select u from User u where  u.userName like:userName and u.id in (:userList) and orgId=:orgId")
	public Page<User> findByConvenienceName(@Param("userName") String userName,@Param("userList") List<Long> userList,@Param("orgId") long orgId, Pageable pageable);
	@Query(value="select u from User u where  u.userName like:userName or u.userMobile like:userName")
	public Page<User> findByConvenienceName(@Param("userName") String userName, Pageable pageable);
	@Query(value="select u from User u where  u.userName like:userName and orgId=:orgId")  
	public Page<User> findByConvenienceName(@Param("userName") String userName,@Param("orgId") long orgId, Pageable pageable);
}
