MyBatis参数的传递有几种不同的方法,本文通过测试用例出发,对其中的方式进行总结和说明,并对其部分源码进行分析. 一.测试用例(环境参考之前博客SSM接口编程一文 http://www.cnblogs.com/gzy-blog/p/6052185.html) 1.1 没有注解,即dao层的代码如下: public User findById(int id); public User findByIdAndName1(int id, String name); public User find…
原文地址:http://blog.csdn.net/isea533/article/details/44002219 深入了解MyBatis参数 相信很多人可能都遇到过下面这些异常: "Parameter 'xxx' not found. Available parameters are [...]" "Could not get property 'xxx' from xxxClass. Cause: "The expression 'xxx' evaluated…
mybatis.xml中有if判断条件判断参数不为空时,赋值为0的Integer参数被MyBatis判断为空,因此不执行<if test="param != null and param != ''"></if>的SQL. 所以在做项目时一定要注意,用到MyBatis时,避免用0来做值. 解决方法: <if test="status !=null and (status!='' or status == 0)"> AND t1.`…