|
|
@ -76,23 +76,23 @@ type JoinTeamResult struct { |
|
|
|
TeamName string |
|
|
|
} |
|
|
|
|
|
|
|
func GetJoinTeamByTeamId(teamId, rehearsalId interface{}) (*JoinTeamResult, bool, error) { |
|
|
|
func GetJoinTeamByTeamId(teamId, rehearsalId, archId interface{}) (*JoinTeamResult, bool, error) { |
|
|
|
result := new(JoinTeamResult) |
|
|
|
exist, err := core.GetXormAuto().Table(new(models.BaheTeam)).Alias("t"). |
|
|
|
Select("t.id as team_id, t.bahe_team_name as team_name, count(m.id) as number"). |
|
|
|
Join("LEFT", new(models.BaheTeamMember).Alias("m"), |
|
|
|
"m.team_id=t.id and m.is_delete=0 and m.rehearsal_id=?", rehearsalId). |
|
|
|
Where("t.is_delete=0 and t.id=?", teamId).GroupBy("t.id").Get(result) |
|
|
|
Join("LEFT", new(models.BaheTeamMember).Alias("m"), "m.team_id=t.id"). |
|
|
|
Where("t.is_delete=0 and t.id=? and m.rehearsal_id=? and m.arch_id=?", teamId, archId). |
|
|
|
GroupBy("t.id").Get(result) |
|
|
|
return result, exist, err |
|
|
|
} |
|
|
|
|
|
|
|
func GetJoinTeamByBaheId(baheId, rehearsalId interface{}) (*JoinTeamResult, bool, error) { |
|
|
|
func GetJoinTeamByBaheId(baheId, rehearsalId, archId interface{}) (*JoinTeamResult, bool, error) { |
|
|
|
result := new(JoinTeamResult) |
|
|
|
exist, err := core.GetXormAuto().Table(new(models.BaheTeam)).Alias("t"). |
|
|
|
Select("t.id as team_id, t.bahe_team_name as team_name, count(m.id) as number"). |
|
|
|
Join("LEFT", new(models.BaheTeamMember).Alias("m"), |
|
|
|
"m.team_id=t.id and m.is_delete=0 and m.rehearsal_id=?", rehearsalId). |
|
|
|
Where("t.is_delete=0 and t.bahe_activity_id=? ", baheId). |
|
|
|
Join("LEFT", new(models.BaheTeamMember).Alias("m"), "m.team_id=t.id"). |
|
|
|
Where("t.is_delete=0 and t.bahe_activity_id=? and m.rehearsal_id=? and m.arch_id=? ", |
|
|
|
baheId, rehearsalId, archId). |
|
|
|
GroupBy("t.id").Asc("number").Get(result) |
|
|
|
return result, exist, err |
|
|
|
} |
|
|
|