1、在实体映射类里更改相关注解即可 @Data @TableName(value = "id",value="yz_pushlog") public class Pushlog { @TableId(type = IdType.AUTO) private long id; } 2、在mapper层调用完insert方法后,直接entity.getId()即可