insert into business_parking_space(
area,operate,type_cd,num,ps_id,remark,state,community_id,b_id,user_id
) values (
#{area},#{operate},#{typeCd},#{num},#{psId},#{remark},#{state},#{communityId},#{bId},#{userId}
)
insert into p_parking_space(
area,type_cd,num,ps_id,remark,status_cd,state,community_id,b_id,user_id
) select t.area,t.type_cd,t.num,t.ps_id,t.remark,'0',t.state,t.community_id,t.b_id,t.user_id from business_parking_space t where 1=1
and t.area= #{area}
and t.operate= 'ADD'
and t.type_cd= #{typeCd}
and t.num= #{num}
and t.ps_id= #{psId}
and t.remark= #{remark}
and t.state= #{state}
and t.community_id= #{communityId}
and t.b_id= #{bId}
and t.user_id= #{userId}
update p_parking_space t set t.status_cd = #{statusCd}
,t.b_id = #{newBId}
, t.area= #{area}
, t.type_cd= #{typeCd}
, t.num= #{num}
, t.remark= #{remark}
, t.state= #{state}
, t.community_id= #{communityId}
, t.user_id= #{userId}
where 1=1
and t.ps_id= #{psId}
and t.b_id= #{bId}