SSM框架 mybatis like 问题
映射文件如下:
<resultMap type="java.util.HashMap" id="queryListResult">
<!-- <collection property=""></collection> -->
<result property="Id" column="id"/>
<result property="Name" column="name"/>
</resultMap>
<select id="queryList" parameterType="java.util.HashMap" resultMap="queryListResult">
select id,name from test1
<where>
<if test="id!=null and !id.isEmpty()">id=#{id} </if>
<!-- <if test="id!=null and id!=''">id=#{id} </if> -->
<!-- <if test="name!=null">and name like #{name} </if> -->
<if test="name!=null">and name like concat('%',#{name},'%') </if>
</where>
</select>


无论是这个语句<if test="name!=null">and name like #{name} </if>
还是<if test="name!=null">and name like concat('%',#{name},'%') </if>
都不能查出来结果,但是单独执行能查出来结果这到底是怎么回事???用的spring4.0.6,mybatis3.3
<resultMap type="java.util.HashMap" id="queryListResult">
<!-- <collection property=""></collection> -->
<result property="Id" column="id"/>
<result property="Name" column="name"/>
</resultMap>
<select id="queryList" parameterType="java.util.HashMap" resultMap="queryListResult">
select id,name from test1
<where>
<if test="id!=null and !id.isEmpty()">id=#{id} </if>
<!-- <if test="id!=null and id!=''">id=#{id} </if> -->
<!-- <if test="name!=null">and name like #{name} </if> -->
<if test="name!=null">and name like concat('%',#{name},'%') </if>
</where>
</select>


无论是这个语句<if test="name!=null">and name like #{name} </if>
还是<if test="name!=null">and name like concat('%',#{name},'%') </if>
都不能查出来结果,但是单独执行能查出来结果这到底是怎么回事???用的spring4.0.6,mybatis3.3
...全文
相关推荐
ssm框架分页及模糊查询
初学ssm框架,网上的分页及模糊查询大多语焉不详,对于初学者来说无法理解,自己通过好几天的查询,写出了一个这么一个简单的东西,希望对大家有点帮助(旧版。不推荐.分页有bug)
ssm框架实现模糊查询
ssm框架实现模糊查询
ssm分页及模糊查询源码下载
上一个ssm框架的改进版:去掉了模糊查询非法输入的bug
ssm框架\mybatis\动态sql\1.使用动态SQL完成多条件查询
ssm框架中关于mybatis的动态sql中的1.使用动态SQL完成多条件查询
基于ssm的登陆注册批量增删该查分页模糊查询
ssm框架,mysql数据库,ajax,正则验证,分页,模糊查询,弹窗修改,增删改查


