mybatis的模糊查询格式

2023-03-14,,

mybatis的模糊查询格式

  <select id="xxx"  parameterType="com.model.xxx"   resultMap="BaseResultMap">
select * from users WHERE 1=1
<if test="name != null and name != ''" >
and name like CONCAT('%',#{name,jdbcType=VARCHAR},'%')
</if> <if test="identity != null and identity != ''" >
and identity like CONCAT('%',#{identity,jdbcType=VARCHAR},'%')
</if> <if test="phon != null and phon != ''" >
and phon like CONCAT('%',#{phon,jdbcType=VARCHAR},'%')
</if>
</select>

mybatis的模糊查询格式的相关教程结束。

《mybatis的模糊查询格式.doc》

下载本文的Word格式文档,以方便收藏与打印。