Get the id of last inserted record in mybatis
问题 I am newbie to mybatis. I am trying to get the id of last inserted record. My database is mysql and my mapper xml is <insert id="insertSelective" parameterType="com.mycom.myproject.db.mybatis.model.FileAttachment" > <selectKey resultType="java.lang.Long" keyProperty="id" order="AFTER" > SELECT LAST_INSERT_ID() as id </selectKey> insert into fileAttachment <trim prefix="(" suffix=")" suffixOverrides="," > <if test="name != null" > name, </if> <if test="attachmentFileSize != null" > size, </if>