oracle - Kotlin 暴露框架
问题描述
我是 kotlin 暴露框架的新手。我想要达到的目的是按 CLOB 列的长度对一些结果进行排序。
表达式如下所示:
ProductReviewTable.join(
otherTable = ReviewTable,
joinType = JoinType.INNER,
additionalConstraint = {
ProductReviewTable.review eq ReviewTable.id
}
).join(
otherTable = UserProductRatingTable,
joinType = JoinType.LEFT,
additionalConstraint = {
(UserProductRatingTable.productId eq ProductReviewTable.productId) and
(UserProductRatingTable.userId eq ReviewTable.userId)
}
)
.select {
(ProductReviewTable.productId eq productId) and ACCEPTED_REVIEWS_EXPRESSION
}
.limit(count, offset = offset)
.orderBy(
Pair(ReviewTable.priority, SortOrder.DESC),
Pair(ReviewTable.valuable, SortOrder.DESC),
Pair(ReviewTable.useful, SortOrder.DESC),
Pair(ReviewTable.content, SortOrder.DESC), // here i want to order by content length
Pair(ReviewTable.createdDate, SortOrder.DESC)
)
.mapNotNull { it.toReviewDto() }
}
是否有任何功能可以让我将 CLOB 'content' 列转换为长度,然后按它排序?我使用 oracle 作为数据库,您不能在 order by 子句中使用 CLOB 列类型。
在 oracle 中可以这样做:
SELECT length(CONTENT) FROM REVIEW r
ORDER BY 1 DESC NULLS LAST
但我不知道如何在 kotlin 暴露的框架中表达
解决方案
推荐阅读
- .net - 不再获取 Microsoft Docs VB.NET 示例。它们都在 C# 中
- python - 将选项卡 txt 转换为 CSV 批处理
- angular - 角度单选按钮的动态列表
- arrays - 如何在 ruby 中定义哈希对象数组?
- python - 如何使用 python (v3.7) 从 gmail gmail-api 读取消息(HTML 格式)?
- python - 将 JSON API 结果导出到 CSV 文件(垂直与标题)
- excel - 在 Power Query 的每一行中检查特定字符的出现
- java - 为什么我们使用接口并将实现接口扩展到类?
- android - 为 buildSrc 中的源文件添加对 buildSrc 的依赖项
- python - 如何在 groupby() 之后查找非唯一行数