|
@@ -440,7 +440,7 @@ type CycleAndProjectItem struct { |
|
@@ -440,7 +440,7 @@ type CycleAndProjectItem struct { |
440
|
}
|
440
|
}
|
441
|
|
441
|
|
442
|
// 获取某个人的自评的周期和项目
|
442
|
// 获取某个人的自评的周期和项目
|
443
|
-func (d *StaffAssessDao) ListCycleAndProject(userId int, companyId int, offset int, limit int) (result []CycleAndProjectItem, err error) {
|
443
|
+func (d *StaffAssessDao) ListCycleAndProject(userId int, companyId int, cycleId int, offset int, limit int) (result []CycleAndProjectItem, err error) {
|
444
|
sqlStr := `select
|
444
|
sqlStr := `select
|
445
|
distinct
|
445
|
distinct
|
446
|
staff_assess.cycle_id ,
|
446
|
staff_assess.cycle_id ,
|
|
@@ -453,10 +453,17 @@ func (d *StaffAssessDao) ListCycleAndProject(userId int, companyId int, offset i |
|
@@ -453,10 +453,17 @@ func (d *StaffAssessDao) ListCycleAndProject(userId int, companyId int, offset i |
453
|
and company_id=?
|
453
|
and company_id=?
|
454
|
and target_user->>'userId'=?
|
454
|
and target_user->>'userId'=?
|
455
|
and "types"='self'
|
455
|
and "types"='self'
|
456
|
- order by cycle_id desc
|
|
|
457
|
- limit ? offset ? `
|
456
|
+ `
|
|
|
457
|
+
|
|
|
458
|
+ condition := []interface{}{companyId, strconv.Itoa(userId)}
|
|
|
459
|
+ if cycleId > 0 {
|
|
|
460
|
+ condition = append(condition, cycleId)
|
|
|
461
|
+ sqlStr += ` and cycle_id=? `
|
|
|
462
|
+ }
|
|
|
463
|
+ condition = append(condition, limit, offset)
|
|
|
464
|
+ sqlStr += ` order by cycle_id desc limit ? offset ? `
|
|
|
465
|
+
|
458
|
tx := d.transactionContext.PgTx
|
466
|
tx := d.transactionContext.PgTx
|
459
|
- condition := []interface{}{companyId, strconv.Itoa(userId), limit, offset}
|
|
|
460
|
_, err = tx.Query(&result, sqlStr, condition...)
|
467
|
_, err = tx.Query(&result, sqlStr, condition...)
|
461
|
return result, err
|
468
|
return result, err
|
462
|
} |
469
|
} |