This commit is contained in:
@jyuhsin
2025-01-06 09:30:09 +08:00
parent a7ca527cd3
commit 0c5a0deb03
3 changed files with 57 additions and 20 deletions
@@ -210,11 +210,16 @@ public class ClubApplyInController {
@RequiresAuthentication
public Object getCount() {
int hasJoinCount = dao.count("sys_club", Cnd.NEW().and("isjs", "=", false)
.and("state", "=", ClubRegistAuditState.SCHOOL_PASS)
.and("id in (SELECT clubid from sys_club_user WHERE isNormal = true and userid = '" + ShiroUtil.getPrincipalProperty("id") + "') and 1", "=", 1));
.and(new Static("id in (SELECT clubid from sys_club_user WHERE isNormal = true and status in (1,3,5) and userid = '%s')".formatted(ShiroUtil.getUserId()))));
SqlExpressionGroup group = new SqlExpressionGroup();
group.and("state", "=", ClubRegistAuditState.SCHOOL_PASS);
group.or(new Static("id in (select clubid from sys_club_user where userid = '%s' and invite = true and status in (6, 7))"
.formatted(ShiroUtil.getPlatformUid())));
int noJoinCount = dao.count("sys_club", Cnd.NEW().and("isjs", "=", false)
.and("state", "=", ClubRegistAuditState.SCHOOL_PASS)
.and("id not in (SELECT clubid from sys_club_user WHERE isNormal = true and userid = '" + ShiroUtil.getPrincipalProperty("id") + "' and status not in (2, 4) ) and 1", "=", 1));
.and(group)
.and(new Static("id not in (SELECT clubid from sys_club_user WHERE isNormal = true and userid = '%s' and status not in (2, 4, 6, 7) )".formatted(ShiroUtil.getUserId()))));
return new NutMap().setv("hasJoinCount", hasJoinCount).setv("noJoinCount", noJoinCount);
}