https://www.cnblogs.com/quan-coder/p/8728410.htmlhtml
注意要顯式設置主鍵,經過:java
@Options(useGeneratedKeys = true, keyProperty = "id")
將id設置爲主鍵返回。app
https://blog.csdn.net/suwu150/article/details/52896496oop
一個示例(Mapper中的代碼片斷):ui
@Insert("insert into tz_lawsuits " + "(credit_cooperative, change_date, admin, borrower, borrower_id, guarantee, litigation_principal, type, starting_end_date," + " lawyer, action_date, litigation_costs, attorney_fees, advance, verdict_id, implementation_date, award_id, takeback_agent_fee," + " takeback_litigation_costs, takeback_principal, outstanding_principal, responsible_person)" + " values" + "(#{credit_cooperative}, #{change_date}, #{admin}, #{borrower}, #{borrower_id}, #{guarantee}, #{litigation_principal}, #{type}, #{starting_end_date}," + " #{lawyer}, #{action_date}, #{litigation_costs}, #{attorney_fees}, #{advance}, #{verdict_id}, #{implementation_date}, #{award_id}, #{takeback_agent_fee}," + " #{takeback_litigation_costs}, #{takeback_principal}, #{outstanding_principal}, #{responsible_person})") @Options(useGeneratedKeys = true, keyProperty = "id") Integer insertTzLawsuitsObject(TzLawsuits tzLawsuits);