正在显示
3 个修改的文件
包含
14 行增加
和
2 行删除
@@ -7,6 +7,7 @@ type QueryProjectCommand struct { | @@ -7,6 +7,7 @@ type QueryProjectCommand struct { | ||
7 | CycleId int64 `cname:"周期ID" json:"cycleId,string"` | 7 | CycleId int64 `cname:"周期ID" json:"cycleId,string"` |
8 | Name string `cname:"项目名称" json:"name"` | 8 | Name string `cname:"项目名称" json:"name"` |
9 | State int `cname:"项目状态" json:"state"` | 9 | State int `cname:"项目状态" json:"state"` |
10 | + PmpIds []string `cname:"项目管理员ID" json:"pmpIds"` | ||
10 | PageNumber int `cname:"分页页码" json:"pageNumber" valid:"Required"` | 11 | PageNumber int `cname:"分页页码" json:"pageNumber" valid:"Required"` |
11 | PageSize int `cname:"分页数量" json:"pageSize" valid:"Required"` | 12 | PageSize int `cname:"分页数量" json:"pageSize" valid:"Required"` |
12 | } | 13 | } |
@@ -352,8 +352,7 @@ func (rs *EvaluationProjectService) StatisticCycleUser(in *command.StatisticCycl | @@ -352,8 +352,7 @@ func (rs *EvaluationProjectService) StatisticCycleUser(in *command.StatisticCycl | ||
352 | _, users, _ := userRepository.Find(map[string]interface{}{"ids": userIds, "limit": len(userIds)}) | 352 | _, users, _ := userRepository.Find(map[string]interface{}{"ids": userIds, "limit": len(userIds)}) |
353 | departmentIdMap := map[int]int{} | 353 | departmentIdMap := map[int]int{} |
354 | for i := range users { | 354 | for i := range users { |
355 | - user := users[i] | ||
356 | - for _, v := range user.DepartmentId { | 355 | + for _, v := range users[i].DepartmentId { |
357 | departmentIdMap[v] = v | 356 | departmentIdMap[v] = v |
358 | } | 357 | } |
359 | } | 358 | } |
@@ -145,6 +145,18 @@ func (repo *EvaluationProjectRepository) Find(queryOptions map[string]interface{ | @@ -145,6 +145,18 @@ func (repo *EvaluationProjectRepository) Find(queryOptions map[string]interface{ | ||
145 | query.Where("state = ?", v) | 145 | query.Where("state = ?", v) |
146 | } | 146 | } |
147 | 147 | ||
148 | + if v, ok := queryOptions["pmpIds"]; ok { | ||
149 | + pmpIds := v.([]string) | ||
150 | + if len(pmpIds) > 0 { | ||
151 | + query.WhereGroup(func(query *pg.Query) (*pg.Query, error) { | ||
152 | + for i := range pmpIds { | ||
153 | + query.WhereOr("pmp_ids @> ?", pmpIds[i]) | ||
154 | + } | ||
155 | + return query, nil | ||
156 | + }) | ||
157 | + } | ||
158 | + } | ||
159 | + | ||
148 | if v, ok := queryOptions["limit"].(int); ok { | 160 | if v, ok := queryOptions["limit"].(int); ok { |
149 | query.Limit(v) | 161 | query.Limit(v) |
150 | } | 162 | } |
-
请 注册 或 登录 后发表评论