有没有办法定义在输出sql查询中什么都不产生的空条件?现在,对于默认条件,我使用private static Condition limitCondition(Integer offset, Integer count) {
Condition limitCondition = trueCondition();
if (count != null && offset != null) {
limitCondition = rowNum.between(offset, count + offset);
} else if (count == null && offset != null) {
limitCondition = rowNum.greaterOrEqual(offset);
} else if (count != null && offset == null) {
limitCondition = rowNum.lessOrEqual(count);
}
return limitCondition;
}
<android.support.design.widget.CoordinatorLayout
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:id="@+id/main_content"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:fitsSystemWindows="true">
<android.support.design.widget.AppBarLayout
android:layout_height="wrap_content"
android:layout_width="match_parent"
android:theme="@style/AppTheme.AppBarOverlay">
<android.support.v7.widget.Toolbar
android:id="@+id/toolbar"
android:layout_width="match_parent"
android:layout_height="?attr/actionBarSize"
android:background="?attr/colorPrimary"
app:popupTheme="@style/AppTheme.PopupOverlay" />
</android.support.design.widget.AppBarLayout>
<include layout="@layout/content_main" />
</android.support.design.widget.CoordinatorLayout>
答案 0 :(得分:6)
从jOOQ 3.11开始会有DSL.noCondition()
。有关详细信息,请参阅此处的相关功能请求:
答案 1 :(得分:2)