importorg.springframework.data.domain.Page;importorg.springframework.data.domain.Pageable;importorg.springframework.data.jpa.repository.JpaRepository;importorg.springframework.data.jpa.repository.JpaSpecificationExecutor;importorg.springframework.data.jpa.repository.Query;importorg.springframework.data.repository.query.Param;importorg.springframework.stereotype.Repository;importjava.util.List;@RepositorypublicinterfaceUserRepositoryextendsJpaRepository<UserInfoDo,String>,JpaSpecificationExecutor<UserInfoDo>{/*1.自定义实体必须写清楚包
*2.查询返回顺序必须与实体属性定义顺序一致
*3.自定义实体属性类型必须与Entity一致
*/@Query("select new com.ABBean(a.userName ,a.useStatus , b.id, b.userType,b.createTime ,b.ip "+"from UserInfoDo a "+"LEFT JOIN UserAuthDo b on a.userName = b.userName "+"where (:userName is null or a.userName like :userName) "+"and (:userInfoUseStatus is null or a.useStatus = :userInfoUseStatus) "+"and (:createTime is null or b.createTime= :createTime) ")Page<ABBean>QueryUserAuth(@Param("userName ")String userName,@Param("userInfoUseStatus")Long userInfoUseStatus,@Param("createTime")Date createTime,Pageable page);}