insert into business_advert_item(
operate,item_type_cd,community_id,b_id,advert_item_id,advert_id,url,seq
) values (
#{operate},#{itemTypeCd},#{communityId},#{bId},#{advertItemId},#{advertId},#{url},#{seq}
)
insert into advert_item(
item_type_cd,status_cd,community_id,b_id,advert_item_id,advert_id,url,seq
) select t.item_type_cd,'0',t.community_id,t.b_id,t.advert_item_id,t.advert_id,t.url,t.seq from
business_advert_item t where 1=1
and t.operate= 'ADD'
and t.item_type_cd= #{itemTypeCd}
and t.community_id= #{communityId}
and t.b_id= #{bId}
and t.advert_item_id= #{advertItemId}
and t.advert_id= #{advertId}
and t.url= #{url}
and t.seq= #{seq}
update advert_item t set t.status_cd = #{statusCd}
,t.b_id = #{newBId}
, t.item_type_cd= #{itemTypeCd}
, t.community_id= #{communityId}
, t.advert_id= #{advertId}
, t.url= #{url}
, t.seq= #{seq}
where 1=1
and t.b_id= #{bId}
and t.advert_item_id= #{advertItemId}