当前位置:网站首页>Querywrapper in mybaits plus
Querywrapper in mybaits plus
2022-06-30 14:33:00 【tutou_ girl】
One 、queryWrapper What is it?
queryWrapper yes mybatis plus The object encapsulation operation class that implements query in , His hierarchy is as follows

In the picture above ,
Wrapper : Conditionally construct abstract classes , Top parent class , Provided in an abstract class 4 There are two ways to display the source code
AbstractWrapper : Used to encapsulate query conditions , Generate sql Of where Conditions
AbstractLambdaWrapper : Lambda Grammar use Wrapper Unified processing and parsing lambda obtain column.
LambdaQueryWrapper : You can see that the name is used for Lambda Query used by syntax Wrapper
LambdaUpdateWrapper : Lambda Update package Wrapper
QueryWrapper : Entity Object encapsulates the operation class , Not with lambda grammar
UpdateWrapper : Update Conditional encapsulation , be used for Entity Object update operation
Two 、 Use demo
@PostMapping("/login")
public Result login(@Validated @RequestBody JSONObject jsonObject, HttpServletResponse response) {
User us = jsonObject.toJavaObject(User.class);
QueryWrapper<User> queryWrapper = new QueryWrapper<>();
queryWrapper.eq("username",us.getUsername()).eq("password",us.getPassword());
User user = userService.getOne(queryWrapper);
Assert.notNull(user, " The user doesn't exist ");
Query the database for a person whose user name and password match those passed in , And encapsulate the results as user
3、 ... and 、QueryWrapper Methods 
Four 、 summary
The blog content above is simple , Only one query function is shown . When you actually use it , May, in accordance with the The methods contained above the condition constructor , Set the conditions for you to query the data , call BaseMapper The corresponding method in
边栏推荐
- 深入理解.Net中的线程同步之构造模式(二)内核模式4.内核模式构造物的总结
- "As a service", the inevitable choice of enterprise digital transformation
- 我想问一下招商证券怎么开户?通过链接办理股票开户安全吗
- An error is reported when installing dataspherestudio doc: invalid default value for 'update_ time‘
- Realize a simple LAN communication (similar to feiqiu)
- What network security problems are exposed when a large-scale QQ number theft event occurs?
- Initial attack and defense world Misc
- 數據恢複軟件EasyRecovery15下載
- Lfi-rce without controllable documents
- Chapter 13 signal (III) - example demonstration
猜你喜欢

"Persistent diseases" that cannot be solved in IM application development

On simple code crawling Youdao translation_ 0's problem (to be solved)

Google Earth engine (GEE) -- converts string to number and applies it to time search (ee.date.fromymd)

Summary of use of laravel DCAT admin

How to use Alibaba Vector Icon

ctfshow nodejs

The first dark spring cup dnuictf

Not satisfied with markdown native code block style? Try this beautify code screenshot tool~~

【BUUCTF】 Have Fun

Why does the folder appear open in another program
随机推荐
ctfshow nodejs
Attack and defense world web questions
LeetCode_ Stack_ Medium_ 227. basic calculator II (without brackets)
V3 03_ Getting started
Race of golang
Jetpack compose for perfect screen fit
On simple code crawling Youdao translation_ 0's problem (to be solved)
The first dark spring cup dnuictf
【 scientific literature measurement 】 mining and visualization of keywords in foreign and Chinese Literature
想請教一下,我在佛山,到哪裏開戶比較好?手機開戶是安全麼?
How to use Alibaba Vector Icon
想请教一下,我在佛山,到哪里开户比较好?手机开户是安全么?
深入理解.Net中的线程同步之构造模式(二)内核模式3.内核模式构造物Mutex
When SQL queries are performed in table storage, an error is reported when the primary key is added to the query result, and the query result exceeds 10W rows. Do you want to add multiple indexes to t
JS array
Pit used by go language array type
For loop and promise to solve the problem of concurrent callback
DB2 SQL Error: SQLCODE=-206, SQLSTATE=42703
Use of laravel repository mode
QQ was stolen? The reason is
