1. When I was adding, I had no chance to report to me innocently.
java.sql.SQLException: Field 'id' doesn't have a default value
Later, I learned that using the insert method of mybatis-plus, a Long-type UUID will be generated by default at the bottom layer, which leads to inconsistency with the type in the database and leads to errors. The first thing we need to do is to disable the default self-incrementing primary key.
The primary key generation method type is as follows (IdType):
AUTO(0, "Database ID auto increment"), INPUT(1, "User input ID"), ID_WORKER(2, "Global Unique ID"), UUID(3, "Global Unique ID"), NONE(4, "This type is not a primary key type"), ID_WORKER_STR(5, "String globally unique ID");
We can set how the primary key is generated
@TableId(value = "id",type = IdType.INPUT) This way is to manually enter the primary key
After completing the above operations, go to add and you're done~
{{o.name}}
{{m.name}}