queryWrapper.orderByDesc
时间: 2024-02-25 19:24:03 浏览: 69
lib.rar(wrapper.h)
5星 · 资源好评率100%
`orderByDesc` is a method in the QueryWrapper class in the MyBatis framework. It is used to specify the order in which the results should be returned from a query.
The `orderByDesc` method orders the results in descending order based on the given column(s). It takes one or more column names as arguments and returns a QueryWrapper object with the ordering applied.
Here's an example usage:
```
QueryWrapper<User> queryWrapper = new QueryWrapper<>();
queryWrapper.orderByDesc("created_at", "name");
List<User> users = userMapper.selectList(queryWrapper);
```
In this example, we create a QueryWrapper object and call the `orderByDesc` method to specify that the results should be ordered by the `created_at` column in descending order, and then by the `name` column in descending order. We then use this QueryWrapper to retrieve a List of User objects from the database using the `selectList` method of the UserMapper interface.
阅读全文