|
@@ -158,8 +158,8 @@ from audit_flow_process where uid=? and enable_status =1 and review_status in (% |
|
@@ -158,8 +158,8 @@ from audit_flow_process where uid=? and enable_status =1 and review_status in (% |
158
|
|
158
|
|
159
|
func GetChanceCollect(uid int64, lastId int64, pageSize int, v interface{}) (total int, err error) {
|
159
|
func GetChanceCollect(uid int64, lastId int64, pageSize int, v interface{}) (total int, err error) {
|
160
|
sql := fmt.Sprintf(`select a.*,b.images,b.speechs,b.videos from (
|
160
|
sql := fmt.Sprintf(`select a.*,b.images,b.speechs,b.videos from (
|
161
|
-select a.*,b.user_id,b.id,b.create_at,b.source_content,b.enable_status,b.review_status,b.audit_template_id,b.chance_type_id,comment_total,zan_total,view_total,b.publish_status,b.status from (
|
|
|
162
|
-select id collect_id,source_id,update_at collect_time,chance_id from chance_favorite where (0=? or id<?) and user_id =? and enable_status=1
|
161
|
+select a.*,b.user_id chance_user_id,b.create_at,b.source_content,b.enable_status,b.review_status,b.audit_template_id,b.chance_type_id,comment_total,zan_total,view_total,b.publish_status,b.status from (
|
|
|
162
|
+select id collect_id,source_id,update_at,collect_time,chance_id from chance_favorite where (0=? or id<?) and user_id =? and enable_status=1
|
163
|
and source_type=1
|
163
|
and source_type=1
|
164
|
and (mark_flag&2)>0
|
164
|
and (mark_flag&2)>0
|
165
|
)a left outer join chance b on a.source_id = b.id
|
165
|
)a left outer join chance b on a.source_id = b.id
|
|
@@ -181,13 +181,13 @@ limit ?`) |
|
@@ -181,13 +181,13 @@ limit ?`) |
181
|
|
181
|
|
182
|
func GetChanceThumbUp(uid int64, lastId int64, pageSize int, v interface{}) (total int, err error) {
|
182
|
func GetChanceThumbUp(uid int64, lastId int64, pageSize int, v interface{}) (total int, err error) {
|
183
|
sql := fmt.Sprintf(`select a.*,b.images,b.speechs,b.videos from (
|
183
|
sql := fmt.Sprintf(`select a.*,b.images,b.speechs,b.videos from (
|
184
|
-select a.*,b.user_id,b.id,b.create_at,b.source_content,b.enable_status,b.review_status,b.audit_template_id,b.chance_type_id,comment_total,zan_total,view_total,b.publish_status,b.status from (
|
|
|
185
|
-select id collect_id,source_id,update_at collect_time from chance_favorite where (0=? or id<?) and user_id =? and enable_status=1
|
184
|
+select a.*,b.user_id chance_user_id,b.id chance_id,b.create_at,b.source_content,b.enable_status,b.review_status,b.audit_template_id,b.chance_type_id,comment_total,zan_total,view_total,b.publish_status,b.status from (
|
|
|
185
|
+select id collect_id,source_id,update_at,zan_time from chance_favorite where (0=? or id<?) and user_id =? and enable_status=1
|
186
|
and source_type=1
|
186
|
and source_type=1
|
187
|
and (mark_flag&1)>0
|
187
|
and (mark_flag&1)>0
|
188
|
)a left outer join chance b on a.source_id = b.id
|
188
|
)a left outer join chance b on a.source_id = b.id
|
189
|
)a left outer join chance_data b on a.source_id =b.chance_id
|
189
|
)a left outer join chance_data b on a.source_id =b.chance_id
|
190
|
-order by collect_time desc
|
190
|
+order by zan_time desc
|
191
|
limit ?`)
|
191
|
limit ?`)
|
192
|
|
192
|
|
193
|
sqlCount := `select count(0) from chance_favorite where user_id =? and enable_status=1 and (mark_flag&1)>0 and source_type=1`
|
193
|
sqlCount := `select count(0) from chance_favorite where user_id =? and enable_status=1 and (mark_flag&1)>0 and source_type=1`
|
|
@@ -216,7 +216,7 @@ func GetChanceComment(uid int64, lastId int64, pageSize int, v interface{}) (tot |
|
@@ -216,7 +216,7 @@ func GetChanceComment(uid int64, lastId int64, pageSize int, v interface{}) (tot |
216
|
sql := fmt.Sprintf(`select a.*,b.content commented_content,b.create_at commented_time,b.user_id commented_user_id
|
216
|
sql := fmt.Sprintf(`select a.*,b.content commented_content,b.create_at commented_time,b.user_id commented_user_id
|
217
|
from (
|
217
|
from (
|
218
|
select a.*,b.images,b.speechs,b.videos from (
|
218
|
select a.*,b.images,b.speechs,b.videos from (
|
219
|
-select a.*,b.source_content,b.enable_status,b.user_id chance_user_id,b.create_at,b.review_status,b.approve_data,b.publish_status from (
|
219
|
+select a.*,b.source_content,b.enable_status,b.user_id chance_user_id,b.create_at,b.review_status,b.approve_data,b.publish_status,b.status from (
|
220
|
select id,content,view_total,zan_total,comment_total,source_type,source_id,create_at comment_time from comment
|
220
|
select id,content,view_total,zan_total,comment_total,source_type,source_id,create_at comment_time from comment
|
221
|
where user_id =? and (?=0 or id<?)
|
221
|
where user_id =? and (?=0 or id<?)
|
222
|
)a left outer join chance b on a.source_id = b.id and source_type=1
|
222
|
)a left outer join chance b on a.source_id = b.id and source_type=1
|
|
@@ -244,7 +244,7 @@ func GetChancePoolAll(uid, cid int64, chanceTypeId int, lastId int64, pageSize i |
|
@@ -244,7 +244,7 @@ func GetChancePoolAll(uid, cid int64, chanceTypeId int, lastId int64, pageSize i |
244
|
sql := `select a.*,b.images,speechs,videos
|
244
|
sql := `select a.*,b.images,speechs,videos
|
245
|
from (
|
245
|
from (
|
246
|
select id,user_id,create_at,source_content,review_status,audit_template_id,chance_type_id,comment_total,zan_total,view_total from chance
|
246
|
select id,user_id,create_at,source_content,review_status,audit_template_id,chance_type_id,comment_total,zan_total,view_total from chance
|
247
|
-where company_id=? and review_status=3 and (?=0 or chance_type_id =?) and (?=0 or id<?) and enable_status=1
|
247
|
+where company_id=? and review_status=3 and (?=0 or chance_type_id =?) and (?=0 or id<?) and enable_status=1 and status=1
|
248
|
order by create_at desc
|
248
|
order by create_at desc
|
249
|
limit ?
|
249
|
limit ?
|
250
|
) a left JOIN chance_data b on a.id =b.chance_id`
|
250
|
) a left JOIN chance_data b on a.id =b.chance_id`
|
|
@@ -252,7 +252,7 @@ limit ? |
|
@@ -252,7 +252,7 @@ limit ? |
252
|
|
252
|
|
253
|
sqlCount := fmt.Sprintf(`select count(0) from (
|
253
|
sqlCount := fmt.Sprintf(`select count(0) from (
|
254
|
select id from chance
|
254
|
select id from chance
|
255
|
-where company_id=? and review_status=3 and (%v=0 or chance_type_id =%v) and enable_status=1
|
255
|
+where company_id=? and review_status=3 and (%v=0 or chance_type_id =%v) and enable_status=1 and status=1
|
256
|
order by create_at desc
|
256
|
order by create_at desc
|
257
|
) a left JOIN chance_data b on a.id =b.chance_id`, chanceTypeId, chanceTypeId)
|
257
|
) a left JOIN chance_data b on a.id =b.chance_id`, chanceTypeId, chanceTypeId)
|
258
|
if err = utils.ExecuteQueryOne(&total, sqlCount, cid); err != nil {
|
258
|
if err = utils.ExecuteQueryOne(&total, sqlCount, cid); err != nil {
|
|
@@ -273,26 +273,26 @@ func GetChancePoolSpecialDepartment(uid, cid int64, chanceTypeId int, lastId int |
|
@@ -273,26 +273,26 @@ func GetChancePoolSpecialDepartment(uid, cid int64, chanceTypeId int, lastId int |
273
|
select a.*,b.images,speechs,videos from (
|
273
|
select a.*,b.images,speechs,videos from (
|
274
|
select * from (
|
274
|
select * from (
|
275
|
##公司公开的机会
|
275
|
##公司公开的机会
|
276
|
- 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 from chance
|
276
|
+ 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
|
277
|
where company_id = %v and publish_status = 2
|
277
|
where company_id = %v and publish_status = 2
|
278
|
UNION
|
278
|
UNION
|
279
|
|
279
|
|
280
|
##指定部门-机会提交的部门
|
280
|
##指定部门-机会提交的部门
|
281
|
- 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 from chance
|
281
|
+ 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
|
282
|
where department_id in (%v)
|
282
|
where department_id in (%v)
|
283
|
UNION
|
283
|
UNION
|
284
|
|
284
|
|
285
|
##本人
|
285
|
##本人
|
286
|
- 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 from chance
|
286
|
+ 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
|
287
|
where user_id = %v
|
287
|
where user_id = %v
|
288
|
UNION
|
288
|
UNION
|
289
|
|
289
|
|
290
|
##我审核
|
290
|
##我审核
|
291
|
- 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 from (
|
291
|
+ 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 (
|
292
|
select DISTINCT chance_id from audit_flow_process where uid =%v
|
292
|
select DISTINCT chance_id from audit_flow_process where uid =%v
|
293
|
) a inner join chance b on a.chance_id = b.id
|
293
|
) a inner join chance b on a.chance_id = b.id
|
294
|
|
294
|
|
295
|
-) a where review_status=3 and (0=%v or chance_type_id =%v) and (0=%v or id<%v) and a.enable_status=1
|
295
|
+) 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
|
296
|
order by create_at desc
|
296
|
order by create_at desc
|
297
|
limit %v
|
297
|
limit %v
|
298
|
) a left JOIN chance_data b on a.id =b.chance_id
|
298
|
) a left JOIN chance_data b on a.id =b.chance_id
|
|
@@ -301,26 +301,26 @@ limit %v |
|
@@ -301,26 +301,26 @@ limit %v |
301
|
sqlCount := fmt.Sprintf(`
|
301
|
sqlCount := fmt.Sprintf(`
|
302
|
select count(0) from (
|
302
|
select count(0) from (
|
303
|
##公司公开的机会
|
303
|
##公司公开的机会
|
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 from chance
|
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 company_id = %v and publish_status = 2
|
305
|
where company_id = %v and publish_status = 2
|
306
|
UNION
|
306
|
UNION
|
307
|
|
307
|
|
308
|
##指定部门-机会提交的部门
|
308
|
##指定部门-机会提交的部门
|
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 from chance
|
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 department_id in (%v)
|
310
|
where department_id in (%v)
|
311
|
UNION
|
311
|
UNION
|
312
|
|
312
|
|
313
|
##本人
|
313
|
##本人
|
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 from chance
|
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 chance
|
315
|
where user_id = %v
|
315
|
where user_id = %v
|
316
|
UNION
|
316
|
UNION
|
317
|
|
317
|
|
318
|
##我审核
|
318
|
##我审核
|
319
|
- 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 from (
|
319
|
+ 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 (
|
320
|
select DISTINCT chance_id from audit_flow_process where uid =%v
|
320
|
select DISTINCT chance_id from audit_flow_process where uid =%v
|
321
|
) a inner join chance b on a.chance_id = b.id
|
321
|
) a inner join chance b on a.chance_id = b.id
|
322
|
|
322
|
|
323
|
-) a where review_status=3 and (0=%v or chance_type_id =%v) and a.enable_status=1
|
323
|
+) a where review_status=3 and (0=%v or chance_type_id =%v) and a.enable_status=1 and status=1
|
324
|
`, cid, utils.JoinInt64s(departmentIds, ","), uid, uid, chanceTypeId, chanceTypeId)
|
324
|
`, cid, utils.JoinInt64s(departmentIds, ","), uid, uid, chanceTypeId, chanceTypeId)
|
325
|
if err = utils.ExecuteQueryOne(&total, sqlCount); err != nil {
|
325
|
if err = utils.ExecuteQueryOne(&total, sqlCount); err != nil {
|
326
|
return
|
326
|
return
|
|
@@ -340,32 +340,32 @@ func GetChancePoolDepartment(uid, cid int64, chanceTypeId int, lastId int64, pag |
|
@@ -340,32 +340,32 @@ func GetChancePoolDepartment(uid, cid int64, chanceTypeId int, lastId int64, pag |
340
|
select a.*,b.images,speechs,videos from (
|
340
|
select a.*,b.images,speechs,videos from (
|
341
|
select * from (
|
341
|
select * from (
|
342
|
##指定部门-机会公开的部门
|
342
|
##指定部门-机会公开的部门
|
343
|
- 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 from (
|
343
|
+ 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 (
|
344
|
select DISTINCT chance_id from chance_department where department_id in (%v)
|
344
|
select DISTINCT chance_id from chance_department where department_id in (%v)
|
345
|
)a inner join chance b on a.chance_id = b.id
|
345
|
)a inner join chance b on a.chance_id = b.id
|
346
|
UNION
|
346
|
UNION
|
347
|
|
347
|
|
348
|
##公司公开的机会
|
348
|
##公司公开的机会
|
349
|
- 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 from chance
|
349
|
+ 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
|
350
|
where company_id = %v and publish_status = 2
|
350
|
where company_id = %v and publish_status = 2
|
351
|
UNION
|
351
|
UNION
|
352
|
|
352
|
|
353
|
##指定部门-机会提交的部门
|
353
|
##指定部门-机会提交的部门
|
354
|
- 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 from chance
|
354
|
+ 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
|
355
|
where department_id in (%v)
|
355
|
where department_id in (%v)
|
356
|
UNION
|
356
|
UNION
|
357
|
|
357
|
|
358
|
##本人
|
358
|
##本人
|
359
|
- 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 from chance
|
359
|
+ 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
|
360
|
where user_id = %v
|
360
|
where user_id = %v
|
361
|
UNION
|
361
|
UNION
|
362
|
|
362
|
|
363
|
##我审核
|
363
|
##我审核
|
364
|
- 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 from (
|
364
|
+ 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 (
|
365
|
select DISTINCT chance_id from audit_flow_process where uid =%v
|
365
|
select DISTINCT chance_id from audit_flow_process where uid =%v
|
366
|
) a inner join chance b on a.chance_id = b.id
|
366
|
) a inner join chance b on a.chance_id = b.id
|
367
|
|
367
|
|
368
|
-) a where review_status=3 and (0=%v or chance_type_id =%v) and (0=%v or id<%v) and a.enable_status=1
|
368
|
+) 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
|
369
|
order by create_at desc
|
369
|
order by create_at desc
|
370
|
limit %v
|
370
|
limit %v
|
371
|
) a left JOIN chance_data b on a.id =b.chance_id
|
371
|
) a left JOIN chance_data b on a.id =b.chance_id
|
|
@@ -374,32 +374,32 @@ limit %v |
|
@@ -374,32 +374,32 @@ limit %v |
374
|
sqlCount := fmt.Sprintf(`
|
374
|
sqlCount := fmt.Sprintf(`
|
375
|
select count(0) from (
|
375
|
select count(0) from (
|
376
|
##指定部门-机会公开的部门
|
376
|
##指定部门-机会公开的部门
|
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 from (
|
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 (
|
378
|
select DISTINCT chance_id from chance_department where department_id in (%v)
|
378
|
select DISTINCT chance_id from chance_department where department_id in (%v)
|
379
|
)a inner join chance b on a.chance_id = b.id
|
379
|
)a inner join chance b on a.chance_id = b.id
|
380
|
UNION
|
380
|
UNION
|
381
|
|
381
|
|
382
|
##公司公开的机会
|
382
|
##公司公开的机会
|
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 from chance
|
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 company_id = %v and publish_status = 2
|
384
|
where company_id = %v and publish_status = 2
|
385
|
UNION
|
385
|
UNION
|
386
|
|
386
|
|
387
|
##指定部门-机会提交的部门
|
387
|
##指定部门-机会提交的部门
|
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 from chance
|
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 chance
|
389
|
where department_id in (%v)
|
389
|
where department_id in (%v)
|
390
|
UNION
|
390
|
UNION
|
391
|
|
391
|
|
392
|
##本人
|
392
|
##本人
|
393
|
- 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 from chance
|
393
|
+ 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
|
394
|
where user_id = %v
|
394
|
where user_id = %v
|
395
|
UNION
|
395
|
UNION
|
396
|
|
396
|
|
397
|
##我审核
|
397
|
##我审核
|
398
|
- 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 from (
|
398
|
+ 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 (
|
399
|
select DISTINCT chance_id from audit_flow_process where uid =%v
|
399
|
select DISTINCT chance_id from audit_flow_process where uid =%v
|
400
|
) a inner join chance b on a.chance_id = b.id
|
400
|
) a inner join chance b on a.chance_id = b.id
|
401
|
|
401
|
|
402
|
-) a where review_status=3 and (0=%v or chance_type_id =%v) and a.enable_status=1
|
402
|
+) a where review_status=3 and (0=%v or chance_type_id =%v) and a.enable_status=1 and status=1
|
403
|
`, utils.JoinInt64s(userDepartmetIds, ","), cid, utils.JoinInt64s(departmentIds, ","), uid, uid, chanceTypeId, chanceTypeId)
|
403
|
`, utils.JoinInt64s(userDepartmetIds, ","), cid, utils.JoinInt64s(departmentIds, ","), uid, uid, chanceTypeId, chanceTypeId)
|
404
|
if err = utils.ExecuteQueryOne(&total, sqlCount); err != nil {
|
404
|
if err = utils.ExecuteQueryOne(&total, sqlCount); err != nil {
|
405
|
return
|
405
|
return
|
|
@@ -418,27 +418,27 @@ func GetChancePoolPublicCompany(uid, cid int64, chanceTypeId int, lastId int64, |
|
@@ -418,27 +418,27 @@ func GetChancePoolPublicCompany(uid, cid int64, chanceTypeId int, lastId int64, |
418
|
select a.*,b.images,speechs,videos from (
|
418
|
select a.*,b.images,speechs,videos from (
|
419
|
select * from (
|
419
|
select * from (
|
420
|
##公司公开的机会
|
420
|
##公司公开的机会
|
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 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
|
422
|
where company_id = %v and publish_status = 2
|
422
|
where company_id = %v and publish_status = 2
|
423
|
|
423
|
|
424
|
UNION
|
424
|
UNION
|
425
|
##指定部门-机会公开的部门
|
425
|
##指定部门-机会公开的部门
|
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 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 (
|
427
|
select DISTINCT chance_id from chance_department where department_id in (%v)
|
427
|
select DISTINCT chance_id from chance_department where department_id in (%v)
|
428
|
)a inner join chance b on a.chance_id = b.id
|
428
|
)a inner join chance b on a.chance_id = b.id
|
429
|
UNION
|
429
|
UNION
|
430
|
|
430
|
|
431
|
##本人
|
431
|
##本人
|
432
|
- 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 from chance
|
432
|
+ 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
|
433
|
where user_id = %v
|
433
|
where user_id = %v
|
434
|
UNION
|
434
|
UNION
|
435
|
|
435
|
|
436
|
##我审核
|
436
|
##我审核
|
437
|
- 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 from (
|
437
|
+ 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 (
|
438
|
select DISTINCT chance_id from audit_flow_process where uid =%v
|
438
|
select DISTINCT chance_id from audit_flow_process where uid =%v
|
439
|
) a inner join chance b on a.chance_id = b.id
|
439
|
) a inner join chance b on a.chance_id = b.id
|
440
|
|
440
|
|
441
|
-) a where review_status=3 and (0=%v or chance_type_id =%v) and (0=%v or id<%v) and a.enable_status=1
|
441
|
+) 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
|
442
|
order by create_at desc
|
442
|
order by create_at desc
|
443
|
limit %v
|
443
|
limit %v
|
444
|
) a left JOIN chance_data b on a.id =b.chance_id
|
444
|
) a left JOIN chance_data b on a.id =b.chance_id
|
|
@@ -447,27 +447,27 @@ limit %v |
|
@@ -447,27 +447,27 @@ limit %v |
447
|
sqlCount := fmt.Sprintf(`
|
447
|
sqlCount := fmt.Sprintf(`
|
448
|
select count(0) from (
|
448
|
select count(0) from (
|
449
|
##公司公开的机会
|
449
|
##公司公开的机会
|
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 from chance
|
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 chance
|
451
|
where company_id = %v and publish_status = 2
|
451
|
where company_id = %v and publish_status = 2
|
452
|
|
452
|
|
453
|
UNION
|
453
|
UNION
|
454
|
##指定部门-机会公开的部门
|
454
|
##指定部门-机会公开的部门
|
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 from (
|
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 (
|
456
|
select DISTINCT chance_id from chance_department where department_id in (%v)
|
456
|
select DISTINCT chance_id from chance_department where department_id in (%v)
|
457
|
)a inner join chance b on a.chance_id = b.id
|
457
|
)a inner join chance b on a.chance_id = b.id
|
458
|
UNION
|
458
|
UNION
|
459
|
|
459
|
|
460
|
##本人
|
460
|
##本人
|
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 from chance
|
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 chance
|
462
|
where user_id = %v
|
462
|
where user_id = %v
|
463
|
UNION
|
463
|
UNION
|
464
|
|
464
|
|
465
|
##我审核
|
465
|
##我审核
|
466
|
- 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 from (
|
466
|
+ 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 (
|
467
|
select DISTINCT chance_id from audit_flow_process where uid =%v
|
467
|
select DISTINCT chance_id from audit_flow_process where uid =%v
|
468
|
) a inner join chance b on a.chance_id = b.id
|
468
|
) a inner join chance b on a.chance_id = b.id
|
469
|
|
469
|
|
470
|
-) a where review_status=3 and (0=%v or chance_type_id =%v) and a.enable_status=1
|
470
|
+) a where review_status=3 and (0=%v or chance_type_id =%v) and a.enable_status=1 and status=1
|
471
|
`, cid, utils.JoinInt64s(departmentIds, ","), uid, uid, chanceTypeId, chanceTypeId)
|
471
|
`, cid, utils.JoinInt64s(departmentIds, ","), uid, uid, chanceTypeId, chanceTypeId)
|
472
|
if err = utils.ExecuteQueryOne(&total, sqlCount); err != nil {
|
472
|
if err = utils.ExecuteQueryOne(&total, sqlCount); err != nil {
|
473
|
return
|
473
|
return
|
|
@@ -486,16 +486,16 @@ func GetChancePoolMyself(uid, cid int64, chanceTypeId int, lastId int64, pageSiz |
|
@@ -486,16 +486,16 @@ func GetChancePoolMyself(uid, cid int64, chanceTypeId int, lastId int64, pageSiz |
486
|
select a.*,b.images,speechs,videos from (
|
486
|
select a.*,b.images,speechs,videos from (
|
487
|
select * from (
|
487
|
select * from (
|
488
|
##本人
|
488
|
##本人
|
489
|
- 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 from chance
|
489
|
+ 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
|
490
|
where user_id = %v
|
490
|
where user_id = %v
|
491
|
UNION
|
491
|
UNION
|
492
|
|
492
|
|
493
|
##我审核
|
493
|
##我审核
|
494
|
- 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 from (
|
494
|
+ 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 (
|
495
|
select DISTINCT chance_id from audit_flow_process where uid =%v
|
495
|
select DISTINCT chance_id from audit_flow_process where uid =%v
|
496
|
) a inner join chance b on a.chance_id = b.id
|
496
|
) a inner join chance b on a.chance_id = b.id
|
497
|
|
497
|
|
498
|
-) a where review_status=3 and (0=%v or chance_type_id =%v) and (0=%v or id<%v) and a.enable_status=1
|
498
|
+) 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
|
499
|
order by create_at desc
|
499
|
order by create_at desc
|
500
|
limit %v
|
500
|
limit %v
|
501
|
) a left JOIN chance_data b on a.id =b.chance_id
|
501
|
) a left JOIN chance_data b on a.id =b.chance_id
|
|
@@ -504,16 +504,16 @@ limit %v |
|
@@ -504,16 +504,16 @@ limit %v |
504
|
sqlCount := fmt.Sprintf(`
|
504
|
sqlCount := fmt.Sprintf(`
|
505
|
select count(0) from (
|
505
|
select count(0) from (
|
506
|
##本人
|
506
|
##本人
|
507
|
- 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 from chance
|
507
|
+ 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
|
508
|
where user_id = %v
|
508
|
where user_id = %v
|
509
|
UNION
|
509
|
UNION
|
510
|
|
510
|
|
511
|
##我审核
|
511
|
##我审核
|
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 from (
|
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 (
|
513
|
select DISTINCT chance_id from audit_flow_process where uid =%v
|
513
|
select DISTINCT chance_id from audit_flow_process where uid =%v
|
514
|
) a inner join chance b on a.chance_id = b.id
|
514
|
) a inner join chance b on a.chance_id = b.id
|
515
|
|
515
|
|
516
|
-) a where review_status=3 and (0=%v or chance_type_id =%v) and a.enable_status=1
|
516
|
+) a where review_status=3 and (0=%v or chance_type_id =%v) and a.enable_status=1 and status=1
|
517
|
`, uid, uid, chanceTypeId, chanceTypeId)
|
517
|
`, uid, uid, chanceTypeId, chanceTypeId)
|
518
|
if err = utils.ExecuteQueryOne(&total, sqlCount); err != nil {
|
518
|
if err = utils.ExecuteQueryOne(&total, sqlCount); err != nil {
|
519
|
return
|
519
|
return
|
|
@@ -582,120 +582,6 @@ select * from ( |
|
@@ -582,120 +582,6 @@ select * from ( |
582
|
return
|
582
|
return
|
583
|
}
|
583
|
}
|
584
|
|
584
|
|
585
|
-//type2 对我所在部门公开的机会 公司公开的机会
|
|
|
586
|
-func ValidtChancePublicCompany(uid, cid int64, chanceTypeId int, lastId int64, pageSize int, v interface{}, departmentIds []int64) (total int, err error) {
|
|
|
587
|
- sql := fmt.Sprintf(`
|
|
|
588
|
-select a.*,b.images,speechs,videos from (
|
|
|
589
|
-select * from (
|
|
|
590
|
- ##公司公开的机会
|
|
|
591
|
- 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 from chance
|
|
|
592
|
- where company_id = %v and publish_status = 2
|
|
|
593
|
-
|
|
|
594
|
- UNION
|
|
|
595
|
- ##指定部门-机会公开的部门
|
|
|
596
|
- 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 from (
|
|
|
597
|
- select DISTINCT chance_id from chance_department where department_id in (%v)
|
|
|
598
|
- )a inner join chance b on a.chance_id = b.id
|
|
|
599
|
- UNION
|
|
|
600
|
-
|
|
|
601
|
- ##本人
|
|
|
602
|
- 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 from chance
|
|
|
603
|
- where user_id = %v
|
|
|
604
|
- UNION
|
|
|
605
|
-
|
|
|
606
|
- ##我审核
|
|
|
607
|
- 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 from (
|
|
|
608
|
- select DISTINCT chance_id from audit_flow_process where uid =%v
|
|
|
609
|
- ) a inner join chance b on a.chance_id = b.id
|
|
|
610
|
-
|
|
|
611
|
-) a where review_status=3 and (0=%v or chance_type_id =%v) and (0=%v or id<%v) and a.enable_status=1
|
|
|
612
|
-order by create_at desc
|
|
|
613
|
-limit %v
|
|
|
614
|
-) a left JOIN chance_data b on a.id =b.chance_id
|
|
|
615
|
-`, cid, utils.JoinInt64s(departmentIds, ","), uid, uid, chanceTypeId, chanceTypeId, lastId, lastId, pageSize)
|
|
|
616
|
-
|
|
|
617
|
- sqlCount := fmt.Sprintf(`
|
|
|
618
|
-select count(0) from (
|
|
|
619
|
- ##公司公开的机会
|
|
|
620
|
- 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 from chance
|
|
|
621
|
- where company_id = %v and publish_status = 2
|
|
|
622
|
-
|
|
|
623
|
- UNION
|
|
|
624
|
- ##指定部门-机会公开的部门
|
|
|
625
|
- 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 from (
|
|
|
626
|
- select DISTINCT chance_id from chance_department where department_id in (%v)
|
|
|
627
|
- )a inner join chance b on a.chance_id = b.id
|
|
|
628
|
- UNION
|
|
|
629
|
-
|
|
|
630
|
- ##本人
|
|
|
631
|
- 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 from chance
|
|
|
632
|
- where user_id = %v
|
|
|
633
|
- UNION
|
|
|
634
|
-
|
|
|
635
|
- ##我审核
|
|
|
636
|
- 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 from (
|
|
|
637
|
- select DISTINCT chance_id from audit_flow_process where uid =%v
|
|
|
638
|
- ) a inner join chance b on a.chance_id = b.id
|
|
|
639
|
-
|
|
|
640
|
-) a where review_status=3 and (0=%v or chance_type_id =%v) and a.enable_status=1
|
|
|
641
|
-`, cid, utils.JoinInt64s(departmentIds, ","), uid, uid, chanceTypeId, chanceTypeId)
|
|
|
642
|
- if err = utils.ExecuteQueryOne(&total, sqlCount); err != nil {
|
|
|
643
|
- return
|
|
|
644
|
- }
|
|
|
645
|
- if v != nil {
|
|
|
646
|
- if err = utils.ExecuteQueryAll(v, sql); err != nil {
|
|
|
647
|
- return
|
|
|
648
|
- }
|
|
|
649
|
- }
|
|
|
650
|
- return
|
|
|
651
|
-}
|
|
|
652
|
-
|
|
|
653
|
-//type1 禁止查看所有机会
|
|
|
654
|
-func ValidChanceMyself(uid, cid int64, chanceTypeId int, lastId int64, pageSize int, v interface{}) (total int, err error) {
|
|
|
655
|
- sql := fmt.Sprintf(`
|
|
|
656
|
-select a.*,b.images,speechs,videos from (
|
|
|
657
|
-select * from (
|
|
|
658
|
- ##本人
|
|
|
659
|
- 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 from chance
|
|
|
660
|
- where user_id = %v
|
|
|
661
|
- UNION
|
|
|
662
|
-
|
|
|
663
|
- ##我审核
|
|
|
664
|
- 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 from (
|
|
|
665
|
- select DISTINCT chance_id from audit_flow_process where uid =%v
|
|
|
666
|
- ) a inner join chance b on a.chance_id = b.id
|
|
|
667
|
-
|
|
|
668
|
-) a where review_status=3 and (0=%v or chance_type_id =%v) and (0=%v or id<%v) and a.enable_status=1
|
|
|
669
|
-order by create_at desc
|
|
|
670
|
-limit %v
|
|
|
671
|
-) a left JOIN chance_data b on a.id =b.chance_id
|
|
|
672
|
-`, uid, uid, chanceTypeId, chanceTypeId, lastId, lastId, pageSize)
|
|
|
673
|
-
|
|
|
674
|
- sqlCount := fmt.Sprintf(`
|
|
|
675
|
-select count(0) from (
|
|
|
676
|
- ##本人
|
|
|
677
|
- 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 from chance
|
|
|
678
|
- where user_id = %v
|
|
|
679
|
- UNION
|
|
|
680
|
-
|
|
|
681
|
- ##我审核
|
|
|
682
|
- 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 from (
|
|
|
683
|
- select DISTINCT chance_id from audit_flow_process where uid =%v
|
|
|
684
|
- ) a inner join chance b on a.chance_id = b.id
|
|
|
685
|
-
|
|
|
686
|
-) a where review_status=3 and (0=%v or chance_type_id =%v) and a.enable_status=1
|
|
|
687
|
-`, uid, uid, chanceTypeId, chanceTypeId)
|
|
|
688
|
- if err = utils.ExecuteQueryOne(&total, sqlCount); err != nil {
|
|
|
689
|
- return
|
|
|
690
|
- }
|
|
|
691
|
- if v != nil {
|
|
|
692
|
- if err = utils.ExecuteQueryAll(v, sql); err != nil {
|
|
|
693
|
- return
|
|
|
694
|
- }
|
|
|
695
|
- }
|
|
|
696
|
- return
|
|
|
697
|
-}
|
|
|
698
|
-
|
|
|
699
|
//是否存在按发布机会部门编号查询
|
585
|
//是否存在按发布机会部门编号查询
|
700
|
func ExitsChanceByDeparmentIds(chanceId int64, departmentIds []int64) (v *Chance, err error) {
|
586
|
func ExitsChanceByDeparmentIds(chanceId int64, departmentIds []int64) (v *Chance, err error) {
|
701
|
sql := fmt.Sprintf(`select id from chance where id=%v and department_id in (%v)`,
|
587
|
sql := fmt.Sprintf(`select id from chance where id=%v and department_id in (%v)`,
|