当前位置:网站首页>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 !
边栏推荐
- Seata数据库中出现以下问题要怎么解决啊?
- 哪个证券公司最大最安全 怎么办理开户最安全
- Softing epGate PB系列网关-可将PROFIBUS总线集成到EtherNet/IP网络
- Validate palindrome string
- 2022 operation of simulation test platform for 100 simulated questions of main principals of metal and nonmetal mines (underground mines)
- 法兰克福地区目前支持sql了吗?
- 中国内地仅四家突围 联想智慧颐和园荣获 “2022年IDC亚太区智慧城市大奖”
- Rails advanced -- framework theory cognition and construction scheme construction (I)
- Navicat premium 16 permanent crack activation tool and installation tutorial (available for personal test)
- vector详解+题目
猜你喜欢

安杰思医学冲刺科创板:年营收3亿 拟募资7.7亿

Youju new material rushes to Shenzhen Stock Exchange: it plans to raise 650million yuan, with an annual revenue of 333million yuan

Softing epgate Pb series Gateway - integrates the Profibus bus into the ethernet/ip network

Softing epGate PB系列网关-可将PROFIBUS总线集成到EtherNet/IP网络

Kwai investment e-commerce service provider Yixin optimization

基于asp.net的文献检索系统

老板嘱咐了三遍:低调、低调、低调

物联网低代码平台常用《组件介绍》

【空间&单细胞组学】第1期:单细胞结合空间转录组研究PDAC肿瘤微环境

老板囑咐了三遍:低調、低調、低調
随机推荐
华泰证券开户有什么后果 怎么办理开户最安全
老板囑咐了三遍:低調、低調、低調
vscode编写markdown文件并生成pdf
Who is the main body of the waiting insurance record? Record in the local network security, right?
美因基因港交所上市:市值43亿港元 IPO被市场忽略
老板嘱咐了三遍:低调、低调、低调
324. 摆动排序 II : 不简单的构造题
只出现一次的数字(水了个简单题)
智联招聘基于 Nebula Graph 的推荐实践分享
Research and Simulation of chaotic digital image encryption technology based on MATLAB
技术弄潮儿
【中移芯昇】5. spi接口测试tf卡
seata-server 1.5.0 如何支持mysql8.0?
3. Caller 服务调用 - dapr
Foreign trade SEO Webmaster Tools
推荐四款可视化工具,解决 99% 的可视化大屏项目!
荐书丨《大脑通信员》:如果爱情只是化学反应,那还能相信爱情吗?
Leetcode(406)——根据身高重建队列
[Zhongyi Xinsheng] 5 SPI interface test TF Card
How to count dimensions of foreign trade E-mail Promotion