如何在mybatis中引用java中的常量和方法

时间:2023-08-10 17:27:37

转自:http://www.68idc.cn/help/jiabenmake/qita/20140821125261.html

在mybatis的映射xml文件调用java类的方法:

1.

SELECT *
FROM
EC_CORE_USER
WHERE
(user_name=#{userName} or mail =#{userName} or mobile_phone = '${@net.ytoec.framework.security.EncryptionDecryption@dSecret(userName)}') and user_password=#{userPassword}

入上面代码所示。此处应注意,方法必须为静态方法。

2.获取类里面的常量:

r.czmc='${@com.ytoxl.module.datahub.kernel.dataobject.EcSystemLog@THE_AUDIT}'

3.判断是否为null:

<iftest="@org.apache.commons.lang.StringUtils@isNotBlank(province)">andjdo.province=#{province}</if>

相关文章