报错信息:Could not find value method on SQL annotation. Cause: org.apache.ibatis.builder.BuilderException: Error creating document instance. Cause: org.xml.sax.SAXParseException; lineNumber: 2; columnNumber: 50; 元素内容必须由格式正确的字符数据或标记组成。
"<script>"+
"select user_id,IFNULL(`level`,0) as level from users where currencyId=#
{currencyId} and \n" +
" snapshot_time>='#{startTime} "
"and snapshot_time<=#{endTime} "
+ " and user_id in"
+"<foreach collection='userIds' item='item' open='(' separator=',' close=')'>" +
" #{item} "
+ "</foreach>"+
"</script>"
我们看sql语句发现没有任何问题,原因mybatis把他认为是一个xml格式。xml中不能包含<(小于号) ,换成
between and 就可以解决这个问题。
来源:https://blog.csdn.net/weixin_42324471/article/details/98882495