正在显示
1 个修改的文件
包含
7 行增加
和
6 行删除
| @@ -268,15 +268,16 @@ func GetChancePoolAll(uid, cid int64, chanceTypeId int, lastId int64, pageSize i | @@ -268,15 +268,16 @@ func GetChancePoolAll(uid, cid int64, chanceTypeId int, lastId int64, pageSize i | ||
| 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,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 | order by create_at desc | 272 | order by create_at desc |
| 272 | limit ? | 273 | limit ? |
| 273 | -) a left JOIN chance_data b on a.id =b.chance_id` | 274 | +` |
| 275 | + | ||
| 274 | //if public==protocol.pu | 276 | //if public==protocol.pu |
| 275 | 277 | ||
| 276 | sqlCount := fmt.Sprintf(`select count(0) from ( | 278 | sqlCount := fmt.Sprintf(`select count(0) from ( |
| 277 | select id from chance | 279 | select id from chance |
| 278 | where company_id=? and review_status=3 and (%v=0 or chance_type_id =%v) and enable_status=1 and status=1 | 280 | where company_id=? and review_status=3 and (%v=0 or chance_type_id =%v) and enable_status=1 and status=1 |
| 279 | -order by create_at desc | ||
| 280 | ) a left JOIN chance_data b on a.id =b.chance_id`, chanceTypeId, chanceTypeId) | 281 | ) a left JOIN chance_data b on a.id =b.chance_id`, chanceTypeId, chanceTypeId) |
| 281 | if err = utils.ExecuteQueryOne(&total, sqlCount, cid); err != nil { | 282 | if err = utils.ExecuteQueryOne(&total, sqlCount, cid); err != nil { |
| 282 | return | 283 | return |
| @@ -316,9 +317,9 @@ select * from ( | @@ -316,9 +317,9 @@ select * from ( | ||
| 316 | ) a inner join chance b on a.chance_id = b.id | 317 | ) a inner join chance b on a.chance_id = b.id |
| 317 | 318 | ||
| 318 | ) 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 |
| 320 | +) a left JOIN chance_data b on a.id =b.chance_id | ||
| 319 | order by create_at desc | 321 | order by create_at desc |
| 320 | limit %v | 322 | limit %v |
| 321 | -) a left JOIN chance_data b on a.id =b.chance_id | ||
| 322 | `, cid, utils.JoinInt64s(departmentIds, ","), uid, uid, chanceTypeId, chanceTypeId, lastId, lastId, pageSize) | 323 | `, cid, utils.JoinInt64s(departmentIds, ","), uid, uid, chanceTypeId, chanceTypeId, lastId, lastId, pageSize) |
| 323 | 324 | ||
| 324 | sqlCount := fmt.Sprintf(` | 325 | sqlCount := fmt.Sprintf(` |
| @@ -389,9 +390,9 @@ select * from ( | @@ -389,9 +390,9 @@ select * from ( | ||
| 389 | ) a inner join chance b on a.chance_id = b.id | 390 | ) a inner join chance b on a.chance_id = b.id |
| 390 | 391 | ||
| 391 | ) 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 | 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 |
| 393 | +) a left JOIN chance_data b on a.id =b.chance_id | ||
| 392 | order by create_at desc | 394 | order by create_at desc |
| 393 | limit %v | 395 | limit %v |
| 394 | -) a left JOIN chance_data b on a.id =b.chance_id | ||
| 395 | `, utils.JoinInt64s(userDepartmetIds, ","), cid, utils.JoinInt64s(departmentIds, ","), uid, uid, chanceTypeId, chanceTypeId, lastId, lastId, pageSize) | 396 | `, utils.JoinInt64s(userDepartmetIds, ","), cid, utils.JoinInt64s(departmentIds, ","), uid, uid, chanceTypeId, chanceTypeId, lastId, lastId, pageSize) |
| 396 | 397 | ||
| 397 | sqlCount := fmt.Sprintf(` | 398 | sqlCount := fmt.Sprintf(` |
| @@ -462,9 +463,9 @@ select * from ( | @@ -462,9 +463,9 @@ select * from ( | ||
| 462 | ) a inner join chance b on a.chance_id = b.id | 463 | ) a inner join chance b on a.chance_id = b.id |
| 463 | 464 | ||
| 464 | ) 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 | 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 |
| 466 | +) a left JOIN chance_data b on a.id =b.chance_id | ||
| 465 | order by create_at desc | 467 | order by create_at desc |
| 466 | limit %v | 468 | limit %v |
| 467 | -) a left JOIN chance_data b on a.id =b.chance_id | ||
| 468 | `, cid, utils.JoinInt64s(departmentIds, ","), uid, uid, chanceTypeId, chanceTypeId, lastId, lastId, pageSize) | 469 | `, cid, utils.JoinInt64s(departmentIds, ","), uid, uid, chanceTypeId, chanceTypeId, lastId, lastId, pageSize) |
| 469 | 470 | ||
| 470 | sqlCount := fmt.Sprintf(` | 471 | sqlCount := fmt.Sprintf(` |
| @@ -519,9 +520,9 @@ select * from ( | @@ -519,9 +520,9 @@ select * from ( | ||
| 519 | ) a inner join chance b on a.chance_id = b.id | 520 | ) a inner join chance b on a.chance_id = b.id |
| 520 | 521 | ||
| 521 | ) 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 | 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 |
| 523 | +) a left JOIN chance_data b on a.id =b.chance_id | ||
| 522 | order by create_at desc | 524 | order by create_at desc |
| 523 | limit %v | 525 | limit %v |
| 524 | -) a left JOIN chance_data b on a.id =b.chance_id | ||
| 525 | `, uid, uid, chanceTypeId, chanceTypeId, lastId, lastId, pageSize) | 526 | `, uid, uid, chanceTypeId, chanceTypeId, lastId, lastId, pageSize) |
| 526 | 527 | ||
| 527 | sqlCount := fmt.Sprintf(` | 528 | sqlCount := fmt.Sprintf(` |
-
请 注册 或 登录 后发表评论