作者 yangfu

机会池排序修改

@@ -266,7 +266,7 @@ func GetChancePoolAll(uid, cid int64, chanceTypeId int, lastId int64, pageSize i @@ -266,7 +266,7 @@ func GetChancePoolAll(uid, cid int64, chanceTypeId int, lastId int64, pageSize i
266 266
267 sql := `select a.*,b.images,speechs,videos 267 sql := `select a.*,b.images,speechs,videos
268 from ( 268 from (
269 -select id,user_id,create_at,source_content,review_status,audit_template_id,chance_type_id,comment_total,zan_total,view_total from chance 269 +select id,user_id,approve_time create_at,source_content,review_status,audit_template_id,chance_type_id,comment_total,zan_total,view_total from chance
270 where company_id=? and review_status=3 and (?=0 or chance_type_id =?) and (?=0 or id<?) and enable_status=1 and status=1 270 where company_id=? and review_status=3 and (?=0 or chance_type_id =?) and (?=0 or id<?) and enable_status=1 and status=1
271 ) a left JOIN chance_data b on a.id =b.chance_id 271 ) a left JOIN chance_data b on a.id =b.chance_id
272 order by create_at desc 272 order by create_at desc
@@ -297,23 +297,23 @@ func GetChancePoolSpecialDepartment(uid, cid int64, chanceTypeId int, lastId int @@ -297,23 +297,23 @@ func GetChancePoolSpecialDepartment(uid, cid int64, chanceTypeId int, lastId int
297 select a.*,b.images,speechs,videos from ( 297 select a.*,b.images,speechs,videos from (
298 select * from ( 298 select * from (
299 ##公司公开的机会 299 ##公司公开的机会
300 - select id,user_id,create_at,source_content,review_status,audit_template_id,chance_type_id,comment_total,zan_total,view_total,enable_status,department_id,status from chance  
301 - where company_id = %v and publish_status = 2 300 + select id,user_id,approve_time create_at,source_content,review_status,audit_template_id,chance_type_id,comment_total,zan_total,view_total,enable_status,department_id,status from chance
  301 + where company_id = %v and publish_status = 2 and review_status=3
302 UNION 302 UNION
303 303
304 ##指定部门-机会提交的部门 304 ##指定部门-机会提交的部门
305 - select id,user_id,create_at,source_content,review_status,audit_template_id,chance_type_id,comment_total,zan_total,view_total,enable_status,department_id,status from chance  
306 - where department_id in (%v) 305 + select id,user_id,approve_time create_at,source_content,review_status,audit_template_id,chance_type_id,comment_total,zan_total,view_total,enable_status,department_id,status from chance
  306 + where department_id in (%v) and review_status=3
307 UNION 307 UNION
308 308
309 ##本人 309 ##本人
310 - select id,user_id,create_at,source_content,review_status,audit_template_id,chance_type_id,comment_total,zan_total,view_total,enable_status,department_id,status from chance  
311 - where user_id = %v 310 + select id,user_id,approve_time create_at,source_content,review_status,audit_template_id,chance_type_id,comment_total,zan_total,view_total,enable_status,department_id,status from chance
  311 + where user_id = %v and review_status=3
312 UNION 312 UNION
313 313
314 ##我审核 314 ##我审核
315 - select id,user_id,create_at,source_content,review_status,audit_template_id,chance_type_id,comment_total,zan_total,view_total,enable_status,department_id,status from (  
316 - select DISTINCT chance_id from audit_flow_process where uid =%v 315 + select id,user_id,approve_time create_at,source_content,review_status,audit_template_id,chance_type_id,comment_total,zan_total,view_total,enable_status,department_id,status from (
  316 + select DISTINCT chance_id from audit_flow_process where uid =%v and review_status=3
317 ) a inner join chance b on a.chance_id = b.id 317 ) a inner join chance b on a.chance_id = b.id
318 318
319 ) a where review_status=3 and (0=%v or chance_type_id =%v) and (0=%v or id<%v) and a.enable_status=1 and status=1 319 ) a where review_status=3 and (0=%v or chance_type_id =%v) and (0=%v or id<%v) and a.enable_status=1 and status=1
@@ -364,29 +364,31 @@ func GetChancePoolDepartment(uid, cid int64, chanceTypeId int, lastId int64, pag @@ -364,29 +364,31 @@ func GetChancePoolDepartment(uid, cid int64, chanceTypeId int, lastId int64, pag
364 select a.*,b.images,speechs,videos from ( 364 select a.*,b.images,speechs,videos from (
365 select * from ( 365 select * from (
366 ##指定部门-机会公开的部门 366 ##指定部门-机会公开的部门
367 - select id,user_id,create_at,source_content,review_status,audit_template_id,chance_type_id,comment_total,zan_total,view_total,enable_status,department_id,status from ( 367 + select id,user_id,approve_time create_at,source_content,review_status,audit_template_id,chance_type_id,comment_total,zan_total,view_total,enable_status,department_id,status from (
368 select DISTINCT chance_id from chance_department where department_id in (%v) 368 select DISTINCT chance_id from chance_department where department_id in (%v)
369 )a inner join chance b on a.chance_id = b.id 369 )a inner join chance b on a.chance_id = b.id
  370 + where review_status=3
  371 +
370 UNION 372 UNION
371 373
372 ##公司公开的机会 374 ##公司公开的机会
373 - select id,user_id,create_at,source_content,review_status,audit_template_id,chance_type_id,comment_total,zan_total,view_total,enable_status,department_id,status from chance  
374 - where company_id = %v and publish_status = 2 375 + select id,user_id,approve_time create_at,source_content,review_status,audit_template_id,chance_type_id,comment_total,zan_total,view_total,enable_status,department_id,status from chance
  376 + where company_id = %v and publish_status = 2 and review_status=3
375 UNION 377 UNION
376 378
377 ##指定部门-机会提交的部门 379 ##指定部门-机会提交的部门
378 - select id,user_id,create_at,source_content,review_status,audit_template_id,chance_type_id,comment_total,zan_total,view_total,enable_status,department_id,status from chance  
379 - where department_id in (%v) 380 + select id,user_id,approve_time create_at,source_content,review_status,audit_template_id,chance_type_id,comment_total,zan_total,view_total,enable_status,department_id,status from chance
  381 + where department_id in (%v) and review_status=3
380 UNION 382 UNION
381 383
382 ##本人 384 ##本人
383 - select id,user_id,create_at,source_content,review_status,audit_template_id,chance_type_id,comment_total,zan_total,view_total,enable_status,department_id,status from chance  
384 - where user_id = %v 385 + select id,user_id,approve_time create_at,source_content,review_status,audit_template_id,chance_type_id,comment_total,zan_total,view_total,enable_status,department_id,status from chance
  386 + where user_id = %v and review_status=3
385 UNION 387 UNION
386 388
387 ##我审核 389 ##我审核
388 - select id,user_id,create_at,source_content,review_status,audit_template_id,chance_type_id,comment_total,zan_total,view_total,enable_status,department_id,status from (  
389 - select DISTINCT chance_id from audit_flow_process where uid =%v 390 + select id,user_id,approve_time create_at,source_content,review_status,audit_template_id,chance_type_id,comment_total,zan_total,view_total,enable_status,department_id,status from (
  391 + select DISTINCT chance_id from audit_flow_process where uid =%v and review_status=3
390 ) a inner join chance b on a.chance_id = b.id 392 ) a inner join chance b on a.chance_id = b.id
391 393
392 ) a where review_status=3 and (0=%v or chance_type_id =%v) and (0=%v or id<%v) and a.enable_status=1 and status=1 394 ) a where review_status=3 and (0=%v or chance_type_id =%v) and (0=%v or id<%v) and a.enable_status=1 and status=1
@@ -401,26 +403,28 @@ select count(0) from ( @@ -401,26 +403,28 @@ select count(0) from (
401 select id,user_id,create_at,source_content,review_status,audit_template_id,chance_type_id,comment_total,zan_total,view_total,enable_status,department_id,status from ( 403 select id,user_id,create_at,source_content,review_status,audit_template_id,chance_type_id,comment_total,zan_total,view_total,enable_status,department_id,status from (
402 select DISTINCT chance_id from chance_department where department_id in (%v) 404 select DISTINCT chance_id from chance_department where department_id in (%v)
403 )a inner join chance b on a.chance_id = b.id 405 )a inner join chance b on a.chance_id = b.id
  406 + where review_status=3
  407 +
404 UNION 408 UNION
405 409
406 ##公司公开的机会 410 ##公司公开的机会
407 select id,user_id,create_at,source_content,review_status,audit_template_id,chance_type_id,comment_total,zan_total,view_total,enable_status,department_id,status from chance 411 select id,user_id,create_at,source_content,review_status,audit_template_id,chance_type_id,comment_total,zan_total,view_total,enable_status,department_id,status from chance
408 - where company_id = %v and publish_status = 2 412 + where company_id = %v and publish_status = 2 and review_status=3
409 UNION 413 UNION
410 414
411 ##指定部门-机会提交的部门 415 ##指定部门-机会提交的部门
412 select id,user_id,create_at,source_content,review_status,audit_template_id,chance_type_id,comment_total,zan_total,view_total,enable_status,department_id,status from chance 416 select id,user_id,create_at,source_content,review_status,audit_template_id,chance_type_id,comment_total,zan_total,view_total,enable_status,department_id,status from chance
413 - where department_id in (%v) 417 + where department_id in (%v) and review_status=3
414 UNION 418 UNION
415 419
416 ##本人 420 ##本人
417 select id,user_id,create_at,source_content,review_status,audit_template_id,chance_type_id,comment_total,zan_total,view_total,enable_status,department_id,status from chance 421 select id,user_id,create_at,source_content,review_status,audit_template_id,chance_type_id,comment_total,zan_total,view_total,enable_status,department_id,status from chance
418 - where user_id = %v 422 + where user_id = %v and review_status=3
419 UNION 423 UNION
420 424
421 ##我审核 425 ##我审核
422 select id,user_id,create_at,source_content,review_status,audit_template_id,chance_type_id,comment_total,zan_total,view_total,enable_status,department_id,status from ( 426 select id,user_id,create_at,source_content,review_status,audit_template_id,chance_type_id,comment_total,zan_total,view_total,enable_status,department_id,status from (
423 - select DISTINCT chance_id from audit_flow_process where uid =%v 427 + select DISTINCT chance_id from audit_flow_process where uid =%v and review_status=3
424 ) a inner join chance b on a.chance_id = b.id 428 ) a inner join chance b on a.chance_id = b.id
425 429
426 ) a where review_status=3 and (0=%v or chance_type_id =%v) and a.enable_status=1 and status=1 430 ) a where review_status=3 and (0=%v or chance_type_id =%v) and a.enable_status=1 and status=1
@@ -442,24 +446,26 @@ func GetChancePoolPublicCompany(uid, cid int64, chanceTypeId int, lastId int64, @@ -442,24 +446,26 @@ func GetChancePoolPublicCompany(uid, cid int64, chanceTypeId int, lastId int64,
442 select a.*,b.images,speechs,videos from ( 446 select a.*,b.images,speechs,videos from (
443 select * from ( 447 select * from (
444 ##公司公开的机会 448 ##公司公开的机会
445 - select id,user_id,create_at,source_content,review_status,audit_template_id,chance_type_id,comment_total,zan_total,view_total,enable_status,department_id,status from chance  
446 - where company_id = %v and publish_status = 2 449 + select id,user_id,approve_time create_at,source_content,review_status,audit_template_id,chance_type_id,comment_total,zan_total,view_total,enable_status,department_id,status from chance
  450 + where company_id = %v and publish_status = 2 and review_status=3
447 451
448 UNION 452 UNION
449 ##指定部门-机会公开的部门 453 ##指定部门-机会公开的部门
450 - select id,user_id,create_at,source_content,review_status,audit_template_id,chance_type_id,comment_total,zan_total,view_total,enable_status,department_id,status from ( 454 + select id,user_id,approve_time create_at,source_content,review_status,audit_template_id,chance_type_id,comment_total,zan_total,view_total,enable_status,department_id,status from (
451 select DISTINCT chance_id from chance_department where department_id in (%v) 455 select DISTINCT chance_id from chance_department where department_id in (%v)
452 )a inner join chance b on a.chance_id = b.id 456 )a inner join chance b on a.chance_id = b.id
  457 + where review_status=3
  458 +
453 UNION 459 UNION
454 460
455 ##本人 461 ##本人
456 - select id,user_id,create_at,source_content,review_status,audit_template_id,chance_type_id,comment_total,zan_total,view_total,enable_status,department_id,status from chance  
457 - where user_id = %v 462 + select id,user_id,approve_time create_at,source_content,review_status,audit_template_id,chance_type_id,comment_total,zan_total,view_total,enable_status,department_id,status from chance
  463 + where user_id = %v and review_status=3
458 UNION 464 UNION
459 465
460 ##我审核 466 ##我审核
461 - select id,user_id,create_at,source_content,review_status,audit_template_id,chance_type_id,comment_total,zan_total,view_total,enable_status,department_id,status from (  
462 - select DISTINCT chance_id from audit_flow_process where uid =%v 467 + select id,user_id,approve_time create_at,source_content,review_status,audit_template_id,chance_type_id,comment_total,zan_total,view_total,enable_status,department_id,status from (
  468 + select DISTINCT chance_id from audit_flow_process where uid =%v and review_status=3
463 ) a inner join chance b on a.chance_id = b.id 469 ) a inner join chance b on a.chance_id = b.id
464 470
465 ) a where review_status=3 and (0=%v or chance_type_id =%v) and (0=%v or id<%v) and a.enable_status=1 and status=1 471 ) a where review_status=3 and (0=%v or chance_type_id =%v) and (0=%v or id<%v) and a.enable_status=1 and status=1
@@ -471,12 +477,12 @@ limit %v @@ -471,12 +477,12 @@ limit %v
471 sqlCount := fmt.Sprintf(` 477 sqlCount := fmt.Sprintf(`
472 select count(0) from ( 478 select count(0) from (
473 ##公司公开的机会 479 ##公司公开的机会
474 - select id,user_id,create_at,source_content,review_status,audit_template_id,chance_type_id,comment_total,zan_total,view_total,enable_status,department_id,status from chance 480 + select id,user_id,approve_time create_at,source_content,review_status,audit_template_id,chance_type_id,comment_total,zan_total,view_total,enable_status,department_id,status from chance
475 where company_id = %v and publish_status = 2 481 where company_id = %v and publish_status = 2
476 482
477 UNION 483 UNION
478 ##指定部门-机会公开的部门 484 ##指定部门-机会公开的部门
479 - select id,user_id,create_at,source_content,review_status,audit_template_id,chance_type_id,comment_total,zan_total,view_total,enable_status,department_id,status from ( 485 + select id,user_id,approve_time create_at,source_content,review_status,audit_template_id,chance_type_id,comment_total,zan_total,view_total,enable_status,department_id,status from (
480 select DISTINCT chance_id from chance_department where department_id in (%v) 486 select DISTINCT chance_id from chance_department where department_id in (%v)
481 )a inner join chance b on a.chance_id = b.id 487 )a inner join chance b on a.chance_id = b.id
482 UNION 488 UNION
@@ -487,7 +493,7 @@ select count(0) from ( @@ -487,7 +493,7 @@ select count(0) from (
487 UNION 493 UNION
488 494
489 ##我审核 495 ##我审核
490 - select id,user_id,create_at,source_content,review_status,audit_template_id,chance_type_id,comment_total,zan_total,view_total,enable_status,department_id,status from ( 496 + select id,user_id,approve_time create_at,source_content,review_status,audit_template_id,chance_type_id,comment_total,zan_total,view_total,enable_status,department_id,status from (
491 select DISTINCT chance_id from audit_flow_process where uid =%v 497 select DISTINCT chance_id from audit_flow_process where uid =%v
492 ) a inner join chance b on a.chance_id = b.id 498 ) a inner join chance b on a.chance_id = b.id
493 499
@@ -510,13 +516,13 @@ func GetChancePoolMyself(uid, cid int64, chanceTypeId int, lastId int64, pageSiz @@ -510,13 +516,13 @@ func GetChancePoolMyself(uid, cid int64, chanceTypeId int, lastId int64, pageSiz
510 select a.*,b.images,speechs,videos from ( 516 select a.*,b.images,speechs,videos from (
511 select * from ( 517 select * from (
512 ##本人 518 ##本人
513 - select id,user_id,create_at,source_content,review_status,audit_template_id,chance_type_id,comment_total,zan_total,view_total,enable_status,department_id,status from chance  
514 - where user_id = %v 519 + select id,user_id,approve_time create_at,source_content,review_status,audit_template_id,chance_type_id,comment_total,zan_total,view_total,enable_status,department_id,status from chance
  520 + where user_id = %v and review_status=3
515 UNION 521 UNION
516 522
517 ##我审核 523 ##我审核
518 - select id,user_id,create_at,source_content,review_status,audit_template_id,chance_type_id,comment_total,zan_total,view_total,enable_status,department_id,status from (  
519 - select DISTINCT chance_id from audit_flow_process where uid =%v 524 + select id,user_id,approve_time create_at,source_content,review_status,audit_template_id,chance_type_id,comment_total,zan_total,view_total,enable_status,department_id,status from (
  525 + select DISTINCT chance_id from audit_flow_process where uid =%v and review_status=3
520 ) a inner join chance b on a.chance_id = b.id 526 ) a inner join chance b on a.chance_id = b.id
521 527
522 ) a where review_status=3 and (0=%v or chance_type_id =%v) and (0=%v or id<%v) and a.enable_status=1 and status=1 528 ) a where review_status=3 and (0=%v or chance_type_id =%v) and (0=%v or id<%v) and a.enable_status=1 and status=1