mybatis plus group

发布时间:2022-11-18 22:28:05

在开发一个列表,需要显示在当前组的预约数量,就需要对列表中每一个组编号数量统计,不想再写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;

Card image cap
APP STORE
Card image cap
应用宝
Card image cap
小米
Card image cap
华为