public interface WxStatisticsMapper {
WxStatistics getStatistics(Long buildId);
}
<select id="getRealTimeALlUserView" parameterType="java.lang.Long" resultType="com.***">
SELECT *
<if test="buildId != null">
where build_id = ${buildId}
</if>
</select>
首先,看传入的参数,就是一个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);
}