mybatisPlus实现按天查询数据量,表中时间格式为2021-07-22 03:11:10这种
QueryWrapper<TbDefraudDomainDO> queryWrapper = new QueryWrapper<>();
//可以给列起别名
queryWrapper.select("date_format(dateColumn, '%Y-%m-%d') as date","count(time) as amount")
.groupBy("date")
.orderByAsc("date");
List<Map<String, Object>> maps = this.xxximpl.listMaps(queryWrapper);// 查出结果 返回成功
//这里的xxximpl继承了ServiceImpl<>
System.out.println(maps.size());
for (Map<String, Object> map : maps) {
for (String key : map.keySet()) {
System.out.println(key + " " + map.get(key));
}
}