在insert的标签里加两个属性:useGeneratedKeys="true" keyProperty="patentId" ,这个keyProperty的patentId就是我们要返回的主键id 相关文章: