Mybatis, how to write an insert statement in the XML file, the one on the primary key of the insert statement, how to use in an SQL statement just add that since the increase of the value of the primary key?
is in the picture after it calls the add method to perform the first SQL statement, this statement will have a on the primary key, how to use the above article 2 insert statement again insert statement execution after get on the primary key value? I call like that is wrong, ask good intention person to help me
CodePudding user response:
An insert tag just write a SQL!
CodePudding user response:
You can use the SELECT LAST_INSERT_ID () find out the latest on the id
CodePudding user response:
Divided into two methods, the first method calls the first SQL access on the id to the second method performs, separated execution and execution are two SQL execution
CodePudding user response:
An insert can only write a SQL
Like this:
The SELECT LAST_INSERT_ID ()