mybatis添加数据时返回主键 insert 返回主键值
insert 返回主键值
useGeneratedKeys=“true” parameterType=“USer” keyProperty=“id”,
<insert id="insert" useGeneratedKeys="true" parameterType=“Car” keyProperty="car.id">
INSERT INTO car(customer_id,car_no,car_brand_model,insurance_expire_date,last_year_insurance_company,new_car,business_type,frame_no,engine_no,annul_survey_expire,
output_volume,use_type,car_type,seating,reg_date,created_id,created_time,driving_license,driving_license_copy,yearly_inspection,is_del, ton, issue_date, user_id)
VALUES (#{car.customerId},#{car.carNo},#{car.carBrandModel},#{car.insuranceExpireDate},#{car.lastYearInsuranceCompany},#{car.newCar},
#{car.businessType},#{car.frameNo},#{car.engineNo},#{car.annulSurveyExpire},#{car.outputVolume},#{car.useType},#{car.carType},
#{car.seating},#{car.regDate},#{car.createdId},now(),#{car.drivingLicense},#{car.drivingLicenseCopy},#{car.yearlyInspection},0, #{car.ton}, #{car.issueDate}, #{car.userId})
</insert>