- 首先Dao层接口:
/**
* 批量选择商品保存
*/
int saveGoodsList(@Param("list") List<GoodsEntity> list);
- 上sql
<insert id="saveGoodsList" parameterType="java.util.List">
insert into
<include refid="tableName" />
( id, googs_id, seq, goods-name
)
values
<foreach collection="list" item="it" separator=",">
(#{it.id},
#{it.googsId},
#{it.seq},
#{it.goodsName}
)
</foreach>
</insert>