当前位置:网站首页>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();
}
}
边栏推荐
- 【数字IC验证快速入门】14、SystemVerilog学习之基本语法1(数组、队列、结构体、枚举、字符串...内含实践练习)
- Explore dry goods! Apifox construction ideas
- 追风赶月莫停留,平芜尽处是春山
- 2022年全国最新消防设施操作员(初级消防设施操作员)模拟题及答案
- Relevant data of current limiting
- 【数字IC验证快速入门】10、Verilog RTL设计必会的FIFO
- ZCMU--1492: Problem D(C语言)
- Linux server development, SQL statements, indexes, views, stored procedures, triggers
- 复杂网络建模(三)
- C语言二叉树与建堆
猜你喜欢
Record a stroke skin bone error of the skirt
Li Kou interview question 04.01 Path between nodes
Complex network modeling (I)
Most elements
Shell 脚本的替换功能实现
Numbers that appear only once
Quickly use Jacobo code coverage statistics
电池、电机技术受到很大关注,反而电控技术却很少被提及?
JS quick start (I)
Force buckle 145 Binary Tree Postorder Traversal
随机推荐
2022制冷与空调设备运行操作复训题库及答案
探索干货篇!Apifox 建设思路
Topic not received? Try this
padavan手动安装php
uniapp 移动端强制更新功能
[UVM basics] summary of important knowledge points of "UVM practice" (continuous update...)
Ansible
buureservewp(2)
Recursive construction of maximum binary tree
Es FAQ summary
The charm of SQL optimization! From 30248s to 0.001s
Binary tree and heap building in C language
C language communication travel card background system
Network learning (I) -- basic model learning
【数字IC验证快速入门】14、SystemVerilog学习之基本语法1(数组、队列、结构体、枚举、字符串...内含实践练习)
Linux Installation MySQL 8.0 configuration
Jmeter 的使用
贝叶斯定律
[UVM foundation] what is transaction
Linux server development, redis source code storage principle and data model