INSERT INTO t_camera_organization_cache ( id,name,parent_id,sort,subCount,path,is_parent,is_root ) VALUES ( #{item.id},#{item.name},#{item.parentId},#{item.sort},#{item.subCount},#{item.name},#{item.isParent},#{item.root} ) INSERT INTO t_camera_channel_cache ( channel_code,channel_id,channel_name,gps_x,gps_y,status, parent_id,region_code,region_name,node_name ) VALUES ( #{item.channelCode},#{item.channelId},#{item.channelName},#{item.gpsX},#{item.gpsY},#{item.status}, #{item.parentId},#{item.regionCode},#{item.regionName},TRIM(TRAILING '->' FROM #{item.nodeName}) ) UPDATE t_region a INNER JOIN ( SELECT COUNT(idt_camera_channel) AS channel_count,region_code FROM t_camera_channel GROUP BY region_code ) b ON a.region_code = b.region_code SET a.channel_count = b.channel_count UPDATE t_camera_organization_cache SET path = TRIM( TRAILING '->' FROM #{path}) where id = #{id} INSERT INTO t_camera_organization ( id,name,parent_id,sort,subCount,is_parent,path,is_root,channelCount,count ) SELECT id,name,parent_id,sort,subCount,is_parent,path,is_root,channelCount,count FROM t_camera_organization_cache