1.主键生成策略
mybatis插件 @Id @GeneratedValue(strategy = GenerationType.IDENTITY) 自动递增
mybatisplus @TableId(type = IdType.AUTO)
@TableField(exist = false,select = false) 表示该字段在数据库中不存在,表示不查询该字段。
mybatisplus设置主键生成策略为雪花算法
mybatis-plus:
global-config:
db-config:
id-type: ASSIGN_ID