mybatis plus 平均值函数
时间: 2023-10-01 08:10:14 浏览: 503
在MyBatis Plus中,平均值函数可以通过使用`selectAvg`方法来实现。你可以在`QueryWrapper`或`LambdaQueryWrapper`中使用该方法来计算字段的平均值。例如:
```java
QueryWrapper<MemberLevel> queryWrapper = new QueryWrapper<>();
queryWrapper.selectAvg("level_sort as avgLevelSort");
```
这个查询会返回一个字段名为`avgLevelSort`的结果,它是`level_sort`字段的平均值。<span class="em">1</span><span class="em">2</span><span class="em">3</span>
#### 引用[.reference_title]
- *1* *2* [mybatis-plus max函数,sum函数的使用](https://blog.csdn.net/m0_67393157/article/details/123988141)[target="_blank" data-report-click={"spm":"1018.2226.3001.9630","extra":{"utm_source":"vip_chatgpt_common_search_pc_result","utm_medium":"distribute.pc_search_result.none-task-cask-2~all~insert_cask~default-1-null.142^v93^chatsearchT3_2"}}] [.reference_item style="max-width: 50%"]
- *3* [mybatis plus 查询的几种方式](https://blog.csdn.net/m0_60961213/article/details/127052166)[target="_blank" data-report-click={"spm":"1018.2226.3001.9630","extra":{"utm_source":"vip_chatgpt_common_search_pc_result","utm_medium":"distribute.pc_search_result.none-task-cask-2~all~insert_cask~default-1-null.142^v93^chatsearchT3_2"}}] [.reference_item style="max-width: 50%"]
[ .reference_list ]
阅读全文