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, start_time,
end_time, state, car_type_cd, member_id)
values (#{carColor}, #{carBrand}, #{carType}, #{operate}, #{carNum}, #{psId}, #{remark}, #{ownerId}, #{bId},
#{userId}, #{carId}, #{communityId},
#{startTime}, #{endTime}, #{state}, #{carTypeCd}, #{memberId})
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,
start_time,end_time,state,car_type_cd,member_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,
t.start_time,t.end_time,t.state, t.car_type_cd,t.member_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.car_type_cd= #{carTypeCd}
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.member_id= #{memberId}
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.lease_type= #{leaseType}
, t.user_id= #{userId}
, t.start_time= #{startTime}
, t.end_time= #{endTime}
, t.state= #{state}
where 1=1
and t.b_id= #{bId}
and t.car_id= #{carId}
and t.member_id= #{memberId}
and t.community_id= #{communityId}
and t.car_type_cd= #{carTypeCd}