1

Here is my issue..

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));

I have to add the orderby with Case Statement how can we do this i checked Here but its not working in my case any other way I Added like this

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));

But its saying The method then(TableField<AccountBillRecord,BigDecimal>) is undefined for the type CaseConditionStep<BigDecimal>

Same with below code

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)));

The method then(TableField) is undefined for the type Condition

4

1 回答 1

2

从 jOOQ 3.2 开始,CASE表达式支持不实现when()...then()结构,即没有then()关键字。相反,写:

DSL.decode()
   .when(AccountBill.ACCOUNT_BILL.BILL_AMOUNT.le(new BigDecimal(0)), 
         AccountBill.ACCOUNT_BILL.BILL_AMOUNT)
   .otherwise(AccountBill.ACCOUNT_BILL.BILL_NUMBER)

jOOQ 路线图上有一个待处理的功能请求来纠正这个问题:#615

于 2013-10-31T13:10:11.440 回答