0
点赞
收藏
分享

微信扫一扫

mybatis的模糊查询格式

云竹文斋 2022-07-27 阅读 26

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>

 



举报

相关推荐

0 条评论