mybatis动态sql语句
2014-08-09 18:05
405 查看
在动态sql语句中trim 是prefix="WHERE" prefixOverrides="AND |OR "需要添加的,这是一个模糊查询
<select id="getInfoLogForTrim" parameterType="InfoLog" resultType="InfoLog"> select * from info_log <trim prefix="WHERE" prefixOverrides="AND |OR "> <if test="operator != null"> and operator like '%'|| #{operator}||'%' </if> <if test="mac != null "> and <![CDATA[ mac =#{mac}]]> </if> <if test="annex != null"> and annex =#{annex} </if> </trim> </select>动态中的where语法
<select id="getInfoLogForWhere" parameterType="InfoLog" resultType="InfoLog"> select * from info_log <where> <if test="operator != null"> and operator like '%'|| #{operator}||'%' </if> <if test="mac != null "> and <![CDATA[ mac =#{mac}]]> </if> <if test="annex != null"> and annex =#{annex} </if> </where> </select>
相关文章推荐
- MyBatis学习 之 三、动态SQL语句
- MyBatis学习 之 三、动态SQL语句
- mybatis实战教程(mybatis in action)之八:mybatis 动态sql语句(转)
- mybatis动态SQL语句
- MyBatis学习 之 三、动态SQL语句
- MyBatis学习 之 三、动态SQL语句
- mybatis动态SQL语句
- MyBatis学习 之 三、动态SQL语句
- mybatis 动态sql语句
- MyBatis学习之三--动态SQL语句
- MyBatis学习 之 三、动态SQL语句
- mybatis动态SQL语句
- MyBatis学习 之 三、动态SQL语句
- mybatis动态SQL语句
- MyBatis学习 之 三、动态SQL语句
- MyBatis学习 之 四、动态SQL语句
- MyBatis学习 之四、动态SQL语句
- mybatis动态SQL语句
- MyBatis学习 之 三、动态SQL语句
- MyBatis学习 之 三、动态SQL语句