关于mybatis传单个参数(Long,Integer......)

public interface WxStatisticsMapper {

    WxStatistics getStatistics(Long buildId);
}

首先,看传入的参数,就是一个long类型的参数,如果你不传入参数,OK,没有问题,是为空的,可以判断

如果你传入了参数,就要开始报错了,如下:

Caused by: org.apache.ibatis.reflection.ReflectionException: There is no getter for property named 'buildId' in 'class java.lang.Long'

应该在传入参数的时候加注释,如下:

public interface WxStatisticsMapper {

    WxStatistics getStatistics(@Param(value = "buildId") Long buildId);
}

你可能感兴趣的:(关于mybatis传单个参数(Long,Integer......))