zoukankan      html  css  js  c++  java
  • 较为复杂的 GraphQL 查询实现

    一、实现功能首页各类排行榜加载数据:

    向下遍历子节点并展开;
    1.展开过程中动态加载简介summary、书类bookType;
    2.book对象上包裹Rank节点,描述book对象在不同排行榜下所处位置(sort);
    3.可控制排行榜下的book数目

    query getRankList($rankTypeId: ID = 1, $totalCount: Int, $withBookTypeName: Boolean = false, $withSummary: Boolean = false) {
      rankType(rankTypeId: $rankTypeId) {
        typeId
        typeName
        rankList(totalCount: $totalCount) {
          rankTypeId
          book {
            bookId
            bookName
            cover
            banner
            summary @include(if: $withSummary)
            bookType @include(if: $withBookTypeName) {
              typeName
            }
            author
          }
          sort
        }
      }
    }
    
    
    

    二、实现首页书类展示:

    1.父类及子类展展开;
    2.本站对应子类下的书籍作品数目展示;
    3.限制子类数目

    query getBookTypeList($rootId: Int=0, $totalCount: Int=12){
      bookTypeList(parentTypeId: $rootId){
        typeId
        typeName
        children(totalCount: $totalCount){
          typeId
          typeName
          parentTypeId
          bookCount
        }
      }
    }
    
  • 相关阅读:
    系统设计5:Google三剑客
    lintcode亚麻九题
    设计模式17:单例模式
    设计模式16:迭代器模式
    设计模式15:组合模式
    476. Number Complement
    561. Array Partition I
    627. Swap Salary
    617. Merge Two Binary Trees
    728. Self Dividing Numbers
  • 原文地址:https://www.cnblogs.com/jiajin/p/8465746.html
Copyright © 2011-2022 走看看