作者 tangxvhui

调整执行人的周期列表输出

... ... @@ -32,7 +32,10 @@ type ExecutorCycle struct {
// offset,limit 分页
func (d *SummaryEvaluationDao) GetExecutorCycleList(executorId int, offset int, limit int, isHrbp bool) ([]ExecutorCycle, error) {
sqlStr := `select
distinct
distinct on(
summary_evaluation.cycle_id ,
summary_evaluation.cycle_name)
summary_evaluation.created_at ,
summary_evaluation.cycle_id ,
summary_evaluation.cycle_name
from summary_evaluation
... ... @@ -46,9 +49,10 @@ func (d *SummaryEvaluationDao) GetExecutorCycleList(executorId int, offset int,
sqlStr += ` or summary_evaluation."types"=4 `
}
condition = append(condition, offset, limit)
sqlStr += ` order by summary_evaluation.cycle_id desc offset ? limit ? `
sqlStr1 := `with t1 as ( ` + sqlStr + ` ) select * from t1 order by t1.created_at desc offset ? limit ? `
result := []ExecutorCycle{}
_, err := tx.Query(&result, sqlStr, condition...)
_, err := tx.Query(&result, sqlStr1, condition...)
return result, err
}
... ...
... ... @@ -23,6 +23,7 @@ func (c *SummaryEvaluationController) GetExecutorCycleList() {
}
userReq := middlewares.GetUser(c.Ctx)
paramReq.UserId = int(userReq.UserId)
paramReq.CompanyId = int(userReq.CompanyId)
data, err := srv.GetExecutorCycleList(paramReq)
c.Response(data, err)
}
... ...