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

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>

 

文章来自:https://www.cnblogs.com/sxdcgaq8080/p/9103820.html
© 2021 jiaocheng.bubufx.com  联系我们
ICP备案:鲁ICP备09046678号-3