作者 tangxvhui

调整周期列表输出

@@ -449,19 +449,21 @@ func (d *StaffAssessDao) ListCycleAndProject(userId int, companyId int, cycleId @@ -449,19 +449,21 @@ func (d *StaffAssessDao) ListCycleAndProject(userId int, companyId int, cycleId
449 staff_assess.evaluation_project_name , 449 staff_assess.evaluation_project_name ,
450 target_user->>'userId' as target_user_id 450 target_user->>'userId' as target_user_id
451 from staff_assess 451 from staff_assess
  452 + join evaluation_cycle on staff_assess.cycle_id =evaluation_cycle.id
452 where 1=1 453 where 1=1
453 - and company_id=?  
454 - and target_user->>'userId'=?  
455 - and "types"='self' 454 + and staff_assess.company_id=?
  455 + and staff_assess.target_user->>'userId'=?
  456 + and staff_assess."types"='self'
  457 + and staff_assess.deleted_at isnull
456 ` 458 `
457 459
458 condition := []interface{}{companyId, strconv.Itoa(userId)} 460 condition := []interface{}{companyId, strconv.Itoa(userId)}
459 if cycleId > 0 { 461 if cycleId > 0 {
460 condition = append(condition, cycleId) 462 condition = append(condition, cycleId)
461 - sqlStr += ` and cycle_id=? ` 463 + sqlStr += ` and staff_assess.cycle_id=? `
462 } 464 }
463 condition = append(condition, limit, offset) 465 condition = append(condition, limit, offset)
464 - sqlStr += ` order by cycle_id desc limit ? offset ? ` 466 + sqlStr += ` order by staff_assess.cycle_id desc limit ? offset ? `
465 467
466 tx := d.transactionContext.PgTx 468 tx := d.transactionContext.PgTx
467 _, err = tx.Query(&result, sqlStr, condition...) 469 _, err = tx.Query(&result, sqlStr, condition...)
@@ -85,27 +85,33 @@ func (d *SummaryEvaluationDao) CountExecutorCycleList(companyId int, executorId @@ -85,27 +85,33 @@ func (d *SummaryEvaluationDao) CountExecutorCycleList(companyId int, executorId
85 } 85 }
86 86
87 type TargetUserCycle struct { 87 type TargetUserCycle struct {
88 - CycleId string `pg:"cycle_id" ` //周期id  
89 - CycleName string `pg:"cycle_name"` //周期名称  
90 - BeginTime time.Time `pg:"begin_time"`  
91 - EndTime time.Time `pg:"end_time"` 88 + CycleId string `pg:"cycle_id" ` //周期id
  89 + CycleName string `pg:"cycle_name"` //周期名称
  90 + BeginTime time.Time `pg:"begin_time"`
  91 + EndTime time.Time `pg:"end_time"`
  92 + EvaluationProjectId string `pg:"evaluation_project_id"`
  93 + EvaluationProjectName string `pg:"evaluation_project_name"`
  94 + TargetUserId string `pg:"target_user_id"`
92 } 95 }
93 96
94 // GetExecutorCycleList 获取被评估目标人拥有的周期列表 97 // GetExecutorCycleList 获取被评估目标人拥有的周期列表
95 // executorId 执行人id 98 // executorId 执行人id
96 // offset,limit 分页 99 // offset,limit 分页
97 -func (d *SummaryEvaluationDao) GetTargetUserCycleList(executorId int, offset int, limit int, evaluationType int) ([]TargetUserCycle, error) { 100 +func (d *SummaryEvaluationDao) GetTargetUserCycleList(targetUserId int, offset int, limit int, evaluationType int) ([]TargetUserCycle, error) {
98 sqlStr := `select 101 sqlStr := `select
99 distinct 102 distinct
100 summary_evaluation.cycle_id , 103 summary_evaluation.cycle_id ,
101 summary_evaluation.begin_time , 104 summary_evaluation.begin_time ,
102 - summary_evaluation.cycle_name 105 + summary_evaluation.cycle_name ,
  106 + summary_evaluation.evaluation_project_id ,
  107 + summary_evaluation.evaluation_project_name ,
  108 + summary_evaluation.target_user ->>'userId' as target_user_id
103 from summary_evaluation 109 from summary_evaluation
104 where summary_evaluation.deleted_at isnull and summary_evaluation.target_user ->>'userId'='?' 110 where summary_evaluation.deleted_at isnull and summary_evaluation.target_user ->>'userId'='?'
105 ` 111 `
106 tx := d.transactionContext.PgTx 112 tx := d.transactionContext.PgTx
107 condition := []interface{}{ 113 condition := []interface{}{
108 - executorId, 114 + targetUserId,
109 } 115 }
110 116
111 if evaluationType > 0 { 117 if evaluationType > 0 {
@@ -147,7 +153,10 @@ func (d *SummaryEvaluationDao) TargetUnconfirmedCycleList(companyId int, executo @@ -147,7 +153,10 @@ func (d *SummaryEvaluationDao) TargetUnconfirmedCycleList(companyId int, executo
147 summary_evaluation.cycle_id, 153 summary_evaluation.cycle_id,
148 summary_evaluation.begin_time, 154 summary_evaluation.begin_time,
149 summary_evaluation.end_time, 155 summary_evaluation.end_time,
150 - summary_evaluation.cycle_name 156 + summary_evaluation.cycle_name ,
  157 + summary_evaluation.evaluation_project_id ,
  158 + summary_evaluation.evaluation_project_name ,
  159 + summary_evaluation.target_user ->>'userId' as target_user_id
151 from summary_evaluation 160 from summary_evaluation
152 where summary_evaluation.deleted_at isnull 161 where summary_evaluation.deleted_at isnull
153 and summary_evaluation.company_id='?' 162 and summary_evaluation.company_id='?'