在Mybatis的动态SQL和${}形式的参数中都用到了OGNL表达式。
Mybatis常用的OGNL表达式如下
1、e1 or e2:或
<if test="userEmail != null or userEmail == '1'"> </if>
2、e1 and e2:且
<if test="userEmail != null and userEmail != ''"> </if>
3、e1 == e2 或e1 eq e2:相等
<if test="userEmail == null and userEmail == ''"> </if>
4、e1 != e2 或 e1 neq e2:不等
<if test="userEmail != null and userEmail != ''"> </if>
5、e1 lt e2:小于
<if test="age lt 10"> #{userEmail,jdbcType=VARCHAR}, </if>
6、e1 lte e2:小于等于
7、e1 gt e2:大于
8、e1 gte e2:大于等于
9、 e1 e2(加),e1 - e2(减),e1 * e2(乘),e1/e2(除),e1