作者 tangxvhui

更新

@@ -684,6 +684,7 @@ func (srv TaskService) ListTask2(param *command.SearchTaskCommand) (map[string]i @@ -684,6 +684,7 @@ func (srv TaskService) ListTask2(param *command.SearchTaskCommand) (map[string]i
684 Limit: limit, 684 Limit: limit,
685 Offset: offset, 685 Offset: offset,
686 UserId: param.UserId, 686 UserId: param.UserId,
  687 + CompanyId: param.CompanyId,
687 TaskName: param.TaskName, 688 TaskName: param.TaskName,
688 LevelName: param.LevelName, 689 LevelName: param.LevelName,
689 OnlyMy: param.OnlyMy, 690 OnlyMy: param.OnlyMy,
@@ -783,6 +784,7 @@ func (srv TaskService) listTask2ForHrbp(param *command.SearchTaskCommand) (map[s @@ -783,6 +784,7 @@ func (srv TaskService) listTask2ForHrbp(param *command.SearchTaskCommand) (map[s
783 Limit: limit, 784 Limit: limit,
784 Offset: offset, 785 Offset: offset,
785 UserId: param.UserId, 786 UserId: param.UserId,
  787 + CompanyId: param.CompanyId,
786 TaskName: param.TaskName, 788 TaskName: param.TaskName,
787 LevelName: param.LevelName, 789 LevelName: param.LevelName,
788 OnlyMy: param.OnlyMy, 790 OnlyMy: param.OnlyMy,
@@ -62,6 +62,7 @@ func (d *TaskDao) catchTaskIdByPermission(userId int) string { @@ -62,6 +62,7 @@ func (d *TaskDao) catchTaskIdByPermission(userId int) string {
62 type ListTaskCondition struct { 62 type ListTaskCondition struct {
63 Limit int //分页 63 Limit int //分页
64 Offset int //分页 64 Offset int //分页
  65 + CompanyId int //公司id
65 UserId int //谁要查看任务数据 66 UserId int //谁要查看任务数据
66 TaskName string //任务名称 67 TaskName string //任务名称
67 LevelName string //优先级 68 LevelName string //优先级
@@ -125,7 +126,7 @@ func (d *TaskDao) ListTaskStageNotHrbp(param ListTaskCondition) ([]ListTaskStage @@ -125,7 +126,7 @@ func (d *TaskDao) ListTaskStageNotHrbp(param ListTaskCondition) ([]ListTaskStage
125 from task 126 from task
126 join t_task_1 on task.id=t_task_1.id 127 join t_task_1 on task.id=t_task_1.id
127 join task_stage on task.id =task_stage.task_id 128 join task_stage on task.id =task_stage.task_id
128 - where 1=1 129 + where 1=1 and task.company_id=?
129 order by diff_time,task."level",task.created_at 130 order by diff_time,task."level",task.created_at
130 ), 131 ),
131 -- 按任务数据分页获取 132 -- 按任务数据分页获取
@@ -156,7 +157,7 @@ func (d *TaskDao) ListTaskStageNotHrbp(param ListTaskCondition) ([]ListTaskStage @@ -156,7 +157,7 @@ func (d *TaskDao) ListTaskStageNotHrbp(param ListTaskCondition) ([]ListTaskStage
156 where t_task_tage_1.task_id in( 157 where t_task_tage_1.task_id in(
157 select t_task_page.task_id from t_task_page 158 select t_task_page.task_id from t_task_page
158 )` 159 )`
159 - condition := []interface{}{} 160 + condition := []interface{}{param.CompanyId}
160 whereSql := `` 161 whereSql := ``
161 if param.OnlyMy { 162 if param.OnlyMy {
162 condition = append(condition, param.UserId) 163 condition = append(condition, param.UserId)
@@ -186,8 +187,8 @@ func (d *TaskDao) CountTaskStageNotHrbp(param ListTaskCondition) (int, error) { @@ -186,8 +187,8 @@ func (d *TaskDao) CountTaskStageNotHrbp(param ListTaskCondition) (int, error) {
186 task1 := d.catchTaskIdByPermission(param.UserId) 187 task1 := d.catchTaskIdByPermission(param.UserId)
187 withSql := task1 + `select count(*) from task 188 withSql := task1 + `select count(*) from task
188 join t_task_1 on task.id =t_task_1.id 189 join t_task_1 on task.id =t_task_1.id
189 - where 1=1 `  
190 - condition := []interface{}{} 190 + where 1=1 and task.company_id=?`
  191 + condition := []interface{}{param.CompanyId}
191 whereSql := `` 192 whereSql := ``
192 if param.OnlyMy { 193 if param.OnlyMy {
193 condition = append(condition, param.UserId) 194 condition = append(condition, param.UserId)
@@ -247,7 +248,7 @@ func (d *TaskDao) ListTaskStageByHrbp(param ListTaskCondition) ([]ListTaskStage, @@ -247,7 +248,7 @@ func (d *TaskDao) ListTaskStageByHrbp(param ListTaskCondition) ([]ListTaskStage,
247 end) as diff_time 248 end) as diff_time
248 from task 249 from task
249 join task_stage on task.id =task_stage.task_id 250 join task_stage on task.id =task_stage.task_id
250 - where 1=1 251 + where 1=1 and task.company_id=?
251 order by diff_time,task."level",task.created_at 252 order by diff_time,task."level",task.created_at
252 ), 253 ),
253 -- 按任务数据分页获取 254 -- 按任务数据分页获取
@@ -280,7 +281,7 @@ func (d *TaskDao) ListTaskStageByHrbp(param ListTaskCondition) ([]ListTaskStage, @@ -280,7 +281,7 @@ func (d *TaskDao) ListTaskStageByHrbp(param ListTaskCondition) ([]ListTaskStage,
280 where t_task_tage_1.task_id in( 281 where t_task_tage_1.task_id in(
281 select t_task_page.task_id from t_task_page 282 select t_task_page.task_id from t_task_page
282 )` 283 )`
283 - condition := []interface{}{param.UserId} 284 + condition := []interface{}{param.UserId, param.CompanyId}
284 whereSql := `` 285 whereSql := ``
285 if param.OnlyMy { 286 if param.OnlyMy {
286 condition = append(condition, param.UserId) 287 condition = append(condition, param.UserId)
@@ -313,8 +314,8 @@ func (d *TaskDao) CountTaskStageByHrbp(param ListTaskCondition) (int, error) { @@ -313,8 +314,8 @@ func (d *TaskDao) CountTaskStageByHrbp(param ListTaskCondition) (int, error) {
313 select task_ignore.task_id,task_ignore.id from task_ignore where task_ignore.user_id =? 314 select task_ignore.task_id,task_ignore.id from task_ignore where task_ignore.user_id =?
314 )select count(*) from task 315 )select count(*) from task
315 left join t_task_ignore on t_task_ignore.task_id=task.id 316 left join t_task_ignore on t_task_ignore.task_id=task.id
316 - where 1=1 `  
317 - condition := []interface{}{param.UserId} 317 + where 1=1 and task.company_id=?`
  318 + condition := []interface{}{param.UserId, param.CompanyId}
318 whereSql := `` 319 whereSql := ``
319 if param.OnlyMy { 320 if param.OnlyMy {
320 condition = append(condition, param.UserId) 321 condition = append(condition, param.UserId)
@@ -345,13 +346,13 @@ func (d *TaskDao) CountTaskStageAnomalyNotHrbp(param ListTaskCondition) (int, er @@ -345,13 +346,13 @@ func (d *TaskDao) CountTaskStageAnomalyNotHrbp(param ListTaskCondition) (int, er
345 from task_stage 346 from task_stage
346 join task on task_stage.task_id =task.id 347 join task on task_stage.task_id =task.id
347 join t_task_1 on task.id =t_task_1.id 348 join t_task_1 on task.id =t_task_1.id
348 - where 1=1 349 + where 1=1 and task.company_id=?
349 and( 350 and(
350 (task_stage.plan_completed_at <task_stage.real_completed_at) 351 (task_stage.plan_completed_at <task_stage.real_completed_at)
351 or 352 or
352 (task_stage.real_completed_at=0 and task_stage.plan_completed_at<extract(epoch from now())) 353 (task_stage.real_completed_at=0 and task_stage.plan_completed_at<extract(epoch from now()))
353 ) ` 354 ) `
354 - condition := []interface{}{} 355 + condition := []interface{}{param.CompanyId}
355 whereSql := `` 356 whereSql := ``
356 if param.OnlyMy { 357 if param.OnlyMy {
357 condition = append(condition, param.UserId) 358 condition = append(condition, param.UserId)
@@ -384,13 +385,13 @@ func (d *TaskDao) CountTaskStageAnomalyByHrbp(param ListTaskCondition) (int, err @@ -384,13 +385,13 @@ func (d *TaskDao) CountTaskStageAnomalyByHrbp(param ListTaskCondition) (int, err
384 from task_stage 385 from task_stage
385 join task on task_stage.task_id =task.id 386 join task on task_stage.task_id =task.id
386 left join t_task_ignore on t_task_ignore.task_id=task.id 387 left join t_task_ignore on t_task_ignore.task_id=task.id
387 - where 1=1 388 + where 1=1 and task.company_id=?
388 and( 389 and(
389 (task_stage.plan_completed_at <task_stage.real_completed_at) 390 (task_stage.plan_completed_at <task_stage.real_completed_at)
390 or 391 or
391 (task_stage.real_completed_at=0 and task_stage.plan_completed_at<extract(epoch from now())) 392 (task_stage.real_completed_at=0 and task_stage.plan_completed_at<extract(epoch from now()))
392 ) ` 393 ) `
393 - condition := []interface{}{param.UserId} 394 + condition := []interface{}{param.UserId, param.CompanyId}
394 whereSql := `` 395 whereSql := ``
395 if param.OnlyMy { 396 if param.OnlyMy {
396 condition = append(condition, param.UserId) 397 condition = append(condition, param.UserId)