当前位置:网站首页>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();
}
}
边栏推荐
- Introduction to basic components of wechat applet
- 有 Docker 谁还在自己本地安装 Mysql ?
- Lattice coloring - matrix fast power optimized shape pressure DP
- Cnopendata list data of Chinese colleges and Universities
- Cnopendata American Golden Globe Award winning data
- 【无标题】
- 2022制冷与空调设备运行操作复训题库及答案
- Linux server development, SQL statements, indexes, views, stored procedures, triggers
- Linux server development, MySQL cache strategy
- 【数字IC验证快速入门】11、Verilog TestBench(VTB)入门
猜你喜欢

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

Es FAQ summary

Leetcode 90: subset II

2022年全国最新消防设施操作员(初级消防设施操作员)模拟题及答案

调用 pytorch API完成线性回归

Quickly use Jacobo code coverage statistics

LeetCode简单题之判断一个数的数字计数是否等于数位的值

Complex network modeling (I)

These five fishing artifacts are too hot! Programmer: I know, delete it quickly!

2022年茶艺师(中级)考试试题及模拟考试
随机推荐
Relevant data of current limiting
复杂网络建模(一)
C language flight booking system
Minimum absolute difference of binary search tree (use medium order traversal as an ordered array)
[VHDL parallel statement execution]
Recursive method to verify whether a tree is a binary search tree (BST)
Leetcode 90: subset II
Zsh shell adds automatic completion and syntax highlighting
Merging binary trees by recursion
Empire CMS collection Empire template program general
央视太暖心了,手把手教你写HR最喜欢的简历
JS quick start (I)
追风赶月莫停留,平芜尽处是春山
Notes on PHP penetration test topics
LeetCode简单题之找到一个数字的 K 美丽值
[Matlab] Simulink 自定义函数中的矩阵乘法工作不正常时可以使用模块库中的矩阵乘法模块代替
力扣(LeetCode)187. 重复的DNA序列(2022.07.06)
Linux server development, detailed explanation of redis related commands and their principles
Custom class loader loads network class
The charm of SQL optimization! From 30248s to 0.001s