mybatis獲取insert之後數據庫自動生成的id

需求:使用MyBatis往MySQL數據庫中插入一條記錄後,需要返回該條記錄的自增主鍵值。 方法:在mapper中指定keyProperty屬性,示例如下: IUserDao.xml <!--保存用戶--> <insert id="saveUser" useGeneratedKeys="true" keyProperty="id" parameterType="com.itheima.d
相關文章
相關標籤/搜索