问题
I want to convert Sql
orderby clause with Case using JOOQ
.and BillAmount is of BigDecimal
datatype.
ORDER BY CASE WHEN (BillAmount <= 0)
THEN
BillAmount
ELSE
BillNumber
END
How to write the above line using JOOQ
?
回答1:
Your best option is to directly translate your SQL clause to a corresponding jOOQ clause using the CASE expression (as documented in the manual)
.orderBy(DSL.decode().when(BillAmount.le(0), BillAmount)
.otherwise(BillNumber))
来源:https://stackoverflow.com/questions/19654784/how-to-convert-sql-orderby-clause-with-case-statement-into-jooq