大家好,欢迎来到IT知识分享网。
需求
在进行入库时,数据一条条入库时间太慢了,批量入库速度更快
批量插入
这里使用注解的方法@Insert进行数据插入
@Insert("<script> " +
"insert into communityinfo (tguid,CityName,District,ResidentialAreaName,ResidentialAreaAlias,School,Description,NearbySchool,SupportFacility,RingRoad,ManagementCompany,GreeningRate,ManagementFees,ManagementFeesDesp,BaseFacility,Network,PublicSecurity,CarsAmount,ParkingRatio,Parking,BuildingCategory,HouseTypes,HouseType,EndJobDate,CompletionDate,SellDate,LandUseYearsLimit,DeveloperCompany,BuildingStructure,BuildingArea,LandArea,HousingCount,HouseBuildingCount,FloorAreaRatio) VALUES " +
"<foreach collection=\"list\" item=\"community\" index=\"index\" separator=\",\"> " +
"(#{community.tguid},#{community.CityName},#{community.District},#{community.ResidentialAreaName},#{community.ResidentialAreaAlias},#{community.School},#{community.Description},#{community.NearbySchool},#{community.SupportFacility},#{community.RingRoad},#{community.ManagementCompany},#{community.GreeningRate},#{community.ManagementFees},#{community.ManagementFeesDesp},#{community.BaseFacility},#{community.Network},#{community.PublicSecurity},#{community.CarsAmount},#{community.ParkingRatio},#{community.Parking},#{community.BuildingCategory},#{community.HouseTypes},#{community.HouseType},#{community.EndJobDate},#{community.CompletionDate},#{community.SellDate},#{community.LandUseYearsLimit},#{community.DeveloperCompany},#{community.BuildingStructure},#{community.BuildingArea},#{community.LandArea},#{community.HousingCount},#{community.HouseBuildingCount},#{community.FloorAreaRatio}) " +
"</foreach> " +
"</script>")
boolean insertBatch(List<Community> list);
批量更新
@Update({
"<script>",
"<foreach collection='list' item='item' index='index' separator=';'>",
"update communityinfo b",
"set b.DistrictName= #{item.DistrictName} where b.id= #{item.id}",
"</foreach>",
"</script>"
})
boolean batchUpdateName(@Param(value="list")List<Community_copy> list);
免责声明:本站所有文章内容,图片,视频等均是来源于用户投稿和互联网及文摘转载整编而成,不代表本站观点,不承担相关法律责任。其著作权各归其原作者或其出版社所有。如发现本站有涉嫌抄袭侵权/违法违规的内容,侵犯到您的权益,请在线联系站长,一经查实,本站将立刻删除。 本文来自网络,若有侵权,请联系删除,如若转载,请注明出处:https://yundeesoft.com/10970.html