1. 程式人生 > >sqlserver 時間段 和 關鍵字 查詢 Mybatis

sqlserver 時間段 和 關鍵字 查詢 Mybatis

where
   <if test="pd.startDate!=null and pd.startDate!='' and pd.endDate!=null and pd.endDate!=''">
   a.CREATE_DATE between   #{pd.startDate} AND  #{pd.endDate} AND
   </if>
    1=1
   <if test="pd.field1 !=null and pd.field1!=''">
      AND (
      a.LOG_TYPE LIKE ('%' + #{pd.field1} + '%')
      or
      a.LOG_CONTENT LIKE ('%' + #{pd.field1} + '%')
      or
      a.MODULE_LOG LIKE ('%' + #{pd.field1} + '%')
      or
      a.OPERATOR LIKE ('%' + #{pd.field1} + '%')
      or
      a.OPERATOR_ROLE LIKE ('%' + #{pd.field1} + '%')
      or
      a.USERNAME LIKE ('%' + #{pd.field1} + '%')
      )
   </
if> </select>