1. 程式人生 > >【mybatis】mybatis中的<if test=“”>test中多條件

【mybatis】mybatis中的<if test=“”>test中多條件

ID span lun tco sel myba cloud ise uid

mybatis中的<if test=“”>test中多條件

代碼展示:

其中

accountCode和apiName
都是ApiAllRespBean的屬性
<select
            id="getAllApiByApiName"
            parameterType="pisen.cloud.luna.ms.account.api.beans.ApiAllRespBean"
            resultType="pisen.cloud.luna.ms.account.api.beans.ApiAllRespBean">

        SELECT

        ad.name apiName,
        ad.uid apiUid,
        aa.account_code accountCode,
        aa.expire_date expireDate,
        aa.expire_time expireTime,
        aa.freeze_time freezeTime

        FROM
        account_api aa

        INNER JOIN api_detail ad on aa.api_uid 
= ad.uid WHERE account_code = #{accountCode} <if test="apiName != null and apiName != ‘‘"> AND ad.name like % #{apiName} % </if> </select>

【mybatis】mybatis中的<if test=“”>test中多條件