https://blog.csdn.net/kobi521/article/details/16941403,
MyBatis排序时使用order by 动态参数时需要注意,用$而不是#
正确写法:
ORDER BY FIELD(f.id,
<foreach collection="machineIds" item="machineId" index="index" open="" close=")" separator=",">
${machineId}
</foreach>
错误写法:
ORDER BY FIELD(f.id,
<foreach collection="machineIds" item="machineId" index="index" open="" close=")" separator=",">
#{machineId}
</foreach>
会产生
Parameter index out of range (1 > number of parameters, which is 0).
这类错误!!