insert into business_store(store_id,b_id,user_id,name,address,tel,store_type_cd,nearby_landmarks,map_x,map_y,month,operate) values(#{storeId},#{bId},#{userId},#{name},#{address},#{tel},#{storeTypeCd},#{nearbyLandmarks},#{mapX},#{mapY},#{month},#{operate}) insert into business_store_attr(b_id,attr_id,store_id,spec_cd,value,month,operate) values(#{bId},#{attrId},#{storeId},#{specCd},#{value},#{month},#{operate}) insert into business_store_photo(store_photo_id,b_id,store_id,store_photo_type_cd,photo,month,operate) values(#{storePhotoId},#{bId},#{storeId},#{storePhotoTypeCd},#{photo},#{month},#{operate}) insert into business_store_cerdentials(store_cerdentials_id,b_id,store_id,credentials_cd,value,validity_period,positive_photo,negative_photo,month,operate) values(#{storeCerdentialsId},#{bId},#{storeId},#{credentialsCd},#{value},#{validityPeriod},#{positivePhoto},#{negativePhoto},#{month},#{operate}) insert into s_store(store_id,b_id,user_id,name,address,tel,store_type_cd,nearby_landmarks,map_x,map_y,status_cd) select s.store_id,s.b_id,s.user_id,s.name,s.address,s.tel,s.store_type_cd,s.nearby_landmarks,s.map_x,s.map_y,'0' from business_store s where s.operate = 'ADD' and s.b_id=#{bId} insert into s_store_attr(b_id,attr_id,store_id,spec_cd,value,status_cd) select sa.b_id,sa.attr_id,sa.store_id,sa.spec_cd,sa.value,'0' from business_store_attr sa where sa.operate = 'ADD' and sa.b_id=#{bId} insert into s_store_photo(store_photo_id,b_id,store_id,store_photo_type_cd,photo,status_cd) select sp.store_photo_id,sp.b_id,sp.store_id,sp.store_photo_type_cd,sp.photo,'0' from business_store_photo sp where sp.operate = 'ADD' and sp.b_id=#{bId} insert into s_store_cerdentials(store_cerdentials_id,b_id,store_id,credentials_cd,value,validity_period,positive_photo,negative_photo,status_cd) select sc.store_cerdentials_id,sc.b_id,sc.store_id,sc.credentials_cd,sc.value,sc.validity_period,sc.positive_photo,sc.negative_photo,'0' from business_store_cerdentials sc where sc.operate = 'ADD' and sc.b_id=#{bId} update s_store s set s.status_cd = #{statusCd} ,s.b_id = #{newBId} ,s.user_id = #{userId} ,s.name = #{name} ,s.address = #{address} ,s.tel = #{tel} ,s.store_type_cd = #{storeTypeCd} ,s.nearby_landmarks = #{nearbyLandmarks} ,s.map_x = #{mapX} ,s.map_y = #{mapY} where 1=1 and s.b_id = #{bId} and s.store_id = #{storeId} update s_store_attr sa set sa.status_cd = #{statusCd} ,sa.b_id = #{newBId} ,sa.value = #{value} where 1=1 and sa.b_id = #{bId} and sa.store_id = #{storeId} and sa.spec_cd = #{specCd} and sa.attr_id = #{attrId} update s_store_photo sp set sp.status_cd = #{statusCd} ,sp.b_id = #{newBId} ,sp.store_photo_type_cd = #{storePhotoTypeCd} ,sp.photo = #{photo} where 1=1 and sp.b_id = #{bId} and sp.store_id = #{storeId} and sp.store_photo_id = #{storePhotoId} update s_store_cerdentials sc set sc.status_cd = #{statusCd} ,sc.b_id = #{newBId} ,sc.credentials_cd = #{credentialsCd} ,sc.value = #{value} ,sc.validity_period = #{validityPeriod} ,sc.positive_photo = #{positivePhoto} ,sc.negative_photo = #{negativePhoto} where 1=1 and sc.b_id = #{bId} and sc.store_id = #{storeId} and sc.store_cerdentials_id = #{storeCerdentialsId} insert into business_member_store(member_store_id,b_id,store_id,member_id,month,operate) values(#{memberStoreId},#{bId},#{storeId},#{memberId},#{month},#{operate}) insert into s_member_store(member_store_id,b_id,store_id,member_id,status_cd) select ms.member_store_id,ms.b_id,ms.store_id,ms.member_id,'0' from business_member_store ms where ms.operate = 'ADD' and ms.b_id=#{bId} update s_member_store ms set ms.status_cd = #{statusCd} ,ms.b_id = #{newBId} where 1=1 and ms.b_id = #{bId} and ms.member_store_id = #{memberStoreId} insert into business_store_user(store_user_id,b_id,store_id,user_id,rel_cd,month,operate) values(#{storeUserId},#{bId},#{storeId},#{userId},#{relCd},#{month},#{operate}) insert into s_store_user(store_user_id,b_id,store_id,user_id,rel_cd,status_cd) select sc.store_user_id,sc.b_id,sc.store_id,sc.user_id,sc.rel_cd,'0' from business_store_user sc where sc.operate = 'ADD' and sc.b_id=#{bId} update s_store_user sc set sc.status_cd = #{statusCd} ,sc.b_id = #{newBId} ,sc.rel_cd = #{relCd} where 1=1 and sc.b_id = #{bId} and sc.store_id = #{storeId} and sc.store_user_id = #{storeUserId}