Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

How to use mybatis-plus compound primary key

2025-02-14 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >

Share

Shulou(Shulou.com)06/01 Report--

Editor to share with you how to use the mybatis-plus compound primary key. I hope you will get something after reading this article. Let's discuss it together.

1.mybatis-plus version

Com.github.jeffreyning mybatisplus-plus 1.5.1-RELEASE com.baomidou mybatis-plus-boot-starter 3.1.0 com.baomidou mybatis-plus-generator 3.1.0

two。 Entity class

@ TableName ("etl_job") public class Job implements Serializable {private static final long serialVersionUID=1L; @ MppMultiId / / compound primary key private String etlSystem; @ MppMultiId / / compound primary key private String etlJob;}

3.Mapper class and mapper.xml

Public interface JobMapper extends MppBaseMapper {}

4.Server and ServiceImpl

Public interface JobService extends IMppService {} @ Servicepublic class JobServiceImpl extends MppServiceImpl implements JobService {}

5. The next step is to formally apply the operations related to the compound primary key.

JobService.saveOrUpdateByMultiId (job)

6. To launch the compound primary key, remember to add @ EnableMPP to the startup class.

After reading this article, I believe you have a certain understanding of "how to use the mybatis-plus compound primary key". If you want to know more about it, welcome to follow the industry information channel. Thank you for your reading!

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Development

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report