|
@@ -174,32 +174,29 @@ func (d *StaffAssessDao) catchProjectIdByPermission(companyId int, cycleId int, |
|
@@ -174,32 +174,29 @@ func (d *StaffAssessDao) catchProjectIdByPermission(companyId int, cycleId int, |
174
|
}
|
174
|
}
|
175
|
|
175
|
|
176
|
type TargetUserCycleProject struct {
|
176
|
type TargetUserCycleProject struct {
|
177
|
- CycleId string `pg:"cycle_id" json:"cycleId"` //周期id
|
|
|
178
|
- CycleName string `pg:"cycle_name" json:"cycleName"` //周期名称
|
|
|
179
|
- EvaluationProjectIds []string `pg:"evaluation_project_ids,array" json:"evaluationProjectIds"`
|
177
|
+ CycleId string `pg:"cycle_id" json:"cycleId"` //周期id
|
|
|
178
|
+ CycleName string `pg:"cycle_name" json:"cycleName"` //周期名称
|
|
|
179
|
+ EvaluationProjectId string `pg:"evaluation_project_id" json:"evaluationProjectId"`
|
|
|
180
|
+ EvaluationProjectName string `pg:"evaluation_project_name" json:"evaluationProjectName"`
|
180
|
}
|
181
|
}
|
181
|
|
182
|
|
182
|
// 获取目标员工的自评周期和项目
|
183
|
// 获取目标员工的自评周期和项目
|
183
|
func (d *StaffAssessDao) SearchTargetUserCycleProject(companyId int, targetUserId int, limit int, offset int) ([]TargetUserCycleProject, error) {
|
184
|
func (d *StaffAssessDao) SearchTargetUserCycleProject(companyId int, targetUserId int, limit int, offset int) ([]TargetUserCycleProject, error) {
|
184
|
- sqlStr := ` with t_staff_assess as (
|
|
|
185
|
- select distinct staff_assess.cycle_id ,
|
|
|
186
|
- staff_assess.cycle_name,
|
|
|
187
|
- staff_assess.evaluation_project_id
|
|
|
188
|
- from staff_assess
|
|
|
189
|
- where 1=1
|
|
|
190
|
- and staff_assess."types" ='self'
|
|
|
191
|
- and staff_assess.deleted_at isnull
|
|
|
192
|
- and staff_assess.target_user ->>'userId'='?'
|
|
|
193
|
- and staff_assess.company_id=?
|
|
|
194
|
- )
|
|
|
195
|
- select
|
|
|
196
|
- t_staff_assess.cycle_id,
|
|
|
197
|
- t_staff_assess.cycle_name,
|
|
|
198
|
- array_agg(to_char(t_staff_assess.evaluation_project_id,'9999999999999999999')) as evaluation_project_ids
|
|
|
199
|
- from t_staff_assess
|
|
|
200
|
- group by cycle_id,cycle_name
|
|
|
201
|
- limit ? offset ?
|
185
|
+ sqlStr := `select distinct
|
|
|
186
|
+ staff_assess.cycle_name,
|
|
|
187
|
+ staff_assess.cycle_id ,
|
|
|
188
|
+ staff_assess.evaluation_project_id,
|
|
|
189
|
+ staff_assess.evaluation_project_name
|
|
|
190
|
+ from staff_assess ,staff_assess_task
|
|
|
191
|
+ where 1=1
|
|
|
192
|
+ and staff_assess_task.id =staff_assess.staff_assess_task_id
|
|
|
193
|
+ and staff_assess."types" ='self'
|
|
|
194
|
+ and staff_assess_task.deleted_at isnull
|
|
|
195
|
+ and staff_assess.deleted_at isnull
|
|
|
196
|
+ and staff_assess.target_user ->>'userId'='?'
|
|
|
197
|
+ and staff_assess.company_id=?
|
202
|
`
|
198
|
`
|
|
|
199
|
+ sqlStr += ` order by cycle_id desc limit ? offset ? `
|
203
|
condition := []interface{}{targetUserId, companyId, limit, offset}
|
200
|
condition := []interface{}{targetUserId, companyId, limit, offset}
|
204
|
result := []TargetUserCycleProject{}
|
201
|
result := []TargetUserCycleProject{}
|
205
|
tx := d.transactionContext.PgTx
|
202
|
tx := d.transactionContext.PgTx
|