INSERT语句之后返回主键id xml直接添加 <insert id="insert" keyProperty="id" useGeneratedKeys="true"> insert into table (user,create_time) values (#{user},#{createTime}) </insert> 在insert 标签上直接添加 keyProperty=“id” useGeneratedKeys=“true”