Mybatis error: Parameter 'LIST' not found. Available parameters are [groupList, param1], mybatisgrouplist
Methods defined in GroupDao. java:
Void batchInsertLog (@ Param ("groupList") List <MktPromotionIntegralLog> groupList );
GroupMapper. xml before modification
<Insert id = "batchInsertLog" parameterType = "java. util. List">
Insert into table
(Ps_id, goods_id, item_number, goods_name)
Values
<Foreach collection = "list" item = "log" index = "groupList" separator = ",">
(# {Log. ps_id}, # {log. goods_id}, # {log. item_number}, # {log. goods_name })
</Foreach>
</Insert>
An error is returned when you execute the batchInsertLog method:
Parameter 'LIST' not found. Available parameters are [groupList, param1]
Modified GroupMapper. xml
<Insert id = "batchInsertLog" parameterType = "java. util. List">
Insert into table
(Ps_id, goods_id, item_number, goods_name)
Values
<Foreach collection = "groupList" item = "log" index = "groupList" separator = ",">
(# {Log. ps_id}, # {log. goods_id}, # {log. item_number}, # {log. goods_name })
</Foreach>
</Insert>
An error is reported after modification.
The cause of this problem is that the collection in foreach should be stored in java. util. list, but it should be the same as the parameter name bound to @ Param ("groupList") in Dao. If @ Param is not used, the GroupMapper before the modification. xml is not a problem.