当前位置:网站首页>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();
}
}
边栏推荐
- Record a stroke skin bone error of the skirt
- Roulette chart 2 - writing of roulette chart code
- 追风赶月莫停留,平芜尽处是春山
- Minimum absolute difference of binary search tree (use medium order traversal as an ordered array)
- C语言二叉树与建堆
- 青龙面板--整理能用脚本
- 积分商城管理系统中应包含的四大项
- jeeSite 表单页面的Excel 导入功能
- [UVM practice] Chapter 1: configuring the UVM environment (taking VCs as an example), run through the examples in the book
- Pytorch(六) —— 模型调优tricks
猜你喜欢
QT learning 28 toolbar in the main window
[quick start of Digital IC Verification] 15. Basic syntax of SystemVerilog learning 2 (operators, type conversion, loops, task/function... Including practical exercises)
Linux server development, redis source code storage principle and data model
运放电路的反馈电阻上并联一个电容是什么作用
Custom class loader loads network class
快解析内网穿透为文档加密行业保驾护航
LeetCode中等题之我的日程安排表 I
2022年全国最新消防设施操作员(初级消防设施操作员)模拟题及答案
王爽 《汇编语言》之寄存器
【数字IC验证快速入门】13、SystemVerilog interface 和 program 学习
随机推荐
B. Value sequence thinking
json 数据展平pd.json_normalize
Complex network modeling (I)
Es FAQ summary
Téléchargement des données de conception des puces
微信小程序基本组件使用介绍
Summary of redis functions
Pytorch(六) —— 模型调优tricks
快解析内网穿透助力外贸管理行业应对多种挑战
dash plotly
Linux server development, SQL statements, indexes, views, stored procedures, triggers
[UVM practice] Chapter 1: configuring the UVM environment (taking VCs as an example), run through the examples in the book
buureservewp(2)
Recursive method to construct binary tree from preorder and inorder traversal sequence
Force buckle 144 Preorder traversal of binary tree
2022 Inner Mongolia latest advanced fire facility operator simulation examination question bank and answers
The zblog plug-in supports the plug-in pushed by Baidu Sogou 360
2022年茶艺师(中级)考试试题及模拟考试
Linux server development, redis protocol and asynchronous mode
青龙面板--花花阅读