问题分析
是当Dao层的方法有多个参数的时候,我们需要加入@Param注解
我下面都是用注解开发的,不是xml
例如:
[1]两个普通参数
都加上@Param注解
@Select("select * from student where id=#{id} and name=#{name})
int selectBySelective(@Param("id")int id,@Param("name")String name);
[2]既有参数又有对象
普通参数直接写,对象要写对象.属性
@Select("select * from oilMonth where wellId=#{oilDaily.wellInfo.wellId} and time=#{previousMonth}")
OilMonth findPreviousMonth(@Param("oilDaily") OilDaily oilDaily,@Param("previousMonth") String previousMonth);
博客主要围绕Dao层方法多参数的问题展开分析。指出当Dao层方法有多个参数时,需加入@Param注解,且采用注解开发而非xml。具体说明了两个普通参数都要加注解,既有参数又有对象时,普通参数直接写,对象写法也有相应要求。
772

被折叠的 条评论
为什么被折叠?



