正在显示
1 个修改的文件
包含
15 行增加
和
6 行删除
1 | package dao | 1 | package dao |
2 | 2 | ||
3 | import ( | 3 | import ( |
4 | + "time" | ||
5 | + | ||
4 | "github.com/go-pg/pg/v10" | 6 | "github.com/go-pg/pg/v10" |
5 | pgTransaction "github.com/linmadan/egglib-go/transaction/pg" | 7 | pgTransaction "github.com/linmadan/egglib-go/transaction/pg" |
6 | "gitlab.fjmaimaimai.com/allied-creation/performance/pkg/domain" | 8 | "gitlab.fjmaimaimai.com/allied-creation/performance/pkg/domain" |
@@ -20,7 +22,7 @@ func NewSummaryEvaluationDao(options map[string]interface{}) *SummaryEvaluationD | @@ -20,7 +22,7 @@ func NewSummaryEvaluationDao(options map[string]interface{}) *SummaryEvaluationD | ||
20 | } | 22 | } |
21 | } | 23 | } |
22 | 24 | ||
23 | -type PersonalCycle struct { | 25 | +type ExecutorCycle struct { |
24 | CycleId string `pg:"cycle_id" ` //周期id | 26 | CycleId string `pg:"cycle_id" ` //周期id |
25 | CycleName string `pg:"cycle_name"` //周期名称 | 27 | CycleName string `pg:"cycle_name"` //周期名称 |
26 | } | 28 | } |
@@ -28,7 +30,7 @@ type PersonalCycle struct { | @@ -28,7 +30,7 @@ type PersonalCycle struct { | ||
28 | // GetExecutorCycleList 获取执行人拥有的周期列表 | 30 | // GetExecutorCycleList 获取执行人拥有的周期列表 |
29 | // executorId 执行人id | 31 | // executorId 执行人id |
30 | // offset,limit 分页 | 32 | // offset,limit 分页 |
31 | -func (d *SummaryEvaluationDao) GetExecutorCycleList(executorId int, offset int, limit int, evaluationType domain.EvaluationType) ([]PersonalCycle, error) { | 33 | +func (d *SummaryEvaluationDao) GetExecutorCycleList(executorId int, offset int, limit int, evaluationType domain.EvaluationType) ([]ExecutorCycle, error) { |
32 | sqlStr := `select | 34 | sqlStr := `select |
33 | distinct | 35 | distinct |
34 | summary_evaluation.cycle_id , | 36 | summary_evaluation.cycle_id , |
@@ -48,7 +50,7 @@ func (d *SummaryEvaluationDao) GetExecutorCycleList(executorId int, offset int, | @@ -48,7 +50,7 @@ func (d *SummaryEvaluationDao) GetExecutorCycleList(executorId int, offset int, | ||
48 | 50 | ||
49 | condition = append(condition, offset, limit) | 51 | condition = append(condition, offset, limit) |
50 | sqlStr += ` order by summary_evaluation.cycle_id desc offset ? limit ? ` | 52 | sqlStr += ` order by summary_evaluation.cycle_id desc offset ? limit ? ` |
51 | - result := []PersonalCycle{} | 53 | + result := []ExecutorCycle{} |
52 | _, err := tx.Query(&result, sqlStr, condition...) | 54 | _, err := tx.Query(&result, sqlStr, condition...) |
53 | return result, err | 55 | return result, err |
54 | } | 56 | } |
@@ -75,13 +77,20 @@ func (d *SummaryEvaluationDao) CountExecutorCycleList(executorId int, evaluation | @@ -75,13 +77,20 @@ func (d *SummaryEvaluationDao) CountExecutorCycleList(executorId int, evaluation | ||
75 | return cnt, err | 77 | return cnt, err |
76 | } | 78 | } |
77 | 79 | ||
80 | +type TargetUserCycle struct { | ||
81 | + CycleId string `pg:"cycle_id" ` //周期id | ||
82 | + CycleName string `pg:"cycle_name"` //周期名称 | ||
83 | + BeginTime time.Time `pg:"begin_time"` | ||
84 | +} | ||
85 | + | ||
78 | // GetExecutorCycleList 获取被评估目标人拥有的周期列表 | 86 | // GetExecutorCycleList 获取被评估目标人拥有的周期列表 |
79 | // executorId 执行人id | 87 | // executorId 执行人id |
80 | // offset,limit 分页 | 88 | // offset,limit 分页 |
81 | -func (d *SummaryEvaluationDao) GetTargetUserCycleList(executorId int, offset int, limit int, evaluationType int) ([]PersonalCycle, error) { | 89 | +func (d *SummaryEvaluationDao) GetTargetUserCycleList(executorId int, offset int, limit int, evaluationType int) ([]TargetUserCycle, error) { |
82 | sqlStr := `select | 90 | sqlStr := `select |
83 | distinct | 91 | distinct |
84 | summary_evaluation.cycle_id , | 92 | summary_evaluation.cycle_id , |
93 | + summary_evaluation.begin_time , | ||
85 | summary_evaluation.cycle_name | 94 | summary_evaluation.cycle_name |
86 | from summary_evaluation | 95 | from summary_evaluation |
87 | where summary_evaluation.target_user ->>'userId'='?' | 96 | where summary_evaluation.target_user ->>'userId'='?' |
@@ -97,8 +106,8 @@ func (d *SummaryEvaluationDao) GetTargetUserCycleList(executorId int, offset int | @@ -97,8 +106,8 @@ func (d *SummaryEvaluationDao) GetTargetUserCycleList(executorId int, offset int | ||
97 | } | 106 | } |
98 | 107 | ||
99 | condition = append(condition, offset, limit) | 108 | condition = append(condition, offset, limit) |
100 | - sqlStr += ` offset ? limit ? ` | ||
101 | - result := []PersonalCycle{} | 109 | + sqlStr += ` order by summary_evaluation.begin_time desc offset ? limit ? ` |
110 | + result := []TargetUserCycle{} | ||
102 | _, err := tx.Query(&result, sqlStr, condition...) | 111 | _, err := tx.Query(&result, sqlStr, condition...) |
103 | return result, err | 112 | return result, err |
104 | } | 113 | } |
-
请 注册 或 登录 后发表评论