当前位置:网站首页>Myabtis_ Plus
Myabtis_ Plus
2022-07-07 08:08:00 【Stay a little】
One . Auto fill
- preparation Add new fields create_time,update_time.
- Add annotations to the fields that need to be automatically filled in the entity class
@TableField(fill = FieldFill.INSERT)
private Date createTime;
@TableFileld(fill = FileldFill.INSERT_UPDATE)
private Date uodateTime;
Optimism lock
What is an optimistic lock :
Is a solution to a problem :
Missing update problem . Zhang San , Li Si changed his salary at the same time . Zhang San changed his salary to 9000, The normal situation should be general Li Si 9000 Change your salary to 100, Rather than 5000 Change it to 100.
add to version Version number . The version number changes after the update . If another person's version number is inconsistent, he cannot submit .
Add fields to the table version
Add... To the entity class attribute @Version annotation
@Version
private Integer version;
- Register optimistic lock plugin
stay MybatisPlusConfig Register in Bean
@Configuration
@MapperScan("com.janson.mybatis_plus.mapper")
public class MybatisPlusConfig {
/** * Optimistic lock plug-in **/
@Bean
public OptimisticLockerInterceptor optimisticLockerInterceptor() {
return new OptimisticLockerInterceptor();
}
}
边栏推荐
- Bugku CTF daily one question chessboard with only black chess
- 太真实了,原来自己一直没有富裕起来是有原因的
- 【数字IC验证快速入门】17、SystemVerilog学习之基本语法4(随机化Randomization)
- Es FAQ summary
- Implementation of replacement function of shell script
- 【数字IC验证快速入门】11、Verilog TestBench(VTB)入门
- Complex network modeling (I)
- 复杂网络建模(二)
- 2022 tea master (intermediate) examination questions and mock examination
- 追风赶月莫停留,平芜尽处是春山
猜你喜欢

Cnopendata American Golden Globe Award winning data

电池、电机技术受到很大关注,反而电控技术却很少被提及?

Myabtis_Plus

MySQL multi column index (composite index) features and usage scenarios

【數字IC驗證快速入門】15、SystemVerilog學習之基本語法2(操作符、類型轉換、循環、Task/Function...內含實踐練習)

Li Kou interview question 04.01 Path between nodes

【踩坑系列】uniapp之h5 跨域的问题

数据库实时同步利器——CDC(变化数据捕获技术)

game攻防世界逆向

Network learning (III) -- highly concurrent socket programming (epoll)
随机推荐
Implementation of replacement function of shell script
2022年茶艺师(中级)考试试题及模拟考试
Network learning (I) -- basic model learning
2022 welder (elementary) judgment questions and online simulation examination
MySQL multi column index (composite index) features and usage scenarios
Recursive method constructs binary tree from middle order and post order traversal sequence
Leetcode 40: combined sum II
贝叶斯定律
2022 recurrent training question bank and answers of refrigeration and air conditioning equipment operation
【数字IC验证快速入门】11、Verilog TestBench(VTB)入门
Complex network modeling (III)
OpenJudge NOI 2.1 1752:鸡兔同笼
微信小程序基本组件使用介绍
【无标题】
LeetCode简单题之字符串中最大的 3 位相同数字
[quick start of Digital IC Verification] 15. Basic syntax of SystemVerilog learning 2 (operators, type conversion, loops, task/function... Including practical exercises)
青龙面板-今日头条
Leetcode 90: subset II
Few shot Learning & meta learning: small sample learning principle and Siamese network structure (I)
DNS server configuration