Multiple or queries as a whole

I have used mybatis, and I have seen such a label sql configuration:

<isNotEmpty property="PROPERTYNAME" prepend="AND ">

            (T1.PROPERTY_NAME like '%'|| #PROPERTYNAME# ||'%'

            OR T1.BUILDING_NAME like '%'|| #PROPERTYNAME# ||'%'

            OR T1.FLOOR_NAME like '%'|| #PROPERTYNAME# ||'%'

            OR T1.OFFICE_NAME LIKE '%'|| #PROPERTYNAME# ||'%')

        </isNotEmpty>

In general, this form means that the or condition inside the tag is taken as a whole. So be sure to pay attention to the opening and closing brackets at the beginning of the tag content.

If there are no parentheses, the final SQL statement generated, these conditions are independent, of course, will affect the subsequent query results

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=326129807&siteId=291194637