原因:使用多个参数占位时,未对每个参数加@param注解
(1)不使用@Param注解时,参数只能有一个,且不是Javabean。
正确示例:
@Select("select column from table where userid = #{userid} ")
public int selectColumn(int userid);
(2)不使用@Param注解时,参数只能有一个,且是Javabean,可以使用Javabean的多个属性作参数。
正确示例:
// 这里id是user的属性
@Select("SELECT * from Table where id = #{id}")
Enchashment selectUserById(User user)
(3)使用@Param注解,可使用多个参数。
正确示例:
@Select("select * from table where userid = #{userid} and username = #{username}")
public int selectColumn(@Param("userid") int userid,@Param("username") String username);