作者 tangxvhui

Merge branch '1.3.2-bug' into test

@@ -5,6 +5,7 @@ type QueryCycleList struct { @@ -5,6 +5,7 @@ type QueryCycleList struct {
5 UserId int `json:"userId,string"` 5 UserId int `json:"userId,string"`
6 CompanyId int `json:"-"` 6 CompanyId int `json:"-"`
7 Types int `json:"types"` 7 Types int `json:"types"`
  8 + CycleId int `json:"cycleId,string"`
8 PageSize int `json:"pageSize"` 9 PageSize int `json:"pageSize"`
9 PageNumber int `json:"pageNumber"` 10 PageNumber int `json:"pageNumber"`
10 } 11 }
@@ -49,7 +49,7 @@ func (srv *SummaryEvaluationService) ListCycleAndProject(param *command.QueryCyc @@ -49,7 +49,7 @@ func (srv *SummaryEvaluationService) ListCycleAndProject(param *command.QueryCyc
49 assessDao := dao.NewStaffAssessDao(map[string]interface{}{ 49 assessDao := dao.NewStaffAssessDao(map[string]interface{}{
50 "transactionContext": transactionContext, 50 "transactionContext": transactionContext,
51 }) 51 })
52 - projectList, err := assessDao.ListCycleAndProject(param.UserId, param.CompanyId, offset, limit) 52 + projectList, err := assessDao.ListCycleAndProject(param.UserId, param.CompanyId, param.CycleId, offset, limit)
53 if err != nil { 53 if err != nil {
54 return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error()) 54 return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error())
55 } 55 }
@@ -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 }