<> be careful : This method is only applicable to MySQL and SQLServer database

<> Using properties useGeneratedKeys and keyProperty

useGeneratedKeys(true/false): Set whether to use JDBC Of getGenereatedKeys Method to get the primary key and assign it to keyProperty Set the domain model properties
* keyProperty : fill in java The field name of the object
<> Using examples

<insert id="addUser" parameterType="xxx.xxx.model.xx" useGeneratedKeys="true"
keyProperty="id"> insert into user(username, name, password) values
(#{item.username}, #{item.name}, #{item.password})</insert>
public void addUser(User user) { systemMapper.addUser(user); user.getId(); }
<>user.getId() Cannot get the latest primary key id

inspect dao Is the layer interface used @Param annotation
for example :
void addUser(@Param("item") User user);
So change it mapper.xml
<insert id="addUser" parameterType="xxx.xx.xx" useGeneratedKeys="true"
keyProperty="item.id"> insert into user(username, name, password) values
(#{item.username}, #{item.name}, #{item.password})</insert>

©2020 ioDraw All rights reserved
synchronized Fair lock or unfair lock R language | Processing method of missing value —— multiple imputation : utilize mice() package @ControllerAdvice Intercept abnormal return data GitHub HR supervisor resigns due to dismissal of Jewish employee python Basic exercises ( One )Can not deserialize instance of java.util.ArrayList out of VALUE_TRUE tokenpytorch torchvision.transforms.Normalize() In mean and std parameter --- Dispelling doubts NVIDIA-SMI has failed because it couldn’t communicate with the NVIDIA driver. First order low pass filter - Continuous to discrete Sources said Alibaba will cancel “361” system No coercion 10% No year-end bonus for employees