当前位置:网站首页>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();
}
}
边栏推荐
- Lattice coloring - matrix fast power optimized shape pressure DP
- Zsh shell adds automatic completion and syntax highlighting
- JSON data flattening pd json_ normalize
- Who has docker to install MySQL locally?
- Linux server development, MySQL stored procedures, functions and triggers
- Force buckle 145 Binary Tree Postorder Traversal
- Linux server development, detailed explanation of redis related commands and their principles
- 青龙面板--整理能用脚本
- Few shot Learning & meta learning: small sample learning principle and Siamese network structure (I)
- 积分商城管理系统中应包含的四大项
猜你喜欢
随机推荐
The zblog plug-in supports the plug-in pushed by Baidu Sogou 360
Téléchargement des données de conception des puces
2022 National latest fire-fighting facility operator (primary fire-fighting facility operator) simulation questions and answers
buureservewp(2)
JS quick start (I)
json 数据展平pd.json_normalize
船载雷达天线滑环的使用
[quick start of Digital IC Verification] 15. Basic syntax of SystemVerilog learning 2 (operators, type conversion, loops, task/function... Including practical exercises)
调用 pytorch API完成线性回归
JS复制图片到剪切板 读取剪切板
贝叶斯定律
Implementation of replacement function of shell script
互动送书-《Oracle DBA工作笔记》签名版
Thinkcmf6.0安装教程
Blob 對象介紹
Summary of redis functions
Find the mode in the binary search tree (use medium order traversal as an ordered array)
LeetCode简单题之判断一个数的数字计数是否等于数位的值
Chip information website Yite Chuangxin
【无标题】









