Cannot resolve method 'distinct' in 'LambdaQueryWrapper'
时间: 2023-10-22 18:57:08 浏览: 78
The `distinct` method is not directly available in the `LambdaQueryWrapper` class. However, you can achieve a distinct query by using the `groupBy` method and specifying the columns you want to be distinct.
Here's an example:
```java
LambdaQueryWrapper<Entity> queryWrapper = new LambdaQueryWrapper<>();
queryWrapper.select("column1", "column2")
.groupBy("column1", "column2");
List<Entity> distinctEntities = entityMapper.selectList(queryWrapper);
```
In this example, `Entity` represents your entity class, and `entityMapper` is your mapper interface.
By specifying the columns in the `select` method and grouping by those columns using the `groupBy` method, you can achieve a distinct query.
阅读全文