mybatis中模糊查询的写法
2017-08-14 11:47
323 查看
刚开始用了一种错误的写法:
<select id="findDataByMonitorplaceAndTime" resultType="org.hopeframework.db.model.Data" parameterType="org.hopeframework.db.model.Data"> select * from data where monitorplacename = #{monitorplacename,jdbcType=VARCHAR} and timedetail like %#{timedetail}% </select> 这种查询的写法会报错.改成如下那种就可以了:
<select id="findDataByMonitorplaceAndTime" resultType="org.hopeframework.db.model.Data" parameterType="org.hopeframework.db.model.Data"> select * from data where monitorplacename = #{monitorplacename,jdbcType=VARCHAR} and timedetail like concat(concat('%',#{timedetail},'%'))</select>
查询成功
相关文章推荐
- Mybatis中模糊查询的各种写法
- Mybatis中模糊查询的各种写法
- Mybatis中模糊查询的各种写法
- Mybatis中模糊查询的各种写法
- Mybatis中模糊查询的各种写法(转)
- Mybatis中模糊查询的各种写法
- mybatis 模糊查询的写法(注:网上转载,分享)
- Mybatis中模糊查询的各种写法
- Mybatis中模糊查询的各种写法
- Mybatis中模糊查询的各种写法
- Mybatis中使用oracle的模糊查询的SQL语句写法
- Mybatis中模糊查询的各种写法
- mybatis xml文件中的大于、小于、及like模糊查询的写法
- Mybatis中模糊查询的各种写法
- Mybatis中模糊查询的各种写法(转)
- Mybatis中模糊查询的各种写法
- Mybatis中模糊查询的各种写法
- mybatis中模糊查询的写法
- MyBatis常用几种模糊查询的写法
- 模糊查询在mybatis配置xml文件中的写法