正在显示
5 个修改的文件
包含
12 行增加
和
8 行删除
| @@ -9,7 +9,7 @@ type CreateProjectCommand struct { | @@ -9,7 +9,7 @@ type CreateProjectCommand struct { | ||
| 9 | CreatorId int64 `cname:"创建人ID" json:"creatorId"` | 9 | CreatorId int64 `cname:"创建人ID" json:"creatorId"` |
| 10 | CycleId int64 `cname:"周期ID" json:"cycleId,string" valid:"Required"` | 10 | CycleId int64 `cname:"周期ID" json:"cycleId,string" valid:"Required"` |
| 11 | Name string `cname:"项目名称" json:"name" valid:"Required"` | 11 | Name string `cname:"项目名称" json:"name" valid:"Required"` |
| 12 | - Describe string `cname:"项目描述" json:"describe" valid:"Required"` | 12 | + Describe string `cname:"项目描述" json:"describe"` |
| 13 | HrBp int `cname:"HR角色权限" json:"hrBp"` | 13 | HrBp int `cname:"HR角色权限" json:"hrBp"` |
| 14 | Pmp int `cname:"PM角色权限" json:"pmp"` | 14 | Pmp int `cname:"PM角色权限" json:"pmp"` |
| 15 | PmpIds []string `cname:"项目管理员ID" json:"pmpIds"` | 15 | PmpIds []string `cname:"项目管理员ID" json:"pmpIds"` |
| @@ -35,6 +35,7 @@ type NodeContent struct { | @@ -35,6 +35,7 @@ type NodeContent struct { | ||
| 35 | Name string `json:"name" comment:"名称"` | 35 | Name string `json:"name" comment:"名称"` |
| 36 | RuleId int64 `json:"ruleId,string" comment:"评估规则ID"` | 36 | RuleId int64 `json:"ruleId,string" comment:"评估规则ID"` |
| 37 | Rule *EvaluationRule `json:"rule" comment:"评估规则对象"` | 37 | Rule *EvaluationRule `json:"rule" comment:"评估规则对象"` |
| 38 | + Weight int `json:"weight" comment:"权重"` | ||
| 38 | PromptTitle string `json:"promptTitle" comment:"提示项标题"` | 39 | PromptTitle string `json:"promptTitle" comment:"提示项标题"` |
| 39 | PromptText string `json:"promptText" comment:"提示项正文"` | 40 | PromptText string `json:"promptText" comment:"提示项正文"` |
| 40 | EntryItems []*EntryItem `json:"entryItems" comment:"填写项"` | 41 | EntryItems []*EntryItem `json:"entryItems" comment:"填写项"` |
| @@ -136,7 +136,7 @@ func (repo *EvaluationProjectRepository) Find(queryOptions map[string]interface{ | @@ -136,7 +136,7 @@ func (repo *EvaluationProjectRepository) Find(queryOptions map[string]interface{ | ||
| 136 | } | 136 | } |
| 137 | 137 | ||
| 138 | if v, ok := queryOptions["name"].(string); ok && len(v) > 0 { | 138 | if v, ok := queryOptions["name"].(string); ok && len(v) > 0 { |
| 139 | - query.Where("name = ?", v) | 139 | + query.Where("name LIKE ?", v) |
| 140 | } | 140 | } |
| 141 | 141 | ||
| 142 | if v, ok := queryOptions["companyId"]; ok { | 142 | if v, ok := queryOptions["companyId"]; ok { |
| @@ -151,17 +151,14 @@ func (repo *EvaluationProjectRepository) Find(queryOptions map[string]interface{ | @@ -151,17 +151,14 @@ func (repo *EvaluationProjectRepository) Find(queryOptions map[string]interface{ | ||
| 151 | query.Where("state = ?", v) | 151 | query.Where("state = ?", v) |
| 152 | } | 152 | } |
| 153 | 153 | ||
| 154 | - if v, ok := queryOptions["pmpIds"]; ok { | ||
| 155 | - pmpIds := v.([]string) | ||
| 156 | - if len(pmpIds) > 0 { | 154 | + if v, ok := queryOptions["pmpIds"].([]string); ok && len(v) > 0 { |
| 157 | query.WhereGroup(func(query *pg.Query) (*pg.Query, error) { | 155 | query.WhereGroup(func(query *pg.Query) (*pg.Query, error) { |
| 158 | - for i := range pmpIds { | ||
| 159 | - query.WhereOr("pmp_ids @> ?", pmpIds[i]) | 156 | + for i := range v { |
| 157 | + query.WhereOr("pmp_ids @> ?", `"`+v[i]+`"`) | ||
| 160 | } | 158 | } |
| 161 | return query, nil | 159 | return query, nil |
| 162 | }) | 160 | }) |
| 163 | } | 161 | } |
| 164 | - } | ||
| 165 | 162 | ||
| 166 | if v, ok := queryOptions["limit"].(int64); ok { | 163 | if v, ok := queryOptions["limit"].(int64); ok { |
| 167 | query.Limit(int(v)) | 164 | query.Limit(int(v)) |
| @@ -150,6 +150,9 @@ func (repo *EvaluationRuleRepository) Find(queryOptions map[string]interface{}) | @@ -150,6 +150,9 @@ func (repo *EvaluationRuleRepository) Find(queryOptions map[string]interface{}) | ||
| 150 | query.Offset(int(v)) | 150 | query.Offset(int(v)) |
| 151 | } | 151 | } |
| 152 | 152 | ||
| 153 | + // 按创建时间降序 | ||
| 154 | + query.Order("created_at DESC") | ||
| 155 | + | ||
| 153 | count, err := query.SelectAndCount() | 156 | count, err := query.SelectAndCount() |
| 154 | if err != nil { | 157 | if err != nil { |
| 155 | return 0, nil, err | 158 | return 0, nil, err |
| @@ -160,6 +160,9 @@ func (repo *EvaluationTemplateRepository) Find(queryOptions map[string]interface | @@ -160,6 +160,9 @@ func (repo *EvaluationTemplateRepository) Find(queryOptions map[string]interface | ||
| 160 | query.Offset(int(v)) | 160 | query.Offset(int(v)) |
| 161 | } | 161 | } |
| 162 | 162 | ||
| 163 | + // 按创建时间降序 | ||
| 164 | + query.Order("created_at DESC") | ||
| 165 | + | ||
| 163 | count, err := query.SelectAndCount() | 166 | count, err := query.SelectAndCount() |
| 164 | if err != nil { | 167 | if err != nil { |
| 165 | return 0, nil, err | 168 | return 0, nil, err |
-
请 注册 或 登录 后发表评论