菜单
本页目录

getByName(name)

forumPlateFinder.getByName(name)

描述

根据 metadata.name 获取板块。

参数

  1. name:string - 板块的唯一标识 metadata.name

返回值

#PlateVo

示例

<div th:with="plate = ${forumPlateFinder.getByName('forum-plate-foo')}">
  <a th:href="@{${plate.status.permalink}}" th:text="${plate.spec.displayName}"></a>
</div>

list(page,size)

forumPlateFinder.list(page,size)

描述

根据分页参数获取板块列表。

参数

  1. page:int - 分页页码,从 1 开始
  2. size:int - 分页条数

返回值

#ListResult<PlateVo>

示例

<ul th:with="plates = ${forumPlateFinder.list(1,10)}">
  <li th:each="plate : ${plates.items}">
    <a th:href="@{${plate.status.permalink}}" th:text="${plate.spec.displayName}"></a>
  </li>
</ul>

listAll()

forumPlateFinder.listAll()

描述

获取所有板块。

参数

返回值

List<#PlateVo>

示例

<ul th:with="plates = ${forumPlateFinder.listAll()}">
  <li th:each="plate : ${plates}">
    <a th:href="@{${plate.status.permalink}}" th:text="${plate.spec.displayName}"></a>
  </li>
</ul>

类型定义

PlateCategoryVo

{
  "metadata": {
    "name": "string",                                        // 唯一标识
    "labels": {
      "additionalProp1": "string"
    },
    "annotations": {
      "additionalProp1": "string"
    },
    "creationTimestamp": "2024-08-19T16:04:57.998191969Z",    // 创建时间
  },
  "spec": {
    "displayName": "string",                                  // 显示名称
    "slug": "string",                                         // 别名,通常用于生成 status.permalink
    "description": "string",                                  // 描述
    "cover": "string",                                        // 封面图
    "priority": 0,                                            // 排序字段
    "children": [                                             // 下级分类,分类的 metadata.name 集合
      "string"
    ]
  },
  "status": {
    "permalink": "string",                                    // 固定链接
    "plateCount": 0,                                          // 板块数
    "visiblePlateCount": 0                                    // 已发布板块数
  },
  "plateCount": 0
}

ContributorVo

{
  "name": "string",                                   // 用户名
  "displayName": "string",                            // 显示名称
  "avatar": "string",                                 // 头像
  "bio": "string",                                    // 描述
  "permalink": "string",                              // 作者的文章归档页面链接
  "metadata": {
    "name": "string",                                 // 唯一标识
    "labels": {
      "additionalProp1": "string"
    },
    "annotations": {
      "additionalProp1": "string"
    },
    "creationTimestamp": "2022-11-20T13:06:38.512Z",  // 创建时间
  }
}

PlateVo

{
  "metadata": {
    "name": "string",                                         // 唯一标识
    "labels": {
      "additionalProp1": "string"
    },
    "annotations": {
      "additionalProp1": "string"
    },
    "creationTimestamp": "2024-08-19T16:04:57.998191969Z",    // 创建时间
  },
  "spec": {
    "displayName": "string",                                  // 显示名称
    "slug": "string",                                         // 别名,通常用于生成 status.permalink
    "description": "string",                                  // 描述
    "cover": "string",                                        // 封面图
    "owner": "string",
    "deleted": false,
    "publish": true,                                          
    "publishTime": "2024-08-19T16:04:57.998191969Z",          // 发布时间
    "visible": "PUBLIC",
    "priority": 0,
    "categories": [                                           // 分类的名称集合,即 Category 的 metadata.name 的集合
        "string"
    ]
  },
  "status": {
    "permalink": "string",                                    // 固定链接
    "visibleForumPostCount": 0,                               // 已发布帖子数
    "forumPostCount": 0,                                      // 帖子数
    "contributors": [                                         // 版主名称,Contributor 的 metadata.name 的集合
        "string"
    ],
    "lastModifyTime": "2022-11-20T13:06:38.505Z",             // 最后修改时间
  },
  "categories": "List<#PlateCategoryVo>",                     // 分类的集合
  "contributors": "List<#ContributorVo>",                     // 版主的集合
  "owner": "#ContributorVo",                                  // 创建者
  "forumPostCount": 0
}

ListResult<PlateVo>

{
  "page": 0,                                   // 当前页码
  "size": 0,                                   // 每页条数
  "total": 0,                                  // 总条数
  "items": "List<#PlateVo>",                   // 板块列表数据
  "first": true,                               // 是否为第一页
  "last": true,                                // 是否为最后一页
  "hasNext": true,                             // 是否有下一页
  "hasPrevious": true,                         // 是否有上一页
  "totalPages": 0                              // 总页数
}