diff --git a/project/jimmer-sql-kotlin/src/main/kotlin/org/babyfish/jimmer/sql/kt/ast/query/KConfigurableRootQuery.kt b/project/jimmer-sql-kotlin/src/main/kotlin/org/babyfish/jimmer/sql/kt/ast/query/KConfigurableRootQuery.kt index abf24b736..0150bdacc 100644 --- a/project/jimmer-sql-kotlin/src/main/kotlin/org/babyfish/jimmer/sql/kt/ast/query/KConfigurableRootQuery.kt +++ b/project/jimmer-sql-kotlin/src/main/kotlin/org/babyfish/jimmer/sql/kt/ast/query/KConfigurableRootQuery.kt @@ -6,6 +6,7 @@ import org.babyfish.jimmer.lang.NewChain import org.babyfish.jimmer.sql.ast.query.PageFactory import org.babyfish.jimmer.sql.kt.ast.expression.rowCount import java.sql.Connection +import org.babyfish.jimmer.sql.kt.ast.expression.constant interface KConfigurableRootQuery : KTypedRootQuery { @@ -26,6 +27,11 @@ interface KConfigurableRootQuery : KTypedRootQuery { .withoutSortingAndPaging() .execute(con)[0] + fun exists(con: Connection? = null): Boolean = + limit(1) + .reselect { select(constant(1)) } + .execute(con).isNotEmpty() + fun fetchPage( pageIndex: Int, pageSize: Int,