Examples of new MyBatis-plus, starting from large primary key ID number

mybatis-plus is an enhanced version of mybatis, save a lot of writing DAO layer code and database manipulation statements with mybatis-plus. But we need to configure conditions.

scene:

  To a new database instance, we want to call insert (T t) method; add bulk to the database instance, we call inserBatch (List <T> list) method.

Of course, these are mybatis-plus already good package, we direct use, DAO layer code and xml files do not have to write your own. However, our new database instance, the primary key ID are generally self-growth, without artificial assigned to it.

So mybatis-plus in added time, there will be the primary key ID from a very large number beginning (example '17629802347414'), rather than from the beginning of. The reason is that, mybatis-plus in added time, will give a primary key ID,

And this number is not standardized, not continuous. This time we need to ignore this, we do not need to mybatis-plus ID.

Configuration Bean Object:

 

 ID attribute to the primary key, add a Type, set to automatic, so mybatis-plus will ignore the primary key and instead use your own database growth model.

Guess you like

Origin www.cnblogs.com/fengyuduke/p/11751750.html