当前使用版本(必填,否则不予处理)
mp版本:3.3.2
该问题是如何引起的?(确定最新版也有问题再提!!!)
生产运行一直正常,给mapper加了一个assistTaskType参数后报错:BindingException 这个参数正是报错提示的参数 本地运行正常,生产环境两台机器,一台正常,一台不正常。
重现步骤(如果有就写完整)
@Mapper
public interface OfflineTaskMapper extends BaseMapper<OfflineTask> {
List<OfflineTaskAddress> getDistributeTask(String queueCode, Integer assistTaskType, Double minLon, Double maxLon, Double minLat, Double maxLat, Integer count);
}
xml:
<select id="getDistributeTask" resultType="com.my.pojo.bean.OfflineTaskAddress">
select tot.*,
totda.longitude,
totda.latitude
from t_offline_task tot
inner join t_offline_task_distribute_address totda on tot.id = totda.task_id
where tot.queue_code = #{queueCode}
and tot.c_uid is null
and tot.status != 3
and is_stop = 0
<if test="assistTaskType != null">
and tot.assist_task_type = #{assistTaskType}
</if>
and totda.longitude between #{minLon} and #{maxLon}
and totda.latitude between #{minLat} and #{maxLat}
limit #{count}
</select>
在生产环境使用arthas执行对应mapper方法
tt -i 1000 -w 'target.getApplicationContext().getBean("offlineTaskMapper").getDistributeTask("Field_Allin",1,115.1610396,115.3610396,-8.5320857,-8.7320857,1)'
错误的一台提示: ognl.MethodFailedException: Method "getDistributeTask" failed for object com.baomidou.mybatisplus.core.override.MybatisMapperProxy@2aea926 [org.mybatis.spring.MyBatisSystemException: nested exception is org.apache.ibatis.binding.BindingException: Parameter 'assistTaskType' not found. Available parameters are [param7, param5, param6, param3, param4, arg6, param1, param2, arg3, arg2, arg5, arg4, arg1, arg0]]
另一台正确返回结果
报错信息
org.mybatis.spring.MyBatisSystemException: nested exception is org.apache.ibatis.binding.BindingException: Parameter 'assistTaskType' not found. Available parameters are [param7, param5, param6, param3, param4, arg6, param1, param2, arg3, arg2, arg5, arg4, arg1, arg0] at org.mybatis.spring.MyBatisExceptionTranslator.translateExceptionIfPossible(MyBatisExceptionTranslator.java:92) at org.mybatis.spring.SqlSessionTemplate$SqlSessionInterceptor.invoke(SqlSessionTemplate.java:440) at com.sun.proxy.$Proxy166.selectList(Unknown Source) at org.mybatis.spring.SqlSessionTemplate.selectList(SqlSessionTemplate.java:223) at com.baomidou.mybatisplus.core.override.MybatisMapperMethod.executeForMany(MybatisMapperMethod.java:177) at com.baomidou.mybatisplus.core.override.MybatisMapperMethod.execute(MybatisMapperMethod.java:78) at com.baomidou.mybatisplus.core.override.MybatisMapperProxy.invoke(MybatisMapperProxy.java:96) at com.sun.proxy.$Proxy172.getDistributeTask(Unknown Source) at com.my.service.OfflineTaskDbService.getDistributeTask(OfflineTaskDbService.java:386)
Comment From: huayanYu
程序没有偶然性,必然是哪里差异问题。