mybatis中if-else

2020-07-23

java

mybatisif-else要用choose-when-otherwise

1
2
3
4
5
6
7
8
<choose>
<when test="page !=null and page.orderBy != null and page.orderBy != ''">
ORDER BY ${page.orderBy}
</when>
<otherwise>
ORDER BY a.update_date DESC
</otherwise>
</choose>