import com.zr.po.Blog;import org.springframework.data.domain.Pageable;import org.springframework.data.jpa.repository.JpaRepository;import org.springframework.data.jpa.repository.JpaSpecificationExecutor;import org.springframework.data.jpa.repository.Query;import java.util.List;publicinterfaceBlogDaoextendsJpaRepository<Blog,Long>, JpaSpecificationExecutor<Blog>{
@Query("select b from Blog b where b.recommend=true")
List<Blog>findTop(Pageable pageable);}
TagDao
import com.zr.po.Tag;import org.springframework.data.domain.Pageable;import org.springframework.data.jpa.repository.JpaRepository;import org.springframework.data.jpa.repository.Query;import java.util.List;publicinterfaceTagDaoextendsJpaRepository<Tag,Long>{
@Query("select t from Tag t")
List<Tag>findTop(Pageable pageable);}
TypeDao
import com.zr.po.Type;import com.zr.po.User;import org.springframework.data.domain.Pageable;import org.springframework.data.jpa.repository.JpaRepository;import org.springframework.data.jpa.repository.Query;import java.util.List;publicinterfaceTypeDaoextendsJpaRepository<Type,Long>{
@Query("select t from Type t")
List<Type>findTop(Pageable pageable);}
UserDao
import com.zr.po.User;import org.springframework.data.jpa.repository.JpaRepository;publicinterfaceUserDaoextendsJpaRepository<User,Long>{
User findByUsernameAndPassword(String username, String password);}