作者 tangxvhui

Merge branch '1.3.2-bug' into test

... ... @@ -5,6 +5,7 @@ type QueryCycleList struct {
UserId int `json:"userId,string"`
CompanyId int `json:"-"`
Types int `json:"types"`
CycleId int `json:"cycleId,string"`
PageSize int `json:"pageSize"`
PageNumber int `json:"pageNumber"`
}
... ...
... ... @@ -49,7 +49,7 @@ func (srv *SummaryEvaluationService) ListCycleAndProject(param *command.QueryCyc
assessDao := dao.NewStaffAssessDao(map[string]interface{}{
"transactionContext": transactionContext,
})
projectList, err := assessDao.ListCycleAndProject(param.UserId, param.CompanyId, offset, limit)
projectList, err := assessDao.ListCycleAndProject(param.UserId, param.CompanyId, param.CycleId, offset, limit)
if err != nil {
return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error())
}
... ...
... ... @@ -440,7 +440,7 @@ type CycleAndProjectItem struct {
}
// 获取某个人的自评的周期和项目
func (d *StaffAssessDao) ListCycleAndProject(userId int, companyId int, offset int, limit int) (result []CycleAndProjectItem, err error) {
func (d *StaffAssessDao) ListCycleAndProject(userId int, companyId int, cycleId int, offset int, limit int) (result []CycleAndProjectItem, err error) {
sqlStr := `select
distinct
staff_assess.cycle_id ,
... ... @@ -453,10 +453,17 @@ func (d *StaffAssessDao) ListCycleAndProject(userId int, companyId int, offset i
and company_id=?
and target_user->>'userId'=?
and "types"='self'
order by cycle_id desc
limit ? offset ? `
`
condition := []interface{}{companyId, strconv.Itoa(userId)}
if cycleId > 0 {
condition = append(condition, cycleId)
sqlStr += ` and cycle_id=? `
}
condition = append(condition, limit, offset)
sqlStr += ` order by cycle_id desc limit ? offset ? `
tx := d.transactionContext.PgTx
condition := []interface{}{companyId, strconv.Itoa(userId), limit, offset}
_, err = tx.Query(&result, sqlStr, condition...)
return result, err
}
... ...