QueryWrapper.eq
时间: 2023-10-14 16:26:39 浏览: 105
mybatis-plus QueryWrapper自定义查询条件的实现
5星 · 资源好评率100%
QueryWrapper.eq is a method in the MyBatis Plus library for building SQL queries. It is used to add a condition to the query that checks if a column in the database table is equal to a specific value.
For example, consider the following code snippet:
```
QueryWrapper<User> wrapper = new QueryWrapper<>();
wrapper.eq("username", "john_doe");
List<User> users = userMapper.selectList(wrapper);
```
In this example, the QueryWrapper object is created and the "eq" method is used to add a condition to the query. The condition checks if the "username" column in the "User" table is equal to "john_doe". The "selectList" method is then called on the userMapper object to execute the query and retrieve a list of users who match the condition.
阅读全文