After adding the @KeySequence annotation to the entity and adding type = IdType.INPUT to @TableId, the business custom primary key value can no longer be used.
@KeySequence @TableName("urge_weixi_apply_record") @ApiModel(value="UrgeWeixiApplyRecord实体", description="添加微信流水") public class UrgeWeixiApplyRecord implements Serializable { private static final long serialVersionUID = 1L; @ApiModelProperty(value = "ID") @TableId(value = "id", type = IdType.INPUT) private Long id;
}
to sum up:
1. @KeySequence and the setId(XXX) of the business primary key are mutually exclusive. If you want to use the business primary key, delete @KeySequence
If you use the primary key generated by the data, just use @KeySequence
2. @KeySequence type = IdType.INPUT has a higher priority than setId(XXX) to set the primary key