mybatis-plus-boot-starter 复合主键
时间: 2023-09-14 21:13:06 浏览: 156
mybatis-plus-boot-starter-3.1.0.jar
在mybatis-plus-boot-starter中,复合主键的配置方式如下所示:[3]
在实体类中,使用@MppMultiId注解来标注复合主键的字段。例如:
```java
@TableName("etl_job")
public class Job implements Serializable {
private static final long serialVersionUID = 1L;
@MppMultiId // 复合主键
private String etlSystem;
@MppMultiId // 复合主键
private String etlJob;
// 其他属性和方法
}
```
在上述例子中,Job类使用@MppMultiId注解标注了etlSystem和etlJob两个字段作为复合主键。这样配置后,mybatis-plus会根据这两个字段来确定唯一的记录。<span class="em">1</span><span class="em">2</span><span class="em">3</span>
#### 引用[.reference_title]
- *1* [mybatis-plus-boot-starter-3.1.0-API文档-中文版.zip](https://download.csdn.net/download/qq_36462452/86109760)[target="_blank" data-report-click={"spm":"1018.2226.3001.9630","extra":{"utm_source":"vip_chatgpt_common_search_pc_result","utm_medium":"distribute.pc_search_result.none-task-cask-2~all~insert_cask~default-1-null.142^v93^chatsearchT3_2"}}] [.reference_item style="max-width: 50%"]
- *2* *3* [mybatis-plus复合主键的使用](https://blog.csdn.net/embelfe_segge/article/details/123350129)[target="_blank" data-report-click={"spm":"1018.2226.3001.9630","extra":{"utm_source":"vip_chatgpt_common_search_pc_result","utm_medium":"distribute.pc_search_result.none-task-cask-2~all~insert_cask~default-1-null.142^v93^chatsearchT3_2"}}] [.reference_item style="max-width: 50%"]
[ .reference_list ]
阅读全文