In MyBatis Plus, you can use the lambdaQuery method to create a query with lambda expressions. To perform a between query using lambdaQuery, you can use the between method.

Here's an example:

List<User> userList = lambdaQuery()
    .between(User::getAge, 20, 30)
    .list();

In the above example, User is the entity class, getAge is the getter method for the age field, and 20 and 30 are the lower and upper bounds for the age range.

This will generate a SQL query similar to:

SELECT * FROM user WHERE age BETWEEN 20 AND 30;

You can further chain other query methods like eq, like, etc., to add more conditions to your query

mybatisplus lambdaQuery between

原文地址: https://www.cveoy.top/t/topic/hPtF 著作权归作者所有。请勿转载和采集!

免费AI点我,无需注册和登录