Mybatis-Plus query

Mybatis-Plus

How to write Mybatis-Plus conditional query

1. Condition query

Just use new QueryQuery<> to create the object, and then wrappee.eq("database list", "matching value") to create the condition.
Among them, basic query : eq means equal; gt means greater than; lt means less than; ne is not equal; ge is greater than or equal to; le
is less than or equal to; between ; like % value; likeRight
sorting : orderBy; OrderByAsc; OrderByDesc
Logical query : or; and
specified query field : select

Special example:

insert image description here

For paging conditional query , if you directly write eq, you need to make a judgment, and the conditional query can only be performed if the judgment condition is not empty; so if you want to
use allEq, you only need to set the parameter to false, and if the condition is empty, splicing will not be performed, but this method The disadvantage is that all the conditions are AND, not OR,
so the multi-condition query of pagination cannot be used. The conditions are different, but it is not suitable here.
When the condition is empty, the query statement is as follows:
insert image description here
when there is a condition, the query statement is as follows:
insert image description here

Multi-condition AND query: allEq()

insert image description here

Guess you like

Origin blog.csdn.net/weixin_45757641/article/details/131487087