作者 郑周

1. 数据不存在时,返回数据格式

... ... @@ -212,8 +212,10 @@ func (srv *SummaryEvaluationService) GetEvaluation360(param *command.QueryEvalua
if err != nil {
return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error())
}
if len(evaluations) == 0 {
return nil, application.ThrowError(application.BUSINESS_ERROR, "数据不存在")
if len(evaluations) == 0 { // 数据不存在
result := adapter.EvaluationInfoAdapter{}
result.EvaluationItems = make([]adapter.EvaluationItemAdapter, 0)
return &result, nil
}
sEvaluation := evaluations[0]
... ... @@ -280,7 +282,10 @@ func (srv *SummaryEvaluationService) GetEvaluation360All(param *command.QueryEva
return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error())
}
if len(evaluations) == 0 {
return nil, application.ThrowError(application.BUSINESS_ERROR, "数据不存在")
result := adapter.EvaluationInfoAdapter{}
result.EvaluationItems = make([]adapter.EvaluationItemAdapter, 0)
return &result, nil
//return nil, application.ThrowError(application.BUSINESS_ERROR, "数据不存在")
}
sEvaluation := evaluations[0]
... ... @@ -611,8 +616,11 @@ func (srv *SummaryEvaluationService) GetEvaluationHRBP(param *command.QueryEvalu
if err != nil {
return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error())
}
if len(evaluations) == 0 {
return nil, application.ThrowError(application.BUSINESS_ERROR, "数据不存在")
if len(evaluations) == 0 { // 数据不存在
result := adapter.EvaluationInfoAdapter{}
result.EvaluationItems = make([]adapter.EvaluationItemAdapter, 0)
return &result, nil
//return nil, application.ThrowError(application.BUSINESS_ERROR, "数据不存在")
}
sEvaluation := evaluations[0]
... ...
... ... @@ -154,7 +154,7 @@ func (repo *SummaryEvaluationRepository) Find(queryOptions map[string]interface{
query.Where(`summary_evaluation.target_user->>'userId'='?'`, v)
}
if v, ok := queryOptions["targetUserName"]; ok {
if v, ok := queryOptions["targetUserName"].(string); ok && len(v) > 0 {
query.Where(`summary_evaluation.target_user->>'userName' like ?`, v)
}
... ...