码迷,mamicode.com
首页 > 数据库 > 详细

数据库的模糊查询mybatis

时间:2015-12-09 01:49:47      阅读:227      评论:0      收藏:0      [点我收藏+]

标签:

<!-- oracle -->
<select id="searchUserBySearchName" parameterType="java.lang.String" resultType="com.urm.entity.User">
    select * from t_user where user_name like CONCAT(‘%‘,#{search_name},‘%‘)
</select>
<!-- 或者 -->
<select id="searchUserBySearchName" parameterType="java.lang.String" resultType="com.urm.entity.User">
    select * from t_user where user_name like ‘%‘||#{search_name}||‘%‘ 
</select>

<!-- mysql -->
<select id="searchUserBySearchName" parameterType="java.lang.String" resultType="com.urm.entity.User">
    select * from t_user where user_name like CONCAT(‘%‘,#{search_name},‘%‘)
</select>
    
<!-- sql server -->
<select id="searchUserBySearchName" parameterType="java.lang.String" resultType="com.urm.entity.User">
    select * from t_user where user_name like ‘%‘+#{search_name}+‘%‘
</select>

<!-- db2 -->
<select id="searchUserBySearchName" parameterType="java.lang.String" resultType="com.urm.entity.User">
    select * from t_user where user_name like CONCAT(‘%‘,#{search_name},‘%‘)  
</select>
<!-- 或者 -->
<select id="searchUserBySearchName" parameterType="java.lang.String" resultType="com.urm.entity.User">
    select * from t_user where user_name like ‘%‘||#{search_name}||‘%‘ 
</select>

 

数据库的模糊查询mybatis

标签:

原文地址:http://www.cnblogs.com/xuerong/p/5031512.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!