写在mapper.xml中的内容,入参:ArrayList,例如User类(包含userid,passwd)
<insert id="addLineList" parameterType="java.util.ArrayList" >
insert into user(userid, passwd)
<foreach collection="list" item="item" index="index" separator="UNION ALL">
(select #{item.userid},#{item.passwd} from dual)
</foreach>
</insert>
缺少表达式可能是因为:insert xxx(xxx,xxx) 后面加了 values
sql位正确结束:检查separator=”“,里面写了 ‘,’ ,应该为’UNION ALL’