insert into business_community(community_id,b_id,name,address,city_code,nearby_landmarks,map_x,map_y,month,state,operate)
values(#{communityId},#{bId},#{name},#{address},#{cityCode},#{nearbyLandmarks},#{mapX},#{mapY},#{month},#{state},#{operate})
insert into business_community_attr(b_id,attr_id,community_id,spec_cd,value,month,operate)
values(#{bId},#{attrId},#{communityId},#{specCd},#{value},#{month},#{operate})
insert into business_community_photo(community_photo_id,b_id,community_id,community_photo_type_cd,photo,month,operate)
values(#{communityPhotoId},#{bId},#{communityId},#{communityPhotoTypeCd},#{photo},#{month},#{operate})
insert into s_community(community_id,b_id,name,address,city_code,nearby_landmarks,map_x,map_y,status_cd,state)
values(#{community_id},#{b_id},#{name},#{address},#{city_code},#{nearby_landmarks},#{map_x},#{map_y},'0',#{state})
insert into s_community_attr(b_id,attr_id,community_id,spec_cd,value,status_cd)
select sa.b_id,sa.attr_id,sa.community_id,sa.spec_cd,sa.value,'0'
from business_community_attr sa
where sa.operate = 'ADD' and sa.b_id=#{bId}
and sa.community_id = #{communityId}
insert into s_community_photo(community_photo_id,b_id,community_id,community_photo_type_cd,photo,status_cd)
select sp.community_photo_id,sp.b_id,sp.community_id,sp.community_photo_type_cd,sp.photo,'0'
from business_community_photo sp
where sp.operate = 'ADD' and sp.b_id=#{bId}
and sp.community_id = #{communityId}
update s_community s set s.status_cd = #{statusCd}
,s.b_id = #{newBId}
,s.name = #{name}
,s.address = #{address}
,s.city_code = #{cityCode}
,s.nearby_landmarks = #{nearbyLandmarks}
,s.map_x = #{mapX}
,s.map_y = #{mapY}
,s.state = #{state}
where 1=1
and s.b_id = #{bId}
and s.community_id = #{communityId}
update s_community_attr sa set sa.status_cd = #{statusCd}
,sa.b_id = #{newBId}
,sa.value = #{value}
where 1=1
and sa.b_id = #{bId}
and sa.community_id = #{communityId}
and sa.spec_cd = #{specCd}
and sa.attr_id = #{attrId}
update s_community_photo sp set sp.status_cd = #{statusCd}
,sp.b_id = #{newBId}
,sp.community_photo_type_cd = #{communityPhotoTypeCd}
,sp.photo = #{photo}
where 1=1
and sp.b_id = #{bId}
and sp.community_id = #{communityId}
and sp.community_photo_id = #{communityPhotoId}
insert into business_community_member(community_member_id,b_id,community_id,member_id,member_type_cd,month,operate,audit_status_cd)
values(#{communityMemberId},#{bId},#{communityId},#{memberId},#{memberTypeCd},#{month},#{operate},#{auditStatusCd})
insert into s_community_member(community_member_id,b_id,community_id,member_id,member_type_cd,status_cd,audit_status_cd)
select ms.community_member_id,ms.b_id,ms.community_id,ms.member_id,ms.member_type_cd,'0',ms.audit_status_cd
from business_community_member ms where
ms.operate = 'ADD' and ms.b_id=#{bId}
and ms.community_id = #{communityId}
update s_community_member ms set ms.status_cd = #{statusCd}
,ms.b_id = #{newBId}
,ms.audit_status_cd = #{auditStatusCd}
where 1=1
and ms.b_id = #{bId}
and ms.community_member_id = #{communityMemberId}