Skip to content

Commit

Permalink
fix: 修复作业集返回格式 page 定义错误的问题
Browse files Browse the repository at this point in the history
  • Loading branch information
dragove committed Mar 19, 2024
1 parent c6ed391 commit 4500180
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ data class CopilotSetPageRes (
@Schema(title = "是否有下一页")
val hasNext: Boolean = false,

@Schema(title = "当前页码")
@Schema(title = "总页数")
val page: Int = 0,

@Schema(title = "总数据量")
Expand Down
10 changes: 6 additions & 4 deletions src/main/kotlin/plus/maa/backend/service/CopilotSetService.kt
Original file line number Diff line number Diff line change
Expand Up @@ -123,8 +123,10 @@ class CopilotSetService(
if (!req.keyword.isNullOrBlank()) {
val pattern = Pattern.compile(req.keyword, Pattern.CASE_INSENSITIVE)
query.addCriteria(
Criteria().orOperator(Criteria.where("name").regex(pattern),
Criteria.where("description").regex(pattern))
Criteria().orOperator(
Criteria.where("name").regex(pattern),
Criteria.where("description").regex(pattern)
)
)
}
val copilotSets =
Expand All @@ -140,8 +142,8 @@ class CopilotSetService(
.toList()
val userById = userRepository.findByUsersId(userIds)
return CopilotSetPageRes(
copilotSets.totalPages > req.page,
copilotSets.number + 1,
copilotSets.hasNext(),
copilotSets.totalPages,
copilotSets.totalElements,
copilotSets.map { cs: CopilotSet ->
val user = userById.getOrDefault(cs.creatorId, MaaUser.UNKNOWN)
Expand Down

0 comments on commit 4500180

Please sign in to comment.