這裏是我的問題..JOOQ排序依據與Case語句
SelectQuery<Record> selectQuery = transRefundFee.selectQuery();
selectQuery.addSelect(AccountBill.ACCOUNT_BILL.BILL_NUMBER,AccountBill.ACCOUNT_BILL.BILL_AMOUNT,AccountBill.ACCOUNT_BILL.TOTAL_PAID);
selectQuery.addFrom(AccountBill.ACCOUNT_BILL);
selectQuery.addConditions(AccountBill.ACCOUNT_BILL.FOLDER_RSN.eq(argFolderRSN));
我必須用Case語句添加排序依據我們如何能做到這一點我檢查Here,但它不是我的情況下工作,我添加任何其他方式這樣
selectQuery.addOrderBy(DSL.decode().when(AccountBill.ACCOUNT_BILL.BILL_AMOUNT.le(new BigDecimal(0)),AccountBill.ACCOUNT_BILL.BILL_AMOUNT).then(AccountBill.ACCOUNT_BILL.BILL_AMOUNT) .otherwise(AccountBill.ACCOUNT_BILL.BILL_NUMBER));
但它說The method then(TableField<AccountBillRecord,BigDecimal>) is undefined for the type CaseConditionStep<BigDecimal>
同樣的,下面的代碼
selectQueryFee.addOrderBy(DSL.decode().when(AccountBill.ACCOUNT_BILL.BILL_AMOUNT.le(new BigDecimal(0))
.then(AccountBill.ACCOUNT_BILL.BILL_AMOUNT)
.otherwise(AccountBill.ACCOUNT_BILL.BILL_NUMBER)));
然後,該方法(TableField)是未定義 爲類型條件
你吃過看看['SelectQuery'(HTTP://www.jooq .org/javadoc/latest/org/jooq/SelectQuery.html)Javadoc?你有什麼嘗試?你在哪裏/爲什麼失敗? –
@LuKas編輯的問題 –
哎呦。我注意到我在[其他問題,你已經鏈接]給出了一個錯誤的答案(http://stackoverflow.com/a/19656354/521799) –