作者 tangxvhui

调整周期列表输出

... ... @@ -449,19 +449,21 @@ func (d *StaffAssessDao) ListCycleAndProject(userId int, companyId int, cycleId
staff_assess.evaluation_project_name ,
target_user->>'userId' as target_user_id
from staff_assess
join evaluation_cycle on staff_assess.cycle_id =evaluation_cycle.id
where 1=1
and company_id=?
and target_user->>'userId'=?
and "types"='self'
and staff_assess.company_id=?
and staff_assess.target_user->>'userId'=?
and staff_assess."types"='self'
and staff_assess.deleted_at isnull
`
condition := []interface{}{companyId, strconv.Itoa(userId)}
if cycleId > 0 {
condition = append(condition, cycleId)
sqlStr += ` and cycle_id=? `
sqlStr += ` and staff_assess.cycle_id=? `
}
condition = append(condition, limit, offset)
sqlStr += ` order by cycle_id desc limit ? offset ? `
sqlStr += ` order by staff_assess.cycle_id desc limit ? offset ? `
tx := d.transactionContext.PgTx
_, err = tx.Query(&result, sqlStr, condition...)
... ...
... ... @@ -85,27 +85,33 @@ func (d *SummaryEvaluationDao) CountExecutorCycleList(companyId int, executorId
}
type TargetUserCycle struct {
CycleId string `pg:"cycle_id" ` //周期id
CycleName string `pg:"cycle_name"` //周期名称
BeginTime time.Time `pg:"begin_time"`
EndTime time.Time `pg:"end_time"`
CycleId string `pg:"cycle_id" ` //周期id
CycleName string `pg:"cycle_name"` //周期名称
BeginTime time.Time `pg:"begin_time"`
EndTime time.Time `pg:"end_time"`
EvaluationProjectId string `pg:"evaluation_project_id"`
EvaluationProjectName string `pg:"evaluation_project_name"`
TargetUserId string `pg:"target_user_id"`
}
// GetExecutorCycleList 获取被评估目标人拥有的周期列表
// executorId 执行人id
// offset,limit 分页
func (d *SummaryEvaluationDao) GetTargetUserCycleList(executorId int, offset int, limit int, evaluationType int) ([]TargetUserCycle, error) {
func (d *SummaryEvaluationDao) GetTargetUserCycleList(targetUserId int, offset int, limit int, evaluationType int) ([]TargetUserCycle, error) {
sqlStr := `select
distinct
summary_evaluation.cycle_id ,
summary_evaluation.begin_time ,
summary_evaluation.cycle_name
summary_evaluation.cycle_name ,
summary_evaluation.evaluation_project_id ,
summary_evaluation.evaluation_project_name ,
summary_evaluation.target_user ->>'userId' as target_user_id
from summary_evaluation
where summary_evaluation.deleted_at isnull and summary_evaluation.target_user ->>'userId'='?'
`
tx := d.transactionContext.PgTx
condition := []interface{}{
executorId,
targetUserId,
}
if evaluationType > 0 {
... ... @@ -147,7 +153,10 @@ func (d *SummaryEvaluationDao) TargetUnconfirmedCycleList(companyId int, executo
summary_evaluation.cycle_id,
summary_evaluation.begin_time,
summary_evaluation.end_time,
summary_evaluation.cycle_name
summary_evaluation.cycle_name ,
summary_evaluation.evaluation_project_id ,
summary_evaluation.evaluation_project_name ,
summary_evaluation.target_user ->>'userId' as target_user_id
from summary_evaluation
where summary_evaluation.deleted_at isnull
and summary_evaluation.company_id='?'
... ...