手机端社团UI优化

This commit is contained in:
=
2026-08-30 11:11:29 +08:00
parent 37f874f31d
commit bc8f23a61d
11 changed files with 1085 additions and 695 deletions
@@ -57,8 +57,14 @@ public class ClubUserJoinMineController {
@At
@SaCheckPermission(value = {"club.join.mine", "h5.club.join.mine"}, mode = SaMode.OR)
/**
* 我的申请分页查询。
* pageForm 为分页参数,year 为申请年度,clubName 为可选的社团名称关键字;
* 返回分页后的当前用户社团申请记录。
*/
public Result pageData(@Valid PageForm pageForm,
@Param("year") Integer year){
@Param("year") Integer year,
@Param("clubName") String clubName){
Sql sql = Sqls.create("""
SELECT
info.*,
@@ -94,6 +100,9 @@ public class ClubUserJoinMineController {
Cnd cnd = Cnd.NEW();
cnd.and("info.userId", "=", SecurityUtil.getUserId());
cnd.andEX("year(info.applyDate)", "=", year);
if (clubName != null && !clubName.trim().isEmpty()) {
cnd.and("club.clubName", "like", "%" + clubName.trim() + "%");
}
cnd.groupBy("info.id");
cnd.desc("info.applyDate");
sql.setCondition(cnd);
@@ -18,6 +18,7 @@ import org.nutz.dao.sql.Sql;
import org.nutz.ioc.loader.annotation.Inject;
import org.nutz.ioc.loader.annotation.IocBean;
import org.nutz.lang.Lang;
import org.nutz.lang.Strings;
import org.nutz.lang.util.NutMap;
import org.nutz.mvc.annotation.At;
import org.nutz.mvc.annotation.Ok;
@@ -49,6 +50,11 @@ public class ClubUserMineClubController {
@At
@SaCheckPermission(value = {"club.join.mine.club", "h5.club.join.mine.club"}, mode = SaMode.OR)
/**
* 我的社团分页查询。
* pageForm 传入分页参数及可选社团名称;返回当前登录人已完成入会流程的社团列表,
* 每条记录同时包含当前成员姓名、工号和最近一次入会申请 ID,供 H5 卡片及详情页展示。
*/
public Result pageData(@Valid ClubUserPageForm pageForm) {
List<ClubUser> query = dao.query(ClubUser.class, Cnd.where("userId", "=", SecurityUtil.getUserId()).groupBy("clubId"));
if (Lang.isEmpty(query)) {
@@ -64,20 +70,37 @@ public class ClubUserMineClubController {
SELECT
club.*,
club.id as clubId,
currentUser.username AS userName,
currentUser.loginname AS loginName,
currentApply.id AS applyId,
COUNT(DISTINCT ( uc.userId )) AS currentPeopleNum,
presidentUser.username AS clubLeader,
secretaryUser.username AS clubSecretary
FROM
sys_club club
LEFT JOIN club_user uc ON club.id = uc.clubId
-- 查询当前登录人的成员资料及最近一次入会申请,避免卡片标题错误显示为社团名称。
LEFT JOIN club_user currentClubUser ON currentClubUser.clubId = club.id AND currentClubUser.userId = @currentUserId
LEFT JOIN sys_user currentUser ON currentUser.id = currentClubUser.userId
LEFT JOIN (
SELECT clubId, MAX(applyDate) AS applyDate
FROM club_user_apply
WHERE userId = @currentUserId AND mode = 1
GROUP BY clubId
) lastApply ON lastApply.clubId = club.id
LEFT JOIN club_user_apply currentApply ON currentApply.clubId = lastApply.clubId AND currentApply.userId = @currentUserId AND currentApply.applyDate = lastApply.applyDate AND currentApply.mode = 1
LEFT JOIN club_user presidentCu ON presidentCu.clubId = club.id AND JSON_CONTAINS(presidentCu.roleCode, '"CLUB_PRESIDENT"')
LEFT JOIN sys_user presidentUser ON presidentUser.id = presidentCu.userId
LEFT JOIN club_user secretaryCu ON secretaryCu.clubId = club.id AND JSON_CONTAINS(secretaryCu.roleCode, '"CLUB_SECRETARY"')
LEFT JOIN sys_user secretaryUser ON secretaryUser.id = secretaryCu.userId
$condition
""");
sql.setParam("currentUserId", SecurityUtil.getUserId());
Cnd cnd = Cnd.NEW();
cnd.andEX("club.clubName", "=", pageForm.getClubName());
// 社团名称为可选搜索参数,输入关键字时按名称模糊匹配。
if (Strings.isNotBlank(pageForm.getClubName())) {
cnd.and("club.clubName", "like", "%" + pageForm.getClubName().trim() + "%");
}
cnd.and("club.id", "in", list);
cnd.groupBy("club.id");
cnd.asc("club.clubCode");