LambdaQueryWrapper 怎么group by 中写select count

This issue has been tracked since 2022-03-09.

LambdaQueryWrapper 怎么group by 中写select count,


         new LambdaQueryWrapper<SocialRelationCenterTargetDO>()
                        .select(SocialRelationCenterTargetDO::getTargetId,"count(1) as  sum")
                        .in(SocialRelationCenterTargetDO::getTargetId, idSet)
                        .eq(SocialRelationCenterTargetDO::getIdType, idType) 
                .groupBy(SocialRelationCenterTargetDO::getTargetId)

mabyoung wrote this answer on 2022-09-23

要查groupby后每个targetId的数量吗,我理解LambdaQueryWrapper支持不了,要自己手写原生sql实现了

More Details About Repo
Owner Name baomidou
Repo Name mybatis-plus-doc
Full Name baomidou/mybatis-plus-doc
Language JavaScript
Created Date 2016-08-29
Updated Date 2022-12-02
Star Count 612
Watcher Count 56
Fork Count 2720
Issue Count 1

YOU MAY BE INTERESTED

Issue Title Created Date Updated Date