其他分享
首页 > 其他分享> > Mybatis XML标签使用方法

Mybatis XML标签使用方法

作者:互联网

<select id="queryPage" resultType="cn">
        select *
        from Tb
        WHERE 1 = 1
        <if test="param2.urgentDegree!=null and param2.urgentDegree!=''">
            and urgent_Degree = #{param2.urgentDegree}
        </if>
        <if test="param2.deviceId!=null and param2.deviceId!=''">
            and device_Id like CONCAT(CONCAT('%', #{param2.deviceId}), '%')
        </if>
        
        <if test="param2.auditStatusList!=null">
            and audit_status in
            <foreach collection="param2.auditStatusList" item="item" separator="," open="(" close=")" index="">
                #{item}
            </foreach>
        </if>
        <if test="userList !=null">
            and ((1, ARTICLEID) in
            <foreach collection="idList" item="item" separator="," open="(" close=")" index="">
                (1, #{item})
            </foreach>)
        </if>
        Order By CREATE_TIME DESC
    </select>

 

标签:XML,status,urgent,标签,item,param2,Mybatis,CONCAT
来源: https://www.cnblogs.com/cjxy1993/p/16601981.html