diff --git a/app/operate/apis/org_team.go b/app/operate/apis/org_team.go index 4cd790683c29a54808e6d4e3a83be213f0a623e7..899739660e68dbfc3d7ac2122fdc91c616cd8b0c 100755 --- a/app/operate/apis/org_team.go +++ b/app/operate/apis/org_team.go @@ -20,6 +20,13 @@ type OrgTeam struct { api.Api } +func (e OrgTeam) getClubId(c *gin.Context) string { + sOrgTeamUser := service.OrgClubUser{} + e.MakeContext(c).MakeOrm().MakeService(&sOrgTeamUser.Service) + _, teamId := sOrgTeamUser.GetClubId(user.GetUserId(c)) + return teamId +} + // GetPage <çƒé˜Ÿ>获å–çƒé˜Ÿåˆ—表 // @Summary <çƒé˜Ÿ>获å–çƒé˜Ÿåˆ—表 // @Description <çƒé˜Ÿ>获å–çƒé˜Ÿåˆ—表 @@ -48,6 +55,8 @@ func (e OrgTeam) GetPage(c *gin.Context) { list := make([]dto.OrgTeamGetPageReply, 0) var count int64 + req.ClubId = e.getClubId(c) + err = s.GetPage(&req, p, &list, &count) if err != nil { e.Error(500, err, fmt.Sprintf("获å–çƒé˜Ÿ 失败,\r\nå¤±è´¥ä¿¡æ¯ %s", err.Error())) @@ -136,6 +145,10 @@ func (e OrgTeam) Insert(c *gin.Context) { e.Error(500, err, err.Error()) return } + if req.ClubId == "" || req.TeamName == "" { + e.Error(111, err, "æ•°æ®æœ‰è¯¯") + return + } userId := user.GetUserId(c) // 设置创建人 req.CreateBy = userId diff --git a/app/operate/service/dto/org_team.go b/app/operate/service/dto/org_team.go index 189e2d2f6ee0a837841e31307353552d8c6bb069..b5da280fc70613e23ff48010a968cf86621e0301 100755 --- a/app/operate/service/dto/org_team.go +++ b/app/operate/service/dto/org_team.go @@ -9,6 +9,7 @@ import ( type OrgTeamGetPageReq struct { dto.Pagination `search:"-"` + ClubId string `form:"clubId" json:"clubId" search:"-"` //çƒé˜Ÿåç§° TeamName string `form:"teamName" json:"teamName" search:"type:contains;column:team_name;table:ot" comment:"çƒé˜Ÿåç§°"` //çƒé˜Ÿåç§° CreateStartTime string `form:"createStartTime" search:"type:gte;column:created_at;table:ot" comment:"开始时间"` //开始时间 CreateEndTime string `form:"createEndTime" search:"type:lte;column:created_at;table:ot" comment:"ç»“æŸæ—¶é—´"` //ç»“æŸæ—¶é—´ diff --git a/app/operate/service/org_team.go b/app/operate/service/org_team.go index e26a4bc2ca2c7b1006c18294f81a247b329559e1..44fd53d0806c0dfb9f115add408ae12d44ced2c6 100755 --- a/app/operate/service/org_team.go +++ b/app/operate/service/org_team.go @@ -29,6 +29,7 @@ func (e *OrgTeam) GetPage(c *dto.OrgTeamGetPageReq, p *actions.DataPermission, l cDto.Paginate(c.GetPageSize(), c.GetPageIndex()), actions.Permission(data.TableName(), p), cDto.PassDel("ot"), + cDto.SetWhere("ot", "club_id", c.ClubId), ). Find(list).Limit(-1).Offset(-1). Count(count).Error