批量插入时,如果参数为null 或者LIST size为0
则会报错,查询不到该表(也就是A)。
@Insert({ "<script>",
"insert into mark_cover(BH,ROADTYPE,XZQH,ROADNAME,LOCATION,QS,QSDW,HYGLBM,JGWG,JGCZ,"
+ "JGDW,LRR,GETTIME,IMGID,IMGURL,ROADSURFACE,WGMS,QSID,POSITION,GDX,GDY,"
+ "DSES_SYS_GUID,DSES_CREATE_TIME,DSES_OPERATE_TYPE,DSES_BSCODE,DSES_UPLOAD_TIME)",
" select a.* from(", "<foreach collection='lists' item='item' index='index' separator='UNION ALL'>",
"(select #{item.bh},#{item.roadtype},#{item.xzqh},#{item.roadname},#{item.location},"
+ "#{item.qs},#{item.qsdw},#{item.hyglbm},#{item.jgwg},#{item.jgcz},#{item.jgdw},"
+ "#{item.lrr},to_date(#{item.gettime},'yyyy-mm-dd hh24:mi:ss'),#{item.imgid},#{item.imgurl},#{item.roadsurface},"
+ "#{item.wgms},#{item.qsid},#{item.position},#{item.gdx},#{item.gdy},sys_guid(),"
+ "#{item.dsesCreateTime},#{item.dsesOperateType},#{item.dsesBscode},#{item.dsesUploadTime} from dual)",
"</foreach> ) a", "</script>" })
public int insertAllCover(@Param("lists") List<MarkCover> lists);