insert into business_owner_car(
car_color,car_brand,car_type,operate,car_num,ps_id,remark,owner_id,b_id,user_id,car_id,community_id
) values (
#{carColor},#{carBrand},#{carType},#{operate},#{carNum},#{psId},#{remark},#{ownerId},#{bId},#{userId},#{carId},#{communityId}
)
insert into owner_car(
car_color,car_brand,car_type,car_num,ps_id,remark,status_cd,owner_id,b_id,user_id,car_id,community_id
) select t.car_color,t.car_brand,t.car_type,t.car_num,t.ps_id,t.remark,'0',t.owner_id,t.b_id,t.user_id,t.car_id,t.community_id
from business_owner_car t where 1=1
and t.car_color= #{carColor}
and t.car_brand= #{carBrand}
and t.car_type= #{carType}
and t.operate= 'ADD'
and t.car_num= #{carNum}
and t.ps_id= #{psId}
and t.remark= #{remark}
and t.owner_id= #{ownerId}
and t.b_id= #{bId}
and t.user_id= #{userId}
and t.car_id= #{carId}
and t.community_id= #{communityId}
update owner_car t set t.status_cd = #{statusCd}
,t.b_id = #{newBId}
, t.car_color= #{carColor}
, t.car_brand= #{carBrand}
, t.car_type= #{carType}
, t.car_num= #{carNum}
, t.ps_id= #{psId}
, t.remark= #{remark}
, t.owner_id= #{ownerId}
, t.user_id= #{userId}
where 1=1
and t.b_id= #{bId}
and t.car_id= #{carId}
and t.community_id= #{communityId}