1. 程式人生 > >mybatis的批量插入

mybatis的批量插入

@Insert({
            "<script>",
            "insert into location.cur_loc_ibeacon_class (class_id, zone_id, ",
            "lat, lon, datajson, ",
            "posttime, column_id, ",
            "map_id, building, ",
            "level, is_del) values ",
            "<foreach collection='list' item='item' index='index' separator=','>",
            "(#{item.classId}, #{item.zoneId},#{item.lat}, #{item.lon}, #{item.datajson},#{item.posttime},#{item.columnId},#{item.mapId},#{item.building},#{item.level},#{item.isDel})",
            "</foreach>",
            "</script>"
    })
    int bulkInsert(List<LocIbeaconClass> record);