文章目录

  • ​​问题分析​​
  • ​​[1]两个普通参数​​
  • ​​[2]既有参数又有对象​​

问题分析

是当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);