Annotations
Annotations
MyBatis-Plus infers table information based on the PO (Persistent Object) entity details to generate SQL. By default:
- MyBatis-Plus converts the PO entity class name from camelCase to snake_case for the table name.
- MyBatis-Plus converts all variable names in the PO entity from camelCase to snake_case for the column names, and infers the column types from the variable types.
- MyBatis-Plus treats a field named
id
as the primary key. However, the default implementation often does not match actual scenarios, so MyBatis-Plus provides several annotations to facilitate the declaration of table information. Annotations: https://baomidou.com/reference/annotation/ Key annotations: @TableName, @TableId, @TableField
November 30, 2024About 3 min