当前位置:网站首页>Setsql function and risk of using lamdbaupdatewrapper
Setsql function and risk of using lamdbaupdatewrapper
2022-06-28 14:44:00 【Hua Weiyun】
title: Use LamdbaUpdateWrapper Of setSql Role and risk
date: 2022-04-12 18:10:34
tags: java
Problem introduction
Think about it first : We need to update a piece of data in the database , And want to modify a field based on the original , What shall we do ?
Under normal circumstances , We need to find out before updating , But I just want to update it directly , Then you need to Mapper Write in sql, It's hard for a field , Use in this case LamdbaUpdateWrapper Of setSql() The method can .
// hold num Field plus 5LambdaUpdateWrapper<User> updateWrapper = Wrappers.<User>lambdaUpdate() .eq(User::getId, userId) .setSql("count = count + 5");userService.update(updateWrapper);BUT, In this way, there may be risks , Mainly for testing mybatis-plus, Whether to take preventive measures , After testing , did not .
For example, use the most common sleep(), Add this part to sql In the paragraph + sleep(5)
LambdaUpdateWrapper<User> updateWrapper = Wrappers.<User>lambdaUpdate() .eq(User::getId, userId) .setSql("count = count + 5 + sleep(5)");
But then again , This is what developers can access , Just to prove mybatis-plus It did not setSql() To filter , It's a direct way to spell it up .
Daily words

The above is the use of LamdbaUpdateWrapper Of setSql Full contents of functions and risks
Copyright notice :
Original Blogger : Cowherd Conan
Personal blog links :https://www.keafmd.top/
If it helps you , Thank you for clicking on == One key, three links == Support !
[ ha-ha ][ Huai Quan ]

come on. !
Joint efforts !
Keafmd
You can see it here , You know the following , Let's make progress together !
边栏推荐
- Opening and closing principle
- Four methods of thread termination
- Angers medical sprint scientific innovation board: annual revenue of RMB 300million and proposed fund raising of RMB 770million
- Technical trendsetter
- IonQ联合GE Research证实:量子计算在风险聚合上有巨大潜力
- 干货 | 科研人的KPI怎么算,H指数和G指数是什么
- [collection of excellent articles on Digital IC] nearly 500 articles | learning route | basic knowledge | interface | bus | scripting language | chip job search | security | EDA | tools | low power de
- Flutter series: offstage in flutter
- 安杰思医学冲刺科创板:年营收3亿 拟募资7.7亿
- @Controlleradvice + @exceptionhandler handles controller layer exceptions globally
猜你喜欢

基于 Nebula Graph 构建百亿关系知识图谱实践

快手投资电商服务商易心优选

Only four breakthrough Lenovo smart Summer Palace in mainland China won the "IDC Asia Pacific Smart City Award in 2022"

dolphinscheduler2.X的安装(亲测有效)

Mulan open work license 1.0 open to the public for comments
![[Zhongyi Xinsheng] 5 SPI interface test TF Card](/img/d9/56ded362b3055f4f0efc3ce0eec5d5.jpg)
[Zhongyi Xinsheng] 5 SPI interface test TF Card

【中移芯昇】5. spi接口测试tf卡

Q-Tester 3.2:适用于开发、生产和售后的诊断测试软件

Angers medical sprint scientific innovation board: annual revenue of RMB 300million and proposed fund raising of RMB 770million

2022下半年软考考试时间安排已确定!
随机推荐
Recommendation letter brain correspondent: if love is just a chemical reaction, can you still believe in love?
Leetcode (88) -- merge two ordered arrays
[MySQL learning notes 23] index optimization
【mysql学习笔记24】索引设计原则
Leetcode(406)——根据身高重建队列
力扣解法汇总522-最长特殊序列 II
Technical trendsetter
华泰证券开户有什么后果 怎么办理开户最安全
3. Caller 服务调用 - dapr
ArcGIS vector center point generates rectangle and cuts TIF image for deep learning sample training
猫狗图像数据集上的深度学习模型性能对比
2022 questions d'examen pour les cuisiniers chinois (Senior) et l'examen de simulation en ligne
基于ASP的勤工俭学管理系统
优巨新材冲刺深交所:拟募资6.5亿 年营收3.33亿
Who is the main body of the waiting insurance record? Record in the local network security, right?
使用LamdbaUpdateWrapper的setSql作用及风险
Reading notes of Mr. toad going to see a psychologist
Based on asp Net based document retrieval system
证券公司和银行哪个更安全 怎么办理开户最安全
2022年最新PyCharm激活破解码永久_详细安装教程(适用多版本)