insert into business_shop(shop_id,b_id,catalog_id,store_id,name,hot_buy,sale_price,open_shop_count,shop_count,start_date,end_date,month,operate)
values(#{shopId},#{bId},#{catalogId},#{storeId},#{name},#{hotBuy},#{salePrice},#{openShopCount},#{shopCount},#{startDate},#{endDate},#{month},#{operate})
insert into business_shop_attr(b_id,attr_id,shop_id,spec_cd,value,month,operate)
values(#{bId},#{attrId},#{shopId},#{specCd},#{value},#{month},#{operate})
insert into business_shop_attr_param(attr_param_id,b_id,shop_id,spec_cd,param,month,operate)
values(#{attrParamId},#{bId},#{shopId},#{specCd},#{param},#{month},#{operate})
insert into business_shop_photo(shop_photo_id,b_id,shop_id,shop_photo_type_cd,photo,month,operate)
values(#{shopPhotoId},#{bId},#{shopId},#{shopPhotoTypeCd},#{photo},#{month},#{operate})
insert into business_shop_preferential(shop_preferential_id,b_id,shop_id,original_price,discount_rate,show_original_price,preferential_start_date,preferential_end_date,month,operate)
values(#{shopPreferentialId},#{bId},#{shopId},#{originalPrice},#{discountRate},#{showOriginalPrice},#{preferentialStartDate},#{preferentialEndDate},#{month},#{operate})
insert into business_shop_desc(shop_desc_id,shop_id,b_id,shop_describe,month,operate)
values(#{shopDescId},#{shopId},#{bId},#{shopDescribe},#{month},#{operate})
insert into business_shop_catalog(catalog_id,b_id,store_id,name,level,parent_catalog_id,month,operate)
values(#{catalogId},#{bId},#{storeId},#{name},#{level},#{parentCatalogId},#{month},#{operate})
insert into s_shop(shop_id,b_id,catalog_id,store_id,name,hot_buy,sale_price,open_shop_count,shop_count,start_date,end_date,status_cd)
select s.shop_id,s.b_id,s.catalog_id,s.store_id,s.name,s.hot_buy,s.sale_price,s.open_shop_count,s.shop_count,s.start_date,s.end_date,'0'
from business_shop s where
s.operate = 'ADD' and s.b_id=#{bId}
insert into s_shop_attr(b_id,attr_id,shop_id,spec_cd,value,status_cd)
select sa.b_id,sa.attr_id,sa.shop_id,sa.spec_cd,sa.value,'0'
from business_shop_attr sa
where sa.operate = 'ADD' and sa.b_id=#{bId}
insert into s_shop_attr_param(attr_param_id,b_id,shop_id,spec_cd,param,status_cd)
select sap.attr_param_id,sap.b_id,sap.shop_id,sap.spec_cd,sap.param,'0'
from business_shop_attr_param sa
where sa.operate = 'ADD' and sa.b_id=#{bId}
insert into s_shop_photo(shop_photo_id,b_id,shop_id,shop_photo_type_cd,photo,status_cd)
select sp.shop_photo_id,sp.b_id,sp.shop_id,sp.shop_photo_type_cd,sp.photo,'0'
from business_shop_photo sp
where sp.operate = 'ADD' and sp.b_id=#{bId}
insert into s_shop_preferential(shop_preferential_id,b_id,shop_id,original_price,discount_rate,show_original_price,preferential_start_date,preferential_end_date,status_cd)
select sp.shop_preferential_id,sp.b_id,sc.shop_id,sp.original_price,sp.discount_rate,sp.show_original_price,sp.preferential_start_date,sp.preferential_end_date,'0'
from business_shop_preferential sp
where sp.operate = 'ADD' and sp.b_id=#{bId}
insert into s_shop_desc(shop_desc_id,b_id,shop_id,shop_describe,status_cd)
select sd.shop_desc_id,sd.b_id,sd.shop_id,sd.shop_describe,'0'
from business_shop_desc sd
where sd.operate = 'ADD' and sd.b_id=#{bId}
insert into s_shop_catalog(catalog_id,b_id,store_id,name,level,parent_catalog_id,status_cd)
select sc.catalog_id,sc.b_id,sc.store_id,sc.name,sc.level,sc.parent_catalog_id,'0'
from business_shop_catalog sc
where sc.operate = 'ADD' and sc.b_id=#{bId}
insert into s_buy_shop(buy_id,b_id,shop_id,buy_count,month,status_cd)
values(#{buyId},#{bId},#{shopId},#{buyCount},#{month},'0')
insert into s_buy_shop_attr(buy_id,b_id,attr_id,spec_cd,value,month,status_cd)
values(#{buyId},#{bId},#{attrId},#{specCd},#{value},#{month},'0')
update s_shop s set s.status_cd = #{statusCd}
,s.b_id = #{newBId}
,s.store_id = #{storeId}
,s.catalog_id = #{catalogId}
,s.name = #{name}
,s.hot_buy = #{hotBuy}
,s.sale_price = #{salePrice}
,s.open_shop_count = #{openShopCount}
,s.shop_count = #{shopCount}
,s.start_date = #{startDate}
,s.end_date = #{endDate}
where 1=1
and s.b_id = #{bId}
and s.shop_id = #{shopId}
update s_shop_attr sa set sa.status_cd = #{statusCd}
,sa.b_id = #{newBId}
,sa.value = #{value}
where 1=1
and sa.b_id = #{bId}
and sa.shop_id = #{shopId}
and sa.spec_cd = #{specCd}
and sa.attr_id = #{attrId}
update s_shop_attr_param sap set sap.status_cd = #{statusCd}
,sap.b_id = #{newBId}
,sap.param = #{param}
where 1=1
and sap.b_id = #{bId}
and sap.shop_id = #{shopId}
and sap.spec_cd = #{specCd}
and sap.attr_param_id = #{attrParamId}
update s_shop_photo sp set sp.status_cd = #{statusCd}
,sp.b_id = #{newBId}
,sp.shop_photo_type_cd = #{shopPhotoTypeCd}
,sp.photo = #{photo}
where 1=1
and sp.b_id = #{bId}
and sp.shop_id = #{shopId}
and sp.shop_photo_id = #{shopPhotoId}
update s_shop_preferential sp set sp.status_cd = #{statusCd}
,sp.b_id = #{newBId}
,sp.original_price = #{originalPrice}
,sp.discount_rate = #{discountRate}
,sp.show_original_price = #{showOriginalPrice}
,sp.preferential_start_date = #{preferentialStartDate}
,sp.preferential_end_date = #{preferentialEndDate}
where 1=1
and sp.b_id = #{bId}
and sp.shop_id = #{shopId}
and sp.shop_preferential_id = #{shopPreferentialId}
update s_shop_desc sd set sd.status_cd = #{statusCd}
,sd.b_id = #{newBId}
,sd.shop_describe = #{shopDescribe}
where 1=1
and sd.b_id = #{bId}
and sd.shop_id = #{shopId}
and sd.shop_desc_id = #{shopDescId}
update s_shop_catalog sc set sc.status_cd = #{statusCd}
,sc.b_id = #{newBId}
,sc.name = #{name}
,sc.level = #{level}
,sc.parent_catalog_id = #{parentCatalogId}
where 1=1
and sc.b_id = #{bId}
and sc.store_id = #{storeId}
and sc.catalog_id = #{catalogId}
update s_buy_shop bs set bs.status_cd = #{statusCd}
,bs.b_id = #{newBId}
,bs.buy_count = #{buy_count}
where 1=1
and bs.b_id = #{bId}
and bs.shop_id = #{shopId}
and bs.buy_id = #{buyId}
update s_buy_shop_attr bsa set bsa.status_cd = #{statusCd}
,bsa.b_id = #{newBId}
,bsa.value = #{value}
where 1=1
and bsa.b_id = #{bId}
and bsa.buy_id = #{buyId}
and bsa.spec_cd = #{specCd}
and bsa.attr_id = #{attrId}