1. 程式人生 > >對於傳一個引數去資料庫裡匹配多個欄位的資料查詢

對於傳一個引數去資料庫裡匹配多個欄位的資料查詢

舉個例子:

<if test="customName != null and customName != ''">
    and t.customName like '%'+#{customName}+'%'
    or t.customType = #{customName}
    or t.deptType = #{customName}
    or t.province = #{customName}
    or t.city = #{customName}
    or t.direct = #{customName}
    or t.principalName = #{customName}
</if>
傳了一個customName 去匹配多個欄位 ,前端頁面就一個搜尋框實現多個欄位的查詢