ThinkChat🤖让你学习和工作更高效,注册即送10W Token,即刻开启你的AI之旅 广告
## 一、简单统计 根据方法名来自动生成 SQL,例如: ``` long countByOpenIdAndStatus ``` ## 二、自定义语句(JPQL) ``` @Query("select count(staff) from SysStaff staff where exists (select 1 from SysStaffInvitation siv where siv.staffId=staff.staffId and siv.fromStaffId=?1 and staff.createTime like ?2% )") Integer getInvitedSysStaffListCountOfTotal(long staffId, String invitationTime); @Query("select count(staff) from SysStaff staff where exists (select 1 from SysStaffInvitation siv where siv.staffId=staff.staffId and siv.fromStaffId=?1 and staff.createTime like ?2% ) and exists (select 1 from SysStaffSetting sss where sss.staffId=staff.staffId and sss.=?3 )") Integer getInvitedSysStaffListCountOf(long staffId, String invitationTime, long identityId); ```