在开发一个列表,需要显示在当前组的预约数量,就需要对列表中每一个组编号数量统计,不想再写xml了就想
了是否在mybatis plus中有group,一查下还真有,以防后继使用,记录下来。
QueryWrapper<MapPointMember> wrapper = new QueryWrapper<MapPointMember>();
wrapper.groupBy("groupId");
wrapper.in("groupId",mapPointIdList);
wrapper.select("group_id as groupId,count(1) as count");
List<MapPointMember> memberList = baseMapper.selectList(wrapper);
Map<Integer,Integer> resultMap=new HashMap<Integer,Integer>();
for (MapPointMember member:memberList) {
resultMap.put(member.getMapPointId(),member.getMemberCount());
}
return resultMap;