作者 郑周

修复 项目BUG

... ... @@ -9,7 +9,7 @@ type CreateProjectCommand struct {
CreatorId int64 `cname:"创建人ID" json:"creatorId"`
CycleId int64 `cname:"周期ID" json:"cycleId,string" valid:"Required"`
Name string `cname:"项目名称" json:"name" valid:"Required"`
Describe string `cname:"项目描述" json:"describe" valid:"Required"`
Describe string `cname:"项目描述" json:"describe"`
HrBp int `cname:"HR角色权限" json:"hrBp"`
Pmp int `cname:"PM角色权限" json:"pmp"`
PmpIds []string `cname:"项目管理员ID" json:"pmpIds"`
... ...
... ... @@ -35,6 +35,7 @@ type NodeContent struct {
Name string `json:"name" comment:"名称"`
RuleId int64 `json:"ruleId,string" comment:"评估规则ID"`
Rule *EvaluationRule `json:"rule" comment:"评估规则对象"`
Weight int `json:"weight" comment:"权重"`
PromptTitle string `json:"promptTitle" comment:"提示项标题"`
PromptText string `json:"promptText" comment:"提示项正文"`
EntryItems []*EntryItem `json:"entryItems" comment:"填写项"`
... ...
... ... @@ -136,7 +136,7 @@ func (repo *EvaluationProjectRepository) Find(queryOptions map[string]interface{
}
if v, ok := queryOptions["name"].(string); ok && len(v) > 0 {
query.Where("name = ?", v)
query.Where("name LIKE ?", v)
}
if v, ok := queryOptions["companyId"]; ok {
... ... @@ -151,17 +151,14 @@ func (repo *EvaluationProjectRepository) Find(queryOptions map[string]interface{
query.Where("state = ?", v)
}
if v, ok := queryOptions["pmpIds"]; ok {
pmpIds := v.([]string)
if len(pmpIds) > 0 {
if v, ok := queryOptions["pmpIds"].([]string); ok && len(v) > 0 {
query.WhereGroup(func(query *pg.Query) (*pg.Query, error) {
for i := range pmpIds {
query.WhereOr("pmp_ids @> ?", pmpIds[i])
for i := range v {
query.WhereOr("pmp_ids @> ?", `"`+v[i]+`"`)
}
return query, nil
})
}
}
if v, ok := queryOptions["limit"].(int64); ok {
query.Limit(int(v))
... ...
... ... @@ -150,6 +150,9 @@ func (repo *EvaluationRuleRepository) Find(queryOptions map[string]interface{})
query.Offset(int(v))
}
// 按创建时间降序
query.Order("created_at DESC")
count, err := query.SelectAndCount()
if err != nil {
return 0, nil, err
... ...
... ... @@ -160,6 +160,9 @@ func (repo *EvaluationTemplateRepository) Find(queryOptions map[string]interface
query.Offset(int(v))
}
// 按创建时间降序
query.Order("created_at DESC")
count, err := query.SelectAndCount()
if err != nil {
return 0, nil, err
... ...