正在显示
3 个修改的文件
包含
11 行增加
和
15 行删除
@@ -3,6 +3,6 @@ package query | @@ -3,6 +3,6 @@ package query | ||
3 | type ListTargetUserCycleQuery struct { | 3 | type ListTargetUserCycleQuery struct { |
4 | PageNumber int `json:"pageNumber"` | 4 | PageNumber int `json:"pageNumber"` |
5 | PageSize int `json:"pageSize"` | 5 | PageSize int `json:"pageSize"` |
6 | - CompanyId int `json:"companyId"` // | 6 | + CompanyId int `json:"-"` // |
7 | TargetUserId int `json:"targetUserId,string"` //评估的执行人,必填 | 7 | TargetUserId int `json:"targetUserId,string"` //评估的执行人,必填 |
8 | } | 8 | } |
@@ -176,30 +176,27 @@ func (d *StaffAssessDao) catchProjectIdByPermission(companyId int, cycleId int, | @@ -176,30 +176,27 @@ func (d *StaffAssessDao) catchProjectIdByPermission(companyId int, cycleId int, | ||
176 | type TargetUserCycleProject struct { | 176 | type TargetUserCycleProject struct { |
177 | CycleId string `pg:"cycle_id" json:"cycleId"` //周期id | 177 | CycleId string `pg:"cycle_id" json:"cycleId"` //周期id |
178 | CycleName string `pg:"cycle_name" json:"cycleName"` //周期名称 | 178 | CycleName string `pg:"cycle_name" json:"cycleName"` //周期名称 |
179 | - EvaluationProjectIds []string `pg:"evaluation_project_ids,array" json:"evaluationProjectIds"` | 179 | + EvaluationProjectId string `pg:"evaluation_project_id" json:"evaluationProjectId"` |
180 | + EvaluationProjectName string `pg:"evaluation_project_name" json:"evaluationProjectName"` | ||
180 | } | 181 | } |
181 | 182 | ||
182 | // 获取目标员工的自评周期和项目 | 183 | // 获取目标员工的自评周期和项目 |
183 | func (d *StaffAssessDao) SearchTargetUserCycleProject(companyId int, targetUserId int, limit int, offset int) ([]TargetUserCycleProject, error) { | 184 | func (d *StaffAssessDao) SearchTargetUserCycleProject(companyId int, targetUserId int, limit int, offset int) ([]TargetUserCycleProject, error) { |
184 | - sqlStr := ` with t_staff_assess as ( | ||
185 | - select distinct staff_assess.cycle_id , | 185 | + sqlStr := `select distinct |
186 | staff_assess.cycle_name, | 186 | staff_assess.cycle_name, |
187 | - staff_assess.evaluation_project_id | ||
188 | - from staff_assess | 187 | + staff_assess.cycle_id , |
188 | + staff_assess.evaluation_project_id, | ||
189 | + staff_assess.evaluation_project_name | ||
190 | + from staff_assess ,staff_assess_task | ||
189 | where 1=1 | 191 | where 1=1 |
192 | + and staff_assess_task.id =staff_assess.staff_assess_task_id | ||
190 | and staff_assess."types" ='self' | 193 | and staff_assess."types" ='self' |
194 | + and staff_assess_task.deleted_at isnull | ||
191 | and staff_assess.deleted_at isnull | 195 | and staff_assess.deleted_at isnull |
192 | and staff_assess.target_user ->>'userId'='?' | 196 | and staff_assess.target_user ->>'userId'='?' |
193 | and staff_assess.company_id=? | 197 | and staff_assess.company_id=? |
194 | - ) | ||
195 | - select | ||
196 | - t_staff_assess.cycle_id, | ||
197 | - t_staff_assess.cycle_name, | ||
198 | - array_agg(to_char(t_staff_assess.evaluation_project_id,'9999999999999999999')) as evaluation_project_ids | ||
199 | - from t_staff_assess | ||
200 | - group by cycle_id,cycle_name | ||
201 | - limit ? offset ? | ||
202 | ` | 198 | ` |
199 | + sqlStr += ` order by cycle_id desc limit ? offset ? ` | ||
203 | condition := []interface{}{targetUserId, companyId, limit, offset} | 200 | condition := []interface{}{targetUserId, companyId, limit, offset} |
204 | result := []TargetUserCycleProject{} | 201 | result := []TargetUserCycleProject{} |
205 | tx := d.transactionContext.PgTx | 202 | tx := d.transactionContext.PgTx |
@@ -337,7 +337,6 @@ func (c *StaffAssessController) ListTargetUserSelfCycle() { | @@ -337,7 +337,6 @@ func (c *StaffAssessController) ListTargetUserSelfCycle() { | ||
337 | } | 337 | } |
338 | userReq := middlewares.GetUser(c.Ctx) | 338 | userReq := middlewares.GetUser(c.Ctx) |
339 | paramReq.CompanyId = int(userReq.CompanyId) | 339 | paramReq.CompanyId = int(userReq.CompanyId) |
340 | - paramReq.TargetUserId = int(userReq.UserId) | ||
341 | data, err := srv.ListTargetUserSelfCycle(paramReq) | 340 | data, err := srv.ListTargetUserSelfCycle(paramReq) |
342 | c.Response(data, err) | 341 | c.Response(data, err) |
343 | } | 342 | } |
-
请 注册 或 登录 后发表评论