insert into business_advert(classify,ad_name,location_type_cd,ad_type_cd,advert_id,operate,start_time,state,end_time,community_id,b_id,location_obj_id,seq,view_type,advert_type,page_url)
values
(#{classify},#{adName},#{locationTypeCd},#{adTypeCd},#{advertId},#{operate},#{startTime},#{state},#{endTime},#{communityId},#{bId},#{locationObjId},#{seq},#{viewType},#{advertType},#{pageUrl})
insert into advert(
classify,ad_name,location_type_cd,status_cd,ad_type_cd,advert_id,start_time,state,end_time,community_id,b_id,location_obj_id,seq,view_type,advert_type,page_url
) select
t.classify,t.ad_name,t.location_type_cd,'0',t.ad_type_cd,t.advert_id,t.start_time,t.state,t.end_time,t.community_id,t.b_id,t.location_obj_id,t.seq,t.view_type,t.advert_type,t.page_url
from business_advert t where 1=1
and t.classify= #{classify}
and t.ad_name= #{adName}
and t.location_type_cd= #{locationTypeCd}
and t.ad_type_cd= #{adTypeCd}
and t.advert_id= #{advertId}
and t.operate= 'ADD'
and t.start_time= #{startTime}
and t.state= #{state}
and t.end_time= #{endTime}
and t.community_id= #{communityId}
and t.b_id= #{bId}
and t.location_obj_id= #{locationObjId}
and t.advert_type = #{advertType}
and t.page_url= #{pageUrl}
and t.seq= #{seq}
update advert t set t.status_cd = #{statusCd}
,t.b_id = #{bId}
, t.classify= #{classify}
, t.ad_name= #{adName}
, t.location_type_cd= #{locationTypeCd}
, t.ad_type_cd= #{adTypeCd}
, t.start_time= #{startTime}
, t.state= #{state}
, t.end_time= #{endTime}
, t.community_id= #{communityId}
, t.location_obj_id= #{locationObjId}
, t.seq= #{seq}
, t.view_type = #{viewType}
, t.advert_type = #{advertType}
, t.page_url= #{pageUrl}
where 1=1
and t.advert_id= #{advertId}
update advert t set t.status_cd = #{statusCd}
,t.b_id = #{newBId}
, t.classify= #{classify}
, t.ad_name= #{adName}
, t.location_type_cd= #{locationTypeCd}
, t.ad_type_cd= #{adTypeCd}
, t.start_time= #{startTime}
, t.state= #{state}
, t.end_time= #{endTime}
, t.location_obj_id= #{locationObjId}
, t.seq= #{seq}
, t.view_type = #{viewType}
, t.advert_type = #{advertType}
, t.page_url= #{pageUrl}
where 1=1
and t.advert_id= #{advertId}
and t.b_id= #{bId}