【mybatis】mybatis中的test中多条件

时间:2024-11-09 20:04:56

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

代码展示:

其中

accountCode和apiName
都是ApiAllRespBean的属性
<select
            id="getAllApiByApiName"
            parameterType=""
            resultType="">

        SELECT

         apiName,
         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 = 

        WHERE
        account_code = #{accountCode}

        <if test="apiName != null  and apiName != ''">
            AND  like '%' #{apiName} '%'
        </if>


    </select>