- <insert id="insert" parameterType="Mail" useGeneratedKeys="true" keyProperty="id_note">
- insert into note(sender, from_address, subject, content, send_time)
- values(#{sender}, #{fromAddress}, #{subject}, #{content}, #{sendTime})
- <selectKey keyProperty="id_mail" resultType="int">
- select LAST_INSERT_ID()
- </selectKey>
- </insert>
-
- <!--这里可以获得刚插入表格的id,为后面attachment的插入提供了mailId字段-->
- <select id="selectLastId" resultType="int">
- select LAST_INSERT_ID()
- </select>
-