insert into business_building_room(
fee_coefficient,section,remark,user_id,room_id,layer,built_up_area,operate,room_num,unit_id,b_id,apartment,state,community_id,
room_type,room_sub_type,room_rent,room_area
) values (
#{feeCoefficient},#{section},#{remark},#{userId},#{roomId},#{layer},#{builtUpArea},#{operate},#{roomNum},#{unitId},#{bId},#{apartment},#{state},
#{communityId},#{roomType},#{roomSubType},#{roomRent},#{roomArea}
)
insert into building_room(
fee_coefficient,section,status_cd,remark,user_id,room_id,layer,built_up_area,room_num,unit_id,b_id,apartment,state,community_id,
room_type,room_sub_type,room_rent,room_area
) select
t.fee_coefficient,t.section,'0',t.remark,t.user_id,t.room_id,t.layer,t.built_up_area,t.room_num,t.unit_id,t.b_id,t.apartment,t.state,t.community_id,
t.room_type,t.room_sub_type,t.room_rent,t.room_area
from business_building_room t where 1=1
and t.fee_coefficient= #{feeCoefficient}
and t.section= #{section}
and t.remark= #{remark}
and t.room_id= #{roomId}
and t.layer= #{layer}
and t.built_up_area= #{builtUpArea}
and t.operate= 'ADD'
and t.room_num= #{roomNum}
and t.unit_id= #{unitId}
and t.b_id= #{bId}
and t.apartment= #{apartment}
and t.state= #{state}
and t.room_type= #{roomType}
and t.room_sub_type= #{roomSubType}
and t.community_id= #{communityId}
update building_room t set t.status_cd = #{statusCd}
,t.b_id = #{newBId}
, t.fee_coefficient= #{feeCoefficient}
, t.section= #{section}
, t.remark= #{remark}
, t.user_id= #{userId}
, t.layer= #{layer}
, t.built_up_area= #{builtUpArea}
, t.room_num= #{roomNum}
, t.unit_id= #{unitId}
, t.apartment= #{apartment}
, t.state= #{state}
, t.room_sub_type= #{roomSubType}
, t.room_rent= #{roomRent}
, t.room_area= #{roomArea}
where 1=1
and t.room_id= #{roomId}
and t.community_id= #{communityId}
and t.b_id= #{bId}