作者 tangxvhui

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

@@ -32,7 +32,10 @@ type ExecutorCycle struct { @@ -32,7 +32,10 @@ type ExecutorCycle struct {
32 // offset,limit 分页 32 // offset,limit 分页
33 func (d *SummaryEvaluationDao) GetExecutorCycleList(executorId int, offset int, limit int, isHrbp bool) ([]ExecutorCycle, error) { 33 func (d *SummaryEvaluationDao) GetExecutorCycleList(executorId int, offset int, limit int, isHrbp bool) ([]ExecutorCycle, error) {
34 sqlStr := `select 34 sqlStr := `select
35 - distinct 35 + distinct on(
  36 + summary_evaluation.cycle_id ,
  37 + summary_evaluation.cycle_name)
  38 + summary_evaluation.created_at ,
36 summary_evaluation.cycle_id , 39 summary_evaluation.cycle_id ,
37 summary_evaluation.cycle_name 40 summary_evaluation.cycle_name
38 from summary_evaluation 41 from summary_evaluation
@@ -46,9 +49,10 @@ func (d *SummaryEvaluationDao) GetExecutorCycleList(executorId int, offset int, @@ -46,9 +49,10 @@ func (d *SummaryEvaluationDao) GetExecutorCycleList(executorId int, offset int,
46 sqlStr += ` or summary_evaluation."types"=4 ` 49 sqlStr += ` or summary_evaluation."types"=4 `
47 } 50 }
48 condition = append(condition, offset, limit) 51 condition = append(condition, offset, limit)
49 - sqlStr += ` order by summary_evaluation.cycle_id desc offset ? limit ? ` 52 +
  53 + sqlStr1 := `with t1 as ( ` + sqlStr + ` ) select * from t1 order by t1.created_at desc offset ? limit ? `
50 result := []ExecutorCycle{} 54 result := []ExecutorCycle{}
51 - _, err := tx.Query(&result, sqlStr, condition...) 55 + _, err := tx.Query(&result, sqlStr1, condition...)
52 return result, err 56 return result, err
53 } 57 }
54 58
@@ -23,6 +23,7 @@ func (c *SummaryEvaluationController) GetExecutorCycleList() { @@ -23,6 +23,7 @@ func (c *SummaryEvaluationController) GetExecutorCycleList() {
23 } 23 }
24 userReq := middlewares.GetUser(c.Ctx) 24 userReq := middlewares.GetUser(c.Ctx)
25 paramReq.UserId = int(userReq.UserId) 25 paramReq.UserId = int(userReq.UserId)
  26 + paramReq.CompanyId = int(userReq.CompanyId)
26 data, err := srv.GetExecutorCycleList(paramReq) 27 data, err := srv.GetExecutorCycleList(paramReq)
27 c.Response(data, err) 28 c.Response(data, err)
28 } 29 }