SQL模糊查询 同时匹配多个字段

 <select id="selectByTitleAndDocumentId" parameterType="java.lang.String" resultMap="BaseResultMap">
  select * from guide where title like concat('%',#{title,jdbcType = VARCHAR},'%')
  and document_id like concat('%',#{documentId,jdbcType = VARCHAR},'%') and del_flag = 0
</select>

如果要查询不满足模糊匹配的字段,只需要将【like】替换为【not like】即可

 

posted @ 2020-05-19 08:55  CEO雷总  阅读(8995)  评论(0编辑  收藏  举报