Database auto-increment strategy

Set the auto-increment strategy of the database. By default, MP uses the ID set by the snowflake algorithm. But if you want to use the auto-increment of the database, you need to set this algorithm.

mybatis-plus:
  global-config:
    db-config:
      id-type: auto

PS: Looking at some videos on the Internet, it is enough to set the database ID field to increase automatically, but I can't do it, so I chose this method.

Sometimes an error message may appear - the primary key cannot be found . At this time, just delete the data in the database and add it again.

Guess you like

Origin blog.csdn.net/qq_43374694/article/details/126053582