|
@@ -111,12 +111,12 @@ func DeleteChance(id int64) (err error) { |
|
@@ -111,12 +111,12 @@ func DeleteChance(id int64) (err error) { |
111
|
func GetChanceMyChance(uid, cid int64, reviewStatus []int8, lastId int64, pageSize int, v interface{}) (total int, err error) {
|
111
|
func GetChanceMyChance(uid, cid int64, reviewStatus []int8, lastId int64, pageSize int, v interface{}) (total int, err error) {
|
112
|
sql := `select a.*,b.images,speechs,videos
|
112
|
sql := `select a.*,b.images,speechs,videos
|
113
|
from (
|
113
|
from (
|
114
|
-select id,user_id,create_at,update_at,approve_time chance_approve_time,source_content,approve_data,review_status,enable_status,status from chance
|
|
|
115
|
-where user_id=? and company_id=? and review_status in (?) and (?=0 or id<?) and status=1 and enable_status=1
|
114
|
+select id,user_id,create_at,update_at,update_at chance_approve_time,source_content,approve_data,review_status,enable_status,status from chance
|
|
|
115
|
+where user_id=? and company_id=? and review_status in (?) and (?=0 or unix_timestamp(update_at)<?) and status=1 and enable_status=1
|
116
|
) a left JOIN chance_data b on a.id =b.chance_id
|
116
|
) a left JOIN chance_data b on a.id =b.chance_id
|
117
|
order by update_at desc
|
117
|
order by update_at desc
|
118
|
limit ?
|
118
|
limit ?
|
119
|
-`
|
119
|
+` //approve_time
|
120
|
//update_at
|
120
|
//update_at
|
121
|
sqlCount := fmt.Sprintf(`select count(0) from (
|
121
|
sqlCount := fmt.Sprintf(`select count(0) from (
|
122
|
select id,user_id,create_at,source_content from chance
|
122
|
select id,user_id,create_at,source_content from chance
|
|
@@ -137,10 +137,11 @@ func GetChanceMyApproveChance(uid, cid int64, reviewStatus []int8, lastId int64, |
|
@@ -137,10 +137,11 @@ func GetChanceMyApproveChance(uid, cid int64, reviewStatus []int8, lastId int64, |
137
|
sql := fmt.Sprintf(`select a.*,b.images,b.speechs,b.videos from (
|
137
|
sql := fmt.Sprintf(`select a.*,b.images,b.speechs,b.videos from (
|
138
|
select a.*,b.user_id,b.source_content,b.enable_status,b.review_status,b.create_at,b.update_at,b.approve_time chance_approve_time,b.status from (
|
138
|
select a.*,b.user_id,b.source_content,b.enable_status,b.review_status,b.create_at,b.update_at,b.approve_time chance_approve_time,b.status from (
|
139
|
select id,approve_time,approve_data,uid,chance_id,approve_message,update_at process_create_time
|
139
|
select id,approve_time,approve_data,uid,chance_id,approve_message,update_at process_create_time
|
140
|
-from audit_flow_process where uid=? and review_status in (%v) and (?=0 or id<?)
|
140
|
+from audit_flow_process where uid=? and review_status in (%v)
|
141
|
)a left outer join chance b on a.chance_id = b.id
|
141
|
)a left outer join chance b on a.chance_id = b.id
|
142
|
)a left outer join chance_data b on a.chance_id =b.chance_id
|
142
|
)a left outer join chance_data b on a.chance_id =b.chance_id
|
143
|
-order by process_create_time desc
|
143
|
+where (?=0 or unix_timestamp(a.update_at)<?)
|
|
|
144
|
+order by a.update_at desc
|
144
|
LIMIT ?`, utils.JoinInt8s(reviewStatus, ",")) //and enable_status =1 //就算已经删除了,列表上面还是要体现已经删除
|
145
|
LIMIT ?`, utils.JoinInt8s(reviewStatus, ",")) //and enable_status =1 //就算已经删除了,列表上面还是要体现已经删除
|
145
|
|
146
|
|
146
|
sqlCount := fmt.Sprintf(`select count(0)
|
147
|
sqlCount := fmt.Sprintf(`select count(0)
|
|
@@ -160,10 +161,11 @@ func GetChanceMyApproveChanceEnable(uid, cid int64, reviewStatus []int8, lastId |
|
@@ -160,10 +161,11 @@ func GetChanceMyApproveChanceEnable(uid, cid int64, reviewStatus []int8, lastId |
160
|
sql := fmt.Sprintf(`select a.*,b.images,b.speechs,b.videos from (
|
161
|
sql := fmt.Sprintf(`select a.*,b.images,b.speechs,b.videos from (
|
161
|
select a.*,b.user_id,b.source_content,b.enable_status,b.review_status,b.create_at,b.update_at,b.approve_time chance_approve_time,b.status,b.update_at process_create_time from (
|
162
|
select a.*,b.user_id,b.source_content,b.enable_status,b.review_status,b.create_at,b.update_at,b.approve_time chance_approve_time,b.status,b.update_at process_create_time from (
|
162
|
select id,approve_time,approve_data,uid,chance_id,approve_message
|
163
|
select id,approve_time,approve_data,uid,chance_id,approve_message
|
163
|
-from audit_flow_process where uid=? and review_status in (%v) and (?=0 or id<?) and enable_status =1
|
164
|
+from audit_flow_process where uid=? and review_status in (%v) and enable_status =1
|
164
|
)a left outer join chance b on a.chance_id = b.id
|
165
|
)a left outer join chance b on a.chance_id = b.id
|
165
|
)a left outer join chance_data b on a.chance_id =b.chance_id
|
166
|
)a left outer join chance_data b on a.chance_id =b.chance_id
|
166
|
-order by process_create_time desc
|
167
|
+where (?=0 or unix_timestamp(a.update_at)<?)
|
|
|
168
|
+order by a.update_at desc
|
167
|
LIMIT ?`, utils.JoinInt8s(reviewStatus, ",")) //,update_at process_create_time
|
169
|
LIMIT ?`, utils.JoinInt8s(reviewStatus, ",")) //,update_at process_create_time
|
168
|
|
170
|
|
169
|
sqlCount := fmt.Sprintf(`select count(0)
|
171
|
sqlCount := fmt.Sprintf(`select count(0)
|
|
@@ -266,17 +268,18 @@ func GetChancePoolAll(uid, cid int64, chanceTypeId int, lastId int64, pageSize i |
|
@@ -266,17 +268,18 @@ func GetChancePoolAll(uid, cid int64, chanceTypeId int, lastId int64, pageSize i |
266
|
|
268
|
|
267
|
sql := `select a.*,b.images,speechs,videos
|
269
|
sql := `select a.*,b.images,speechs,videos
|
268
|
from (
|
270
|
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
|
|
|
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
|
+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
|
|
|
272
|
+where company_id=? and review_status=3 and (?=0 or chance_type_id =?) and (?=0 or unix_timestamp(approve_time)<?) and enable_status=1 and status=1
|
|
|
273
|
+) a left JOIN chance_data b on a.id =b.chance_id
|
271
|
order by create_at desc
|
274
|
order by create_at desc
|
272
|
limit ?
|
275
|
limit ?
|
273
|
-) a left JOIN chance_data b on a.id =b.chance_id`
|
276
|
+`
|
|
|
277
|
+
|
274
|
//if public==protocol.pu
|
278
|
//if public==protocol.pu
|
275
|
|
279
|
|
276
|
sqlCount := fmt.Sprintf(`select count(0) from (
|
280
|
sqlCount := fmt.Sprintf(`select count(0) from (
|
277
|
select id from chance
|
281
|
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
|
282
|
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)
|
283
|
) a left JOIN chance_data b on a.id =b.chance_id`, chanceTypeId, chanceTypeId)
|
281
|
if err = utils.ExecuteQueryOne(&total, sqlCount, cid); err != nil {
|
284
|
if err = utils.ExecuteQueryOne(&total, sqlCount, cid); err != nil {
|
282
|
return
|
285
|
return
|
|
@@ -296,46 +299,46 @@ func GetChancePoolSpecialDepartment(uid, cid int64, chanceTypeId int, lastId int |
|
@@ -296,46 +299,46 @@ func GetChancePoolSpecialDepartment(uid, cid int64, chanceTypeId int, lastId int |
296
|
select a.*,b.images,speechs,videos from (
|
299
|
select a.*,b.images,speechs,videos from (
|
297
|
select * from (
|
300
|
select * from (
|
298
|
##公司公开的机会
|
301
|
##公司公开的机会
|
299
|
- 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
|
|
|
300
|
- where company_id = %v and publish_status = 2
|
302
|
+ 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
|
|
|
303
|
+ where company_id = %v and publish_status = 2 and review_status=3
|
301
|
UNION
|
304
|
UNION
|
302
|
|
305
|
|
303
|
##指定部门-机会提交的部门
|
306
|
##指定部门-机会提交的部门
|
304
|
- 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
|
|
|
305
|
- where department_id in (%v)
|
307
|
+ 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
|
|
|
308
|
+ where department_id in (%v) and review_status=3
|
306
|
UNION
|
309
|
UNION
|
307
|
|
310
|
|
308
|
##本人
|
311
|
##本人
|
309
|
- 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
|
|
|
310
|
- where user_id = %v
|
312
|
+ 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
|
|
|
313
|
+ where user_id = %v and review_status=3
|
311
|
UNION
|
314
|
UNION
|
312
|
|
315
|
|
313
|
##我审核
|
316
|
##我审核
|
314
|
- 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 (
|
|
|
315
|
- select DISTINCT chance_id from audit_flow_process where uid =%v
|
317
|
+ 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 (
|
|
|
318
|
+ select DISTINCT chance_id from audit_flow_process where uid =%v
|
316
|
) a inner join chance b on a.chance_id = b.id
|
319
|
) a inner join chance b on a.chance_id = b.id
|
317
|
|
320
|
|
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
|
321
|
+) a where review_status=3 and (0=%v or chance_type_id =%v) and (0=%v or unix_timestamp(create_at)<%v) and a.enable_status=1 and status=1
|
|
|
322
|
+) a left JOIN chance_data b on a.id =b.chance_id
|
319
|
order by create_at desc
|
323
|
order by create_at desc
|
320
|
limit %v
|
324
|
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)
|
325
|
`, cid, utils.JoinInt64s(departmentIds, ","), uid, uid, chanceTypeId, chanceTypeId, lastId, lastId, pageSize)
|
323
|
|
326
|
|
324
|
sqlCount := fmt.Sprintf(`
|
327
|
sqlCount := fmt.Sprintf(`
|
325
|
select count(0) from (
|
328
|
select count(0) from (
|
326
|
##公司公开的机会
|
329
|
##公司公开的机会
|
327
|
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
|
330
|
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
|
328
|
- where company_id = %v and publish_status = 2
|
331
|
+ where company_id = %v and publish_status = 2 and review_status=3
|
329
|
UNION
|
332
|
UNION
|
330
|
|
333
|
|
331
|
##指定部门-机会提交的部门
|
334
|
##指定部门-机会提交的部门
|
332
|
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
|
335
|
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
|
333
|
- where department_id in (%v)
|
336
|
+ where department_id in (%v) and review_status=3
|
334
|
UNION
|
337
|
UNION
|
335
|
|
338
|
|
336
|
##本人
|
339
|
##本人
|
337
|
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
|
340
|
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
|
338
|
- where user_id = %v
|
341
|
+ where user_id = %v and review_status=3
|
339
|
UNION
|
342
|
UNION
|
340
|
|
343
|
|
341
|
##我审核
|
344
|
##我审核
|
|
@@ -363,35 +366,37 @@ func GetChancePoolDepartment(uid, cid int64, chanceTypeId int, lastId int64, pag |
|
@@ -363,35 +366,37 @@ func GetChancePoolDepartment(uid, cid int64, chanceTypeId int, lastId int64, pag |
363
|
select a.*,b.images,speechs,videos from (
|
366
|
select a.*,b.images,speechs,videos from (
|
364
|
select * from (
|
367
|
select * from (
|
365
|
##指定部门-机会公开的部门
|
368
|
##指定部门-机会公开的部门
|
366
|
- 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 (
|
369
|
+ 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 (
|
367
|
select DISTINCT chance_id from chance_department where department_id in (%v)
|
370
|
select DISTINCT chance_id from chance_department where department_id in (%v)
|
368
|
)a inner join chance b on a.chance_id = b.id
|
371
|
)a inner join chance b on a.chance_id = b.id
|
|
|
372
|
+ where review_status=3
|
|
|
373
|
+
|
369
|
UNION
|
374
|
UNION
|
370
|
|
375
|
|
371
|
##公司公开的机会
|
376
|
##公司公开的机会
|
372
|
- 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
|
|
|
373
|
- where company_id = %v and publish_status = 2
|
377
|
+ 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
|
|
|
378
|
+ where company_id = %v and publish_status = 2 and review_status=3
|
374
|
UNION
|
379
|
UNION
|
375
|
|
380
|
|
376
|
##指定部门-机会提交的部门
|
381
|
##指定部门-机会提交的部门
|
377
|
- 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
|
|
|
378
|
- where department_id in (%v)
|
382
|
+ 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
|
|
|
383
|
+ where department_id in (%v) and review_status=3
|
379
|
UNION
|
384
|
UNION
|
380
|
|
385
|
|
381
|
##本人
|
386
|
##本人
|
382
|
- 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
|
|
|
383
|
- where user_id = %v
|
387
|
+ 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
|
|
|
388
|
+ where user_id = %v and review_status=3
|
384
|
UNION
|
389
|
UNION
|
385
|
|
390
|
|
386
|
##我审核
|
391
|
##我审核
|
387
|
- 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 (
|
|
|
388
|
- select DISTINCT chance_id from audit_flow_process where uid =%v
|
392
|
+ 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 (
|
|
|
393
|
+ select DISTINCT chance_id from audit_flow_process where uid =%v
|
389
|
) a inner join chance b on a.chance_id = b.id
|
394
|
) a inner join chance b on a.chance_id = b.id
|
390
|
|
395
|
|
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
|
396
|
+) a where review_status=3 and (0=%v or chance_type_id =%v) and (0=%v or unix_timestamp(create_at)<%v) and a.enable_status=1 and status=1
|
|
|
397
|
+) a left JOIN chance_data b on a.id =b.chance_id
|
392
|
order by create_at desc
|
398
|
order by create_at desc
|
393
|
limit %v
|
399
|
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)
|
400
|
`, utils.JoinInt64s(userDepartmetIds, ","), cid, utils.JoinInt64s(departmentIds, ","), uid, uid, chanceTypeId, chanceTypeId, lastId, lastId, pageSize)
|
396
|
|
401
|
|
397
|
sqlCount := fmt.Sprintf(`
|
402
|
sqlCount := fmt.Sprintf(`
|
|
@@ -400,26 +405,28 @@ select count(0) from ( |
|
@@ -400,26 +405,28 @@ select count(0) from ( |
400
|
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 (
|
405
|
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 (
|
401
|
select DISTINCT chance_id from chance_department where department_id in (%v)
|
406
|
select DISTINCT chance_id from chance_department where department_id in (%v)
|
402
|
)a inner join chance b on a.chance_id = b.id
|
407
|
)a inner join chance b on a.chance_id = b.id
|
|
|
408
|
+ where review_status=3
|
|
|
409
|
+
|
403
|
UNION
|
410
|
UNION
|
404
|
|
411
|
|
405
|
##公司公开的机会
|
412
|
##公司公开的机会
|
406
|
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
|
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
|
407
|
- where company_id = %v and publish_status = 2
|
414
|
+ where company_id = %v and publish_status = 2 and review_status=3
|
408
|
UNION
|
415
|
UNION
|
409
|
|
416
|
|
410
|
##指定部门-机会提交的部门
|
417
|
##指定部门-机会提交的部门
|
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
|
418
|
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
|
412
|
- where department_id in (%v)
|
419
|
+ where department_id in (%v) and review_status=3
|
413
|
UNION
|
420
|
UNION
|
414
|
|
421
|
|
415
|
##本人
|
422
|
##本人
|
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
|
423
|
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
|
417
|
- where user_id = %v
|
424
|
+ where user_id = %v and review_status=3
|
418
|
UNION
|
425
|
UNION
|
419
|
|
426
|
|
420
|
##我审核
|
427
|
##我审核
|
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 (
|
428
|
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 (
|
422
|
- select DISTINCT chance_id from audit_flow_process where uid =%v
|
429
|
+ select DISTINCT chance_id from audit_flow_process where uid =%v
|
423
|
) a inner join chance b on a.chance_id = b.id
|
430
|
) a inner join chance b on a.chance_id = b.id
|
424
|
|
431
|
|
425
|
) a where review_status=3 and (0=%v or chance_type_id =%v) and a.enable_status=1 and status=1
|
432
|
) a where review_status=3 and (0=%v or chance_type_id =%v) and a.enable_status=1 and status=1
|
|
@@ -441,48 +448,52 @@ func GetChancePoolPublicCompany(uid, cid int64, chanceTypeId int, lastId int64, |
|
@@ -441,48 +448,52 @@ func GetChancePoolPublicCompany(uid, cid int64, chanceTypeId int, lastId int64, |
441
|
select a.*,b.images,speechs,videos from (
|
448
|
select a.*,b.images,speechs,videos from (
|
442
|
select * from (
|
449
|
select * from (
|
443
|
##公司公开的机会
|
450
|
##公司公开的机会
|
444
|
- 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
|
|
|
445
|
- where company_id = %v and publish_status = 2
|
451
|
+ 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
|
|
|
452
|
+ where company_id = %v and publish_status = 2 and review_status=3
|
446
|
|
453
|
|
447
|
UNION
|
454
|
UNION
|
448
|
##指定部门-机会公开的部门
|
455
|
##指定部门-机会公开的部门
|
449
|
- 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 (
|
456
|
+ 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 (
|
450
|
select DISTINCT chance_id from chance_department where department_id in (%v)
|
457
|
select DISTINCT chance_id from chance_department where department_id in (%v)
|
451
|
)a inner join chance b on a.chance_id = b.id
|
458
|
)a inner join chance b on a.chance_id = b.id
|
|
|
459
|
+ where review_status=3
|
|
|
460
|
+
|
452
|
UNION
|
461
|
UNION
|
453
|
|
462
|
|
454
|
##本人
|
463
|
##本人
|
455
|
- 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
|
|
|
456
|
- where user_id = %v
|
464
|
+ 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
|
|
|
465
|
+ where user_id = %v and review_status=3
|
457
|
UNION
|
466
|
UNION
|
458
|
|
467
|
|
459
|
##我审核
|
468
|
##我审核
|
460
|
- 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 (
|
|
|
461
|
- select DISTINCT chance_id from audit_flow_process where uid =%v
|
469
|
+ 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 (
|
|
|
470
|
+ select DISTINCT chance_id from audit_flow_process where uid =%v
|
462
|
) a inner join chance b on a.chance_id = b.id
|
471
|
) a inner join chance b on a.chance_id = b.id
|
463
|
|
472
|
|
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
|
473
|
+) a where review_status=3 and (0=%v or chance_type_id =%v) and (0=%v or unix_timestamp(create_at)<%v) and a.enable_status=1 and status=1
|
|
|
474
|
+) a left JOIN chance_data b on a.id =b.chance_id
|
465
|
order by create_at desc
|
475
|
order by create_at desc
|
466
|
limit %v
|
476
|
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)
|
477
|
`, cid, utils.JoinInt64s(departmentIds, ","), uid, uid, chanceTypeId, chanceTypeId, lastId, lastId, pageSize)
|
469
|
|
478
|
|
470
|
sqlCount := fmt.Sprintf(`
|
479
|
sqlCount := fmt.Sprintf(`
|
471
|
select count(0) from (
|
480
|
select count(0) from (
|
472
|
##公司公开的机会
|
481
|
##公司公开的机会
|
473
|
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
|
482
|
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
|
474
|
- where company_id = %v and publish_status = 2
|
483
|
+ where company_id = %v and publish_status = 2 and review_status=3
|
475
|
|
484
|
|
476
|
UNION
|
485
|
UNION
|
477
|
##指定部门-机会公开的部门
|
486
|
##指定部门-机会公开的部门
|
478
|
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 (
|
487
|
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 (
|
479
|
select DISTINCT chance_id from chance_department where department_id in (%v)
|
488
|
select DISTINCT chance_id from chance_department where department_id in (%v)
|
480
|
)a inner join chance b on a.chance_id = b.id
|
489
|
)a inner join chance b on a.chance_id = b.id
|
|
|
490
|
+ where review_status=3
|
|
|
491
|
+
|
481
|
UNION
|
492
|
UNION
|
482
|
|
493
|
|
483
|
##本人
|
494
|
##本人
|
484
|
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
|
495
|
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
|
485
|
- where user_id = %v
|
496
|
+ where user_id = %v and review_status=3
|
486
|
UNION
|
497
|
UNION
|
487
|
|
498
|
|
488
|
##我审核
|
499
|
##我审核
|
|
@@ -509,26 +520,26 @@ func GetChancePoolMyself(uid, cid int64, chanceTypeId int, lastId int64, pageSiz |
|
@@ -509,26 +520,26 @@ func GetChancePoolMyself(uid, cid int64, chanceTypeId int, lastId int64, pageSiz |
509
|
select a.*,b.images,speechs,videos from (
|
520
|
select a.*,b.images,speechs,videos from (
|
510
|
select * from (
|
521
|
select * from (
|
511
|
##本人
|
522
|
##本人
|
512
|
- 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
|
|
|
513
|
- where user_id = %v
|
523
|
+ 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
|
|
|
524
|
+ where user_id = %v and review_status=3
|
514
|
UNION
|
525
|
UNION
|
515
|
|
526
|
|
516
|
##我审核
|
527
|
##我审核
|
517
|
- 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 (
|
528
|
+ 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 (
|
518
|
select DISTINCT chance_id from audit_flow_process where uid =%v
|
529
|
select DISTINCT chance_id from audit_flow_process where uid =%v
|
519
|
) a inner join chance b on a.chance_id = b.id
|
530
|
) a inner join chance b on a.chance_id = b.id
|
520
|
|
531
|
|
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
|
532
|
+) a where review_status=3 and (0=%v or chance_type_id =%v) and (0=%v or unix_timestamp(create_at)<%v) and a.enable_status=1 and status=1
|
|
|
533
|
+) a left JOIN chance_data b on a.id =b.chance_id
|
522
|
order by create_at desc
|
534
|
order by create_at desc
|
523
|
limit %v
|
535
|
limit %v
|
524
|
-) a left JOIN chance_data b on a.id =b.chance_id
|
|
|
525
|
`, uid, uid, chanceTypeId, chanceTypeId, lastId, lastId, pageSize)
|
536
|
`, uid, uid, chanceTypeId, chanceTypeId, lastId, lastId, pageSize)
|
526
|
|
537
|
|
527
|
sqlCount := fmt.Sprintf(`
|
538
|
sqlCount := fmt.Sprintf(`
|
528
|
select count(0) from (
|
539
|
select count(0) from (
|
529
|
##本人
|
540
|
##本人
|
530
|
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
|
541
|
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
|
531
|
- where user_id = %v
|
542
|
+ where user_id = %v and review_status=3
|
532
|
UNION
|
543
|
UNION
|
533
|
|
544
|
|
534
|
##我审核
|
545
|
##我审核
|