insert into business_small_wechat_attr(
attr_id,operate,wechat_id,spec_cd,b_id,community_id,value
) values (
#{attrId},#{operate},#{wechatId},#{specCd},#{bId},#{communityId},#{value}
)
insert into small_wechat_attr(
attr_id,wechat_id,spec_cd,status_cd,b_id,community_id,value
) select t.attr_id,t.wechat_id,t.spec_cd,'0',t.b_id,t.community_id,t.value from business_small_wechat_attr t
where 1=1
and t.attr_id= #{attrId}
and t.operate= 'ADD'
and t.wechat_id= #{wechatId}
and t.spec_cd= #{specCd}
and t.b_id= #{bId}
and t.community_id= #{communityId}
and t.value= #{value}
update small_wechat_attr t set t.status_cd = #{statusCd}
,t.b_id = #{newBId}
, t.wechat_id= #{wechatId}
, t.spec_cd= #{specCd}
, t.community_id= #{communityId}
, t.value= #{value}
where 1=1
and t.attr_id= #{attrId}
and t.b_id= #{bId}