1
|
package models
|
1
|
package models
|
2
|
|
2
|
|
3
|
import (
|
3
|
import (
|
|
|
4
|
+ "bytes"
|
4
|
"fmt"
|
5
|
"fmt"
|
5
|
"opp/internal/utils"
|
6
|
"opp/internal/utils"
|
6
|
"time"
|
7
|
"time"
|
|
@@ -16,7 +17,7 @@ type Chance struct { |
|
@@ -16,7 +17,7 @@ type Chance struct { |
16
|
ChanceTypeId int `orm:"column(chance_type_id)" description:"表chance_type.id 机会类型 "`
|
17
|
ChanceTypeId int `orm:"column(chance_type_id)" description:"表chance_type.id 机会类型 "`
|
17
|
AuditTemplateId int64 `orm:"column(audit_template_id)" description:"表audit_template.id 所属审批模板编号"`
|
18
|
AuditTemplateId int64 `orm:"column(audit_template_id)" description:"表audit_template.id 所属审批模板编号"`
|
18
|
AuditTemplateConfig string `orm:"column(audit_template_config);size(255);null" description:"模板配置 (存旧的配置信息,对新改动的不影响)"`
|
19
|
AuditTemplateConfig string `orm:"column(audit_template_config);size(255);null" description:"模板配置 (存旧的配置信息,对新改动的不影响)"`
|
19
|
- Content string `orm:"column(content)" description:"格式化后的文本内容"`
|
20
|
+ //Content string `orm:"column(content)" description:"格式化后的文本内容"`
|
20
|
SourceContent string `orm:"column(source_content)" description:"原始表单内容 json"`
|
21
|
SourceContent string `orm:"column(source_content)" description:"原始表单内容 json"`
|
21
|
ViewTotal int `orm:"column(view_total)" description:"查看总数"`
|
22
|
ViewTotal int `orm:"column(view_total)" description:"查看总数"`
|
22
|
CommentTotal int `orm:"column(comment_total)" description:"评论总数"`
|
23
|
CommentTotal int `orm:"column(comment_total)" description:"评论总数"`
|
|
@@ -39,6 +40,8 @@ type Chance struct { |
|
@@ -39,6 +40,8 @@ type Chance struct { |
39
|
CheckTime time.Time `orm:"column(check_time);type(timestamp)" description:"时间"`
|
40
|
CheckTime time.Time `orm:"column(check_time);type(timestamp)" description:"时间"`
|
40
|
CheckResultStatus int `orm:"column(check_result_status)" description:"机会筛选状态【1:待处理】【2:通过】【3:不通过】"`
|
41
|
CheckResultStatus int `orm:"column(check_result_status)" description:"机会筛选状态【1:待处理】【2:通过】【3:不通过】"`
|
41
|
CheckResult string `orm:"column(check_result);null" description:"筛选结果"`
|
42
|
CheckResult string `orm:"column(check_result);null" description:"筛选结果"`
|
|
|
43
|
+ Type int8 `orm:"column(type)" description:"机会类别:0:机会池 1:储备池 "`
|
|
|
44
|
+ ReserveTypeId int `orm:"column(reserve_type_id)" description:"当前审批步骤"`
|
42
|
}
|
45
|
}
|
43
|
|
46
|
|
44
|
const (
|
47
|
const (
|
|
@@ -46,6 +49,32 @@ const ( |
|
@@ -46,6 +49,32 @@ const ( |
46
|
ChanceStatusClose = 2 //关闭
|
49
|
ChanceStatusClose = 2 //关闭
|
47
|
)
|
50
|
)
|
48
|
|
51
|
|
|
|
52
|
+const (
|
|
|
53
|
+ ChancePool = iota //机会池
|
|
|
54
|
+ ChanceReserve //机会储备池
|
|
|
55
|
+)
|
|
|
56
|
+
|
|
|
57
|
+type ChancePoolOption struct {
|
|
|
58
|
+ ChanceTypeId int //机会类型编号
|
|
|
59
|
+ DIds []int //部门编号列表
|
|
|
60
|
+ Type int8 //机会类型
|
|
|
61
|
+ ReserveTypeId int //机会储备类型编号
|
|
|
62
|
+}
|
|
|
63
|
+
|
|
|
64
|
+//机会池查询选项
|
|
|
65
|
+//@chanceTypeId 机会类型编号
|
|
|
66
|
+//@deps 部门编号列表
|
|
|
67
|
+//@t 机会类型
|
|
|
68
|
+//@rt 储备类型
|
|
|
69
|
+func NewChancePoolOption(chanceTypeId int, deps []int, t int8, rt int) *ChancePoolOption {
|
|
|
70
|
+ return &ChancePoolOption{
|
|
|
71
|
+ ChanceTypeId: chanceTypeId,
|
|
|
72
|
+ DIds: deps,
|
|
|
73
|
+ Type: t,
|
|
|
74
|
+ ReserveTypeId: rt,
|
|
|
75
|
+ }
|
|
|
76
|
+}
|
|
|
77
|
+
|
49
|
var (
|
78
|
var (
|
50
|
SqlGetChanceSelfChecks = `select user_id,review_status,self_checks from chance where id =?` //机会自查数据
|
79
|
SqlGetChanceSelfChecks = `select user_id,review_status,self_checks from chance where id =?` //机会自查数据
|
51
|
)
|
80
|
)
|
|
@@ -273,28 +302,28 @@ where user_id =?` |
|
@@ -273,28 +302,28 @@ where user_id =?` |
273
|
}
|
302
|
}
|
274
|
|
303
|
|
275
|
//type4 查看所有机会
|
304
|
//type4 查看所有机会
|
276
|
-func GetChancePoolAll(uid, cid int64, chanceTypeId int, dIds []int, lastId int64, pageSize int, v interface{}) (total int, err error) {
|
|
|
277
|
- var filterDepartment string = getFilterSqlByDIds(dIds)
|
305
|
+func GetChancePoolAll(uid, cid int64, option *ChancePoolOption, lastId int64, pageSize int, v interface{}) (total int, err error) {
|
|
|
306
|
+ var filter string = getFilterSql(option)
|
278
|
sql := fmt.Sprintf(`select a.*,b.images,speechs,videos
|
307
|
sql := fmt.Sprintf(`select a.*,b.images,speechs,videos
|
279
|
from (
|
308
|
from (
|
280
|
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
|
309
|
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
|
281
|
-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 %v
|
310
|
+where company_id=? and review_status=3 and (?=0 or unix_timestamp(approve_time)<?) and enable_status=1 and status=1 %v
|
282
|
) a left JOIN chance_data b on a.id =b.chance_id
|
311
|
) a left JOIN chance_data b on a.id =b.chance_id
|
283
|
order by create_at desc
|
312
|
order by create_at desc
|
284
|
limit ?
|
313
|
limit ?
|
285
|
-`, filterDepartment)
|
314
|
+`, filter)
|
286
|
|
315
|
|
287
|
//if public==protocol.pu
|
316
|
//if public==protocol.pu
|
288
|
|
317
|
|
289
|
sqlCount := fmt.Sprintf(`select count(0) from (
|
318
|
sqlCount := fmt.Sprintf(`select count(0) from (
|
290
|
select id from chance
|
319
|
select id from chance
|
291
|
-where company_id=? and review_status=3 and (%v=0 or chance_type_id =%v) and enable_status=1 and status=1 %v
|
|
|
292
|
-) a left JOIN chance_data b on a.id =b.chance_id`, chanceTypeId, chanceTypeId, filterDepartment)
|
320
|
+where company_id=? and review_status=3 and enable_status=1 and status=1 %v
|
|
|
321
|
+) a left JOIN chance_data b on a.id =b.chance_id`, filter)
|
293
|
if err = utils.ExecuteQueryOne(&total, sqlCount, cid); err != nil {
|
322
|
if err = utils.ExecuteQueryOne(&total, sqlCount, cid); err != nil {
|
294
|
return
|
323
|
return
|
295
|
}
|
324
|
}
|
296
|
if v != nil {
|
325
|
if v != nil {
|
297
|
- if err = utils.ExecuteQueryAll(v, sql, cid, chanceTypeId, chanceTypeId, lastId, lastId, pageSize); err != nil {
|
326
|
+ if err = utils.ExecuteQueryAll(v, sql, cid, lastId, lastId, pageSize); err != nil {
|
298
|
return
|
327
|
return
|
299
|
}
|
328
|
}
|
300
|
}
|
329
|
}
|
|
@@ -302,61 +331,61 @@ where company_id=? and review_status=3 and (%v=0 or chance_type_id =%v) and ena |
|
@@ -302,61 +331,61 @@ where company_id=? and review_status=3 and (%v=0 or chance_type_id =%v) and ena |
302
|
}
|
331
|
}
|
303
|
|
332
|
|
304
|
//type3 特定部门机会
|
333
|
//type3 特定部门机会
|
305
|
-func GetChancePoolSpecialDepartment(uid, cid int64, chanceTypeId int, dIds []int, lastId int64, pageSize int, v interface{}, departmentIds []int64) (total int, err error) {
|
|
|
306
|
- var filterDepartment string = getFilterSqlByDIds(dIds)
|
334
|
+func GetChancePoolSpecialDepartment(uid, cid int64, option *ChancePoolOption, lastId int64, pageSize int, v interface{}, departmentIds []int64) (total int, err error) {
|
|
|
335
|
+ var filter string = getFilterSql(option)
|
307
|
sql := fmt.Sprintf(`
|
336
|
sql := fmt.Sprintf(`
|
308
|
select a.*,b.images,speechs,videos from (
|
337
|
select a.*,b.images,speechs,videos from (
|
309
|
select * from (
|
338
|
select * from (
|
310
|
##公司公开的机会
|
339
|
##公司公开的机会
|
311
|
- 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
|
340
|
+ 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,type,reserve_type_id from chance
|
312
|
where company_id = %v and publish_status = 2 and review_status=3
|
341
|
where company_id = %v and publish_status = 2 and review_status=3
|
313
|
UNION
|
342
|
UNION
|
314
|
|
343
|
|
315
|
##指定部门-机会提交的部门
|
344
|
##指定部门-机会提交的部门
|
316
|
- 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
|
345
|
+ 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,type,reserve_type_id from chance
|
317
|
where department_id in (%v) and review_status=3
|
346
|
where department_id in (%v) and review_status=3
|
318
|
UNION
|
347
|
UNION
|
319
|
|
348
|
|
320
|
##本人
|
349
|
##本人
|
321
|
- 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
|
350
|
+ 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,type,reserve_type_id from chance
|
322
|
where user_id = %v and review_status=3
|
351
|
where user_id = %v and review_status=3
|
323
|
UNION
|
352
|
UNION
|
324
|
|
353
|
|
325
|
##我审核
|
354
|
##我审核
|
326
|
- 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 (
|
355
|
+ 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,type,reserve_type_id from (
|
327
|
select DISTINCT chance_id from audit_flow_process where uid =%v
|
356
|
select DISTINCT chance_id from audit_flow_process where uid =%v
|
328
|
) a inner join chance b on a.chance_id = b.id
|
357
|
) a inner join chance b on a.chance_id = b.id
|
329
|
|
358
|
|
330
|
-) 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 %v
|
359
|
+) a where review_status=3 and (0=%v or unix_timestamp(create_at)<%v) and a.enable_status=1 and status=1 %v
|
331
|
) a left JOIN chance_data b on a.id =b.chance_id
|
360
|
) a left JOIN chance_data b on a.id =b.chance_id
|
332
|
order by create_at desc
|
361
|
order by create_at desc
|
333
|
limit %v
|
362
|
limit %v
|
334
|
-`, cid, utils.JoinInt64s(departmentIds, ","), uid, uid, chanceTypeId, chanceTypeId, lastId, lastId, filterDepartment, pageSize)
|
363
|
+`, cid, utils.JoinInt64s(departmentIds, ","), uid, uid, lastId, lastId, filter, pageSize)
|
335
|
|
364
|
|
336
|
sqlCount := fmt.Sprintf(`
|
365
|
sqlCount := fmt.Sprintf(`
|
337
|
select count(0) from (
|
366
|
select count(0) from (
|
338
|
##公司公开的机会
|
367
|
##公司公开的机会
|
339
|
- 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
|
368
|
+ 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,type,reserve_type_id from chance
|
340
|
where company_id = %v and publish_status = 2 and review_status=3
|
369
|
where company_id = %v and publish_status = 2 and review_status=3
|
341
|
UNION
|
370
|
UNION
|
342
|
|
371
|
|
343
|
##指定部门-机会提交的部门
|
372
|
##指定部门-机会提交的部门
|
344
|
- 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
|
+ 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,type,reserve_type_id from chance
|
345
|
where department_id in (%v) and review_status=3
|
374
|
where department_id in (%v) and review_status=3
|
346
|
UNION
|
375
|
UNION
|
347
|
|
376
|
|
348
|
##本人
|
377
|
##本人
|
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
|
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,type,reserve_type_id from chance
|
350
|
where user_id = %v and review_status=3
|
379
|
where user_id = %v and review_status=3
|
351
|
UNION
|
380
|
UNION
|
352
|
|
381
|
|
353
|
##我审核
|
382
|
##我审核
|
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 (
|
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,type,reserve_type_id from (
|
355
|
select DISTINCT chance_id from audit_flow_process where uid =%v
|
384
|
select DISTINCT chance_id from audit_flow_process where uid =%v
|
356
|
) a inner join chance b on a.chance_id = b.id
|
385
|
) a inner join chance b on a.chance_id = b.id
|
357
|
|
386
|
|
358
|
-) a where review_status=3 and (0=%v or chance_type_id =%v) and a.enable_status=1 and status=1 %v
|
|
|
359
|
-`, cid, utils.JoinInt64s(departmentIds, ","), uid, uid, chanceTypeId, chanceTypeId, filterDepartment)
|
387
|
+) a where review_status=3 and a.enable_status=1 and status=1 %v
|
|
|
388
|
+`, cid, utils.JoinInt64s(departmentIds, ","), uid, uid, filter)
|
360
|
if err = utils.ExecuteQueryOne(&total, sqlCount); err != nil {
|
389
|
if err = utils.ExecuteQueryOne(&total, sqlCount); err != nil {
|
361
|
return
|
390
|
return
|
362
|
}
|
391
|
}
|
|
@@ -369,13 +398,13 @@ select count(0) from ( |
|
@@ -369,13 +398,13 @@ select count(0) from ( |
369
|
}
|
398
|
}
|
370
|
|
399
|
|
371
|
//type32 特定部门机会 - 多角色时包含levl2 部门公开
|
400
|
//type32 特定部门机会 - 多角色时包含levl2 部门公开
|
372
|
-func GetChancePoolDepartment(uid, cid int64, chanceTypeId int, dIds []int, lastId int64, pageSize int, v interface{}, departmentIds []int64, userDepartmetIds []int64) (total int, err error) {
|
|
|
373
|
- var filterDepartment string = getFilterSqlByDIds(dIds)
|
401
|
+func GetChancePoolDepartment(uid, cid int64, option *ChancePoolOption, lastId int64, pageSize int, v interface{}, departmentIds []int64, userDepartmetIds []int64) (total int, err error) {
|
|
|
402
|
+ var filter string = getFilterSql(option)
|
374
|
sql := fmt.Sprintf(`
|
403
|
sql := fmt.Sprintf(`
|
375
|
select a.*,b.images,speechs,videos from (
|
404
|
select a.*,b.images,speechs,videos from (
|
376
|
select * from (
|
405
|
select * from (
|
377
|
##指定部门-机会公开的部门
|
406
|
##指定部门-机会公开的部门
|
378
|
- 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 (
|
407
|
+ 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,type,reserve_type_id from (
|
379
|
select DISTINCT chance_id from chance_department where department_id in (%v)
|
408
|
select DISTINCT chance_id from chance_department where department_id in (%v)
|
380
|
)a inner join chance b on a.chance_id = b.id
|
409
|
)a inner join chance b on a.chance_id = b.id
|
381
|
where review_status=3
|
410
|
where review_status=3
|
|
@@ -383,35 +412,35 @@ select * from ( |
|
@@ -383,35 +412,35 @@ select * from ( |
383
|
UNION
|
412
|
UNION
|
384
|
|
413
|
|
385
|
##公司公开的机会
|
414
|
##公司公开的机会
|
386
|
- 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
|
415
|
+ 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,type,reserve_type_id from chance
|
387
|
where company_id = %v and publish_status = 2 and review_status=3
|
416
|
where company_id = %v and publish_status = 2 and review_status=3
|
388
|
UNION
|
417
|
UNION
|
389
|
|
418
|
|
390
|
##指定部门-机会提交的部门
|
419
|
##指定部门-机会提交的部门
|
391
|
- 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
|
420
|
+ 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,type,reserve_type_id from chance
|
392
|
where department_id in (%v) and review_status=3
|
421
|
where department_id in (%v) and review_status=3
|
393
|
UNION
|
422
|
UNION
|
394
|
|
423
|
|
395
|
##本人
|
424
|
##本人
|
396
|
- 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
|
425
|
+ 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,type,reserve_type_id from chance
|
397
|
where user_id = %v and review_status=3
|
426
|
where user_id = %v and review_status=3
|
398
|
UNION
|
427
|
UNION
|
399
|
|
428
|
|
400
|
##我审核
|
429
|
##我审核
|
401
|
- 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 (
|
430
|
+ 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,type,reserve_type_id from (
|
402
|
select DISTINCT chance_id from audit_flow_process where uid =%v
|
431
|
select DISTINCT chance_id from audit_flow_process where uid =%v
|
403
|
) a inner join chance b on a.chance_id = b.id
|
432
|
) a inner join chance b on a.chance_id = b.id
|
404
|
|
433
|
|
405
|
-) 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 %v
|
434
|
+) a where review_status=3 and (0=%v or unix_timestamp(create_at)<%v) and a.enable_status=1 and status=1 %v
|
406
|
) a left JOIN chance_data b on a.id =b.chance_id
|
435
|
) a left JOIN chance_data b on a.id =b.chance_id
|
407
|
order by create_at desc
|
436
|
order by create_at desc
|
408
|
limit %v
|
437
|
limit %v
|
409
|
-`, utils.JoinInt64s(userDepartmetIds, ","), cid, utils.JoinInt64s(departmentIds, ","), uid, uid, chanceTypeId, chanceTypeId, lastId, lastId, filterDepartment, pageSize)
|
438
|
+`, utils.JoinInt64s(userDepartmetIds, ","), cid, utils.JoinInt64s(departmentIds, ","), uid, uid, lastId, lastId, filter, pageSize)
|
410
|
|
439
|
|
411
|
sqlCount := fmt.Sprintf(`
|
440
|
sqlCount := fmt.Sprintf(`
|
412
|
select count(0) from (
|
441
|
select count(0) from (
|
413
|
##指定部门-机会公开的部门
|
442
|
##指定部门-机会公开的部门
|
414
|
- 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 (
|
443
|
+ 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,type,reserve_type_id from (
|
415
|
select DISTINCT chance_id from chance_department where department_id in (%v)
|
444
|
select DISTINCT chance_id from chance_department where department_id in (%v)
|
416
|
)a inner join chance b on a.chance_id = b.id
|
445
|
)a inner join chance b on a.chance_id = b.id
|
417
|
where review_status=3
|
446
|
where review_status=3
|
|
@@ -419,27 +448,27 @@ select count(0) from ( |
|
@@ -419,27 +448,27 @@ select count(0) from ( |
419
|
UNION
|
448
|
UNION
|
420
|
|
449
|
|
421
|
##公司公开的机会
|
450
|
##公司公开的机会
|
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 chance
|
451
|
+ 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,type,reserve_type_id from chance
|
423
|
where company_id = %v and publish_status = 2 and review_status=3
|
452
|
where company_id = %v and publish_status = 2 and review_status=3
|
424
|
UNION
|
453
|
UNION
|
425
|
|
454
|
|
426
|
##指定部门-机会提交的部门
|
455
|
##指定部门-机会提交的部门
|
427
|
- 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
|
+ 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,type,reserve_type_id from chance
|
428
|
where department_id in (%v) and review_status=3
|
457
|
where department_id in (%v) and review_status=3
|
429
|
UNION
|
458
|
UNION
|
430
|
|
459
|
|
431
|
##本人
|
460
|
##本人
|
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
|
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,type,reserve_type_id from chance
|
433
|
where user_id = %v and review_status=3
|
462
|
where user_id = %v and review_status=3
|
434
|
UNION
|
463
|
UNION
|
435
|
|
464
|
|
436
|
##我审核
|
465
|
##我审核
|
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 (
|
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,type,reserve_type_id from (
|
438
|
select DISTINCT chance_id from audit_flow_process where uid =%v
|
467
|
select DISTINCT chance_id from audit_flow_process where uid =%v
|
439
|
) a inner join chance b on a.chance_id = b.id
|
468
|
) a inner join chance b on a.chance_id = b.id
|
440
|
|
469
|
|
441
|
-) a where review_status=3 and (0=%v or chance_type_id =%v) and a.enable_status=1 and status=1 %v
|
|
|
442
|
-`, utils.JoinInt64s(userDepartmetIds, ","), cid, utils.JoinInt64s(departmentIds, ","), uid, uid, chanceTypeId, chanceTypeId, filterDepartment)
|
470
|
+) a where review_status=3 and a.enable_status=1 and status=1 %v
|
|
|
471
|
+`, utils.JoinInt64s(userDepartmetIds, ","), cid, utils.JoinInt64s(departmentIds, ","), uid, uid, filter)
|
443
|
if err = utils.ExecuteQueryOne(&total, sqlCount); err != nil {
|
472
|
if err = utils.ExecuteQueryOne(&total, sqlCount); err != nil {
|
444
|
return
|
473
|
return
|
445
|
}
|
474
|
}
|
|
@@ -452,18 +481,18 @@ select count(0) from ( |
|
@@ -452,18 +481,18 @@ select count(0) from ( |
452
|
}
|
481
|
}
|
453
|
|
482
|
|
454
|
//type2 对我所在部门公开的机会 公司公开的机会
|
483
|
//type2 对我所在部门公开的机会 公司公开的机会
|
455
|
-func GetChancePoolPublicCompany(uid, cid int64, chanceTypeId int, dIds []int, lastId int64, pageSize int, v interface{}, departmentIds []int64) (total int, err error) {
|
|
|
456
|
- var filterDepartment string = getFilterSqlByDIds(dIds)
|
484
|
+func GetChancePoolPublicCompany(uid, cid int64, option *ChancePoolOption, lastId int64, pageSize int, v interface{}, departmentIds []int64) (total int, err error) {
|
|
|
485
|
+ var filter string = getFilterSql(option)
|
457
|
sql := fmt.Sprintf(`
|
486
|
sql := fmt.Sprintf(`
|
458
|
select a.*,b.images,speechs,videos from (
|
487
|
select a.*,b.images,speechs,videos from (
|
459
|
select * from (
|
488
|
select * from (
|
460
|
##公司公开的机会
|
489
|
##公司公开的机会
|
461
|
- 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
|
490
|
+ 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,type,reserve_type_id from chance
|
462
|
where company_id = %v and publish_status = 2 and review_status=3
|
491
|
where company_id = %v and publish_status = 2 and review_status=3
|
463
|
|
492
|
|
464
|
UNION
|
493
|
UNION
|
465
|
##指定部门-机会公开的部门
|
494
|
##指定部门-机会公开的部门
|
466
|
- 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 (
|
495
|
+ 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,type,reserve_type_id from (
|
467
|
select DISTINCT chance_id from chance_department where department_id in (%v)
|
496
|
select DISTINCT chance_id from chance_department where department_id in (%v)
|
468
|
)a inner join chance b on a.chance_id = b.id
|
497
|
)a inner join chance b on a.chance_id = b.id
|
469
|
where review_status=3
|
498
|
where review_status=3
|
|
@@ -471,30 +500,30 @@ select * from ( |
|
@@ -471,30 +500,30 @@ select * from ( |
471
|
UNION
|
500
|
UNION
|
472
|
|
501
|
|
473
|
##本人
|
502
|
##本人
|
474
|
- 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
|
503
|
+ 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,type,reserve_type_id from chance
|
475
|
where user_id = %v and review_status=3
|
504
|
where user_id = %v and review_status=3
|
476
|
UNION
|
505
|
UNION
|
477
|
|
506
|
|
478
|
##我审核
|
507
|
##我审核
|
479
|
- 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 (
|
508
|
+ 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,type,reserve_type_id from (
|
480
|
select DISTINCT chance_id from audit_flow_process where uid =%v
|
509
|
select DISTINCT chance_id from audit_flow_process where uid =%v
|
481
|
) a inner join chance b on a.chance_id = b.id
|
510
|
) a inner join chance b on a.chance_id = b.id
|
482
|
|
511
|
|
483
|
-) 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 %v
|
512
|
+) a where review_status=3 and (0=%v or unix_timestamp(create_at)<%v) and a.enable_status=1 and status=1 %v
|
484
|
) a left JOIN chance_data b on a.id =b.chance_id
|
513
|
) a left JOIN chance_data b on a.id =b.chance_id
|
485
|
order by create_at desc
|
514
|
order by create_at desc
|
486
|
limit %v
|
515
|
limit %v
|
487
|
-`, cid, utils.JoinInt64s(departmentIds, ","), uid, uid, chanceTypeId, chanceTypeId, lastId, lastId, filterDepartment, pageSize)
|
516
|
+`, cid, utils.JoinInt64s(departmentIds, ","), uid, uid, lastId, lastId, filter, pageSize)
|
488
|
|
517
|
|
489
|
sqlCount := fmt.Sprintf(`
|
518
|
sqlCount := fmt.Sprintf(`
|
490
|
select count(0) from (
|
519
|
select count(0) from (
|
491
|
##公司公开的机会
|
520
|
##公司公开的机会
|
492
|
- 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
|
521
|
+ 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,type,reserve_type_id from chance
|
493
|
where company_id = %v and publish_status = 2 and review_status=3
|
522
|
where company_id = %v and publish_status = 2 and review_status=3
|
494
|
|
523
|
|
495
|
UNION
|
524
|
UNION
|
496
|
##指定部门-机会公开的部门
|
525
|
##指定部门-机会公开的部门
|
497
|
- 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 (
|
526
|
+ 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,type,reserve_type_id from (
|
498
|
select DISTINCT chance_id from chance_department where department_id in (%v)
|
527
|
select DISTINCT chance_id from chance_department where department_id in (%v)
|
499
|
)a inner join chance b on a.chance_id = b.id
|
528
|
)a inner join chance b on a.chance_id = b.id
|
500
|
where review_status=3
|
529
|
where review_status=3
|
|
@@ -502,17 +531,17 @@ select count(0) from ( |
|
@@ -502,17 +531,17 @@ select count(0) from ( |
502
|
UNION
|
531
|
UNION
|
503
|
|
532
|
|
504
|
##本人
|
533
|
##本人
|
505
|
- 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
|
534
|
+ 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,type,reserve_type_id from chance
|
506
|
where user_id = %v and review_status=3
|
535
|
where user_id = %v and review_status=3
|
507
|
UNION
|
536
|
UNION
|
508
|
|
537
|
|
509
|
##我审核
|
538
|
##我审核
|
510
|
- 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 (
|
539
|
+ 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,type,reserve_type_id from (
|
511
|
select DISTINCT chance_id from audit_flow_process where uid =%v
|
540
|
select DISTINCT chance_id from audit_flow_process where uid =%v
|
512
|
) a inner join chance b on a.chance_id = b.id
|
541
|
) a inner join chance b on a.chance_id = b.id
|
513
|
|
542
|
|
514
|
-) a where review_status=3 and (0=%v or chance_type_id =%v) and a.enable_status=1 and status=1 %v
|
|
|
515
|
-`, cid, utils.JoinInt64s(departmentIds, ","), uid, uid, chanceTypeId, chanceTypeId, filterDepartment)
|
543
|
+) a where review_status=3 and a.enable_status=1 and status=1 %v
|
|
|
544
|
+`, cid, utils.JoinInt64s(departmentIds, ","), uid, uid, filter)
|
516
|
if err = utils.ExecuteQueryOne(&total, sqlCount); err != nil {
|
545
|
if err = utils.ExecuteQueryOne(&total, sqlCount); err != nil {
|
517
|
return
|
546
|
return
|
518
|
}
|
547
|
}
|
|
@@ -530,42 +559,57 @@ func getFilterSqlByDIds(dIds []int) string { |
|
@@ -530,42 +559,57 @@ func getFilterSqlByDIds(dIds []int) string { |
530
|
return fmt.Sprintf(" and department_id in(%v) ", utils.JoinInts(dIds, ","))
|
559
|
return fmt.Sprintf(" and department_id in(%v) ", utils.JoinInts(dIds, ","))
|
531
|
}
|
560
|
}
|
532
|
|
561
|
|
|
|
562
|
+func getFilterSql(option *ChancePoolOption) string {
|
|
|
563
|
+ var rsp *bytes.Buffer = bytes.NewBuffer(nil)
|
|
|
564
|
+ rsp.WriteString(fmt.Sprintf(" and type =%v ", option.Type))
|
|
|
565
|
+ if option.ChanceTypeId > 0 {
|
|
|
566
|
+ rsp.WriteString(fmt.Sprintf(" and chance_type_id =%v ", option.ChanceTypeId))
|
|
|
567
|
+ }
|
|
|
568
|
+ if len(option.DIds) > 0 {
|
|
|
569
|
+ rsp.WriteString(fmt.Sprintf(" and department_id in(%v) ", utils.JoinInts(option.DIds, ",")))
|
|
|
570
|
+ }
|
|
|
571
|
+ if option.ReserveTypeId > 0 {
|
|
|
572
|
+ rsp.WriteString(fmt.Sprintf(" and reserve_type_id =%v ", option.ReserveTypeId))
|
|
|
573
|
+ }
|
|
|
574
|
+ return rsp.String()
|
|
|
575
|
+}
|
|
|
576
|
+
|
533
|
//type1 禁止查看所有机会
|
577
|
//type1 禁止查看所有机会
|
534
|
-func GetChancePoolMyself(uid, cid int64, chanceTypeId int, dIds []int, lastId int64, pageSize int, v interface{}) (total int, err error) {
|
|
|
535
|
- var filterDepartment string = getFilterSqlByDIds(dIds)
|
578
|
+func GetChancePoolMyself(uid, cid int64, option *ChancePoolOption, lastId int64, pageSize int, v interface{}) (total int, err error) {
|
|
|
579
|
+ var filter string = getFilterSql(option) // getFilterSqlByDIds(dIds)
|
536
|
sql := fmt.Sprintf(`
|
580
|
sql := fmt.Sprintf(`
|
537
|
select a.*,b.images,speechs,videos from (
|
581
|
select a.*,b.images,speechs,videos from (
|
538
|
select * from (
|
582
|
select * from (
|
539
|
##本人
|
583
|
##本人
|
540
|
- 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
|
584
|
+ 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,type,reserve_type_id from chance
|
541
|
where user_id = %v and review_status=3
|
585
|
where user_id = %v and review_status=3
|
542
|
UNION
|
586
|
UNION
|
543
|
|
587
|
|
544
|
##我审核
|
588
|
##我审核
|
545
|
- 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 (
|
589
|
+ 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,type,reserve_type_id from (
|
546
|
select DISTINCT chance_id from audit_flow_process where uid =%v
|
590
|
select DISTINCT chance_id from audit_flow_process where uid =%v
|
547
|
) a inner join chance b on a.chance_id = b.id
|
591
|
) a inner join chance b on a.chance_id = b.id
|
548
|
|
592
|
|
549
|
-) 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 %v
|
593
|
+) a where review_status=3 and (0=%v or unix_timestamp(create_at)<%v) and a.enable_status=1 and status=1 %v
|
550
|
) a left JOIN chance_data b on a.id =b.chance_id
|
594
|
) a left JOIN chance_data b on a.id =b.chance_id
|
551
|
order by create_at desc
|
595
|
order by create_at desc
|
552
|
limit %v
|
596
|
limit %v
|
553
|
-`, uid, uid, chanceTypeId, chanceTypeId, lastId, lastId, filterDepartment, pageSize)
|
597
|
+`, uid, uid, lastId, lastId, filter, pageSize)
|
554
|
|
598
|
|
555
|
sqlCount := fmt.Sprintf(`
|
599
|
sqlCount := fmt.Sprintf(`
|
556
|
select count(0) from (
|
600
|
select count(0) from (
|
557
|
##本人
|
601
|
##本人
|
558
|
- 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
|
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,status,type,reserve_type_id from chance
|
559
|
where user_id = %v and review_status=3
|
603
|
where user_id = %v and review_status=3
|
560
|
UNION
|
604
|
UNION
|
561
|
|
605
|
|
562
|
##我审核
|
606
|
##我审核
|
563
|
- 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 (
|
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,status,type,reserve_type_id from (
|
564
|
select DISTINCT chance_id from audit_flow_process where uid =%v
|
608
|
select DISTINCT chance_id from audit_flow_process where uid =%v
|
565
|
) a inner join chance b on a.chance_id = b.id
|
609
|
) a inner join chance b on a.chance_id = b.id
|
566
|
|
610
|
|
567
|
-) a where review_status=3 and (0=%v or chance_type_id =%v) and a.enable_status=1 and status=1 %v
|
|
|
568
|
-`, uid, uid, chanceTypeId, chanceTypeId, filterDepartment)
|
611
|
+) a where review_status=3 and a.enable_status=1 and status=1 %v
|
|
|
612
|
+`, uid, uid, filter)
|
569
|
if err = utils.ExecuteQueryOne(&total, sqlCount); err != nil {
|
613
|
if err = utils.ExecuteQueryOne(&total, sqlCount); err != nil {
|
570
|
return
|
614
|
return
|
571
|
}
|
615
|
}
|
|
@@ -577,62 +621,6 @@ select count(0) from ( |
|
@@ -577,62 +621,6 @@ select count(0) from ( |
577
|
return
|
621
|
return
|
578
|
}
|
622
|
}
|
579
|
|
623
|
|
580
|
-//type4 查看所有机会
|
|
|
581
|
-func ValidChanceAll(uid, cid int64, chanceTypeId int, lastId int64, pageSize int, v interface{}) (total int, err error) {
|
|
|
582
|
-
|
|
|
583
|
- // sql := `select a.*,b.images,speechs,videos
|
|
|
584
|
- //from (
|
|
|
585
|
- //select id,user_id,create_at,source_content,review_status,audit_template_id,chance_type_id,comment_total,zan_total,view_total from chance
|
|
|
586
|
- //where company_id=? and review_status=3 and (?=0 or chance_type_id =?) and (?=0 or id<?) and enable_status=1
|
|
|
587
|
- //order by create_at desc
|
|
|
588
|
- //limit ?
|
|
|
589
|
- //) a left JOIN chance_data b on a.id =b.chance_id`
|
|
|
590
|
- // //if public==protocol.pu
|
|
|
591
|
- //
|
|
|
592
|
- // sqlCount := fmt.Sprintf(`select count(0) from (
|
|
|
593
|
- //select id from chance
|
|
|
594
|
- //where company_id=? and review_status=3 and (%v=0 or chance_type_id =%v) and enable_status=1
|
|
|
595
|
- //order by create_at desc
|
|
|
596
|
- //) a left JOIN chance_data b on a.id =b.chance_id`, chanceTypeId, chanceTypeId)
|
|
|
597
|
- // if err = utils.ExecuteQueryOne(&total, sqlCount, cid); err != nil {
|
|
|
598
|
- // return
|
|
|
599
|
- // }
|
|
|
600
|
- // if v != nil {
|
|
|
601
|
- // if err = utils.ExecuteQueryAll(v, sql, cid, chanceTypeId, chanceTypeId, lastId, lastId, pageSize); err != nil {
|
|
|
602
|
- // return
|
|
|
603
|
- // }
|
|
|
604
|
- // }
|
|
|
605
|
- return
|
|
|
606
|
-}
|
|
|
607
|
-
|
|
|
608
|
-//type3 特定部门机会
|
|
|
609
|
-func ValidChanceSpecialDepartment(uid, chanceIds string, v interface{}) (err error) {
|
|
|
610
|
-
|
|
|
611
|
- sql := fmt.Sprintf(`
|
|
|
612
|
-select * from (
|
|
|
613
|
- ##指定部门-机会提交的部门
|
|
|
614
|
- ##select chance_id from chance
|
|
|
615
|
- ##where id in (v) and department_id in (v)
|
|
|
616
|
- ##UNION
|
|
|
617
|
-
|
|
|
618
|
- ##本人
|
|
|
619
|
- ##select chance_id from chance
|
|
|
620
|
- ##where user_id = v and id in (v)
|
|
|
621
|
- ##UNION
|
|
|
622
|
-
|
|
|
623
|
- ##我审核
|
|
|
624
|
- select DISTINCT chance_id from audit_flow_process where uid =%v and chance_id in (%v)
|
|
|
625
|
-)
|
|
|
626
|
-`, chanceIds)
|
|
|
627
|
-
|
|
|
628
|
- if v != nil {
|
|
|
629
|
- if err = utils.ExecuteQueryAll(v, sql); err != nil {
|
|
|
630
|
- return
|
|
|
631
|
- }
|
|
|
632
|
- }
|
|
|
633
|
- return
|
|
|
634
|
-}
|
|
|
635
|
-
|
|
|
636
|
//是否存在按发布机会部门编号查询
|
624
|
//是否存在按发布机会部门编号查询
|
637
|
func ExitsChanceByDeparmentIds(chanceId int64, departmentIds []int64) (v *Chance, err error) {
|
625
|
func ExitsChanceByDeparmentIds(chanceId int64, departmentIds []int64) (v *Chance, err error) {
|
638
|
sql := fmt.Sprintf(`select id from chance where id=%v and department_id in (%v)`,
|
626
|
sql := fmt.Sprintf(`select id from chance where id=%v and department_id in (%v)`,
|
|
@@ -696,14 +684,14 @@ func GetSiftingChance(uid int64, submitStatus int, checkResultStatus int, offset |
|
@@ -696,14 +684,14 @@ func GetSiftingChance(uid int64, submitStatus int, checkResultStatus int, offset |
696
|
from (
|
684
|
from (
|
697
|
select a.*,b.user_id chance_user_id,b.source_content,b.enable_status,b.review_status,b.audit_template_id,b.chance_type_id,b.create_at,
|
685
|
select a.*,b.user_id chance_user_id,b.source_content,b.enable_status,b.review_status,b.audit_template_id,b.chance_type_id,b.create_at,
|
698
|
b.view_total,
|
686
|
b.view_total,
|
699
|
- b.update_at,b.approve_time chance_approve_time,b.status,b.self_checks,b.check_result_status,b.check_time
|
687
|
+ b.update_at,b.approve_time chance_approve_time,b.status,b.self_checks,b.check_result_status,b.check_time,b.type
|
700
|
from (
|
688
|
from (
|
701
|
select max(id) id,approve_time,approve_data,uid,chance_id,submit_check_status,submit_check_time,level
|
689
|
select max(id) id,approve_time,approve_data,uid,chance_id,submit_check_status,submit_check_time,level
|
702
|
from audit_flow_process a,(select MAX(id) AS max_id from audit_flow_process as t where t.uid=%v group by chance_id) b
|
690
|
from audit_flow_process a,(select MAX(id) AS max_id from audit_flow_process as t where t.uid=%v group by chance_id) b
|
703
|
where a.uid=%v and b.max_id=a.id and a.submit_check_status=%v and level>0
|
691
|
where a.uid=%v and b.max_id=a.id and a.submit_check_status=%v and level>0
|
704
|
GROUP BY chance_id
|
692
|
GROUP BY chance_id
|
705
|
)a left outer join chance b on a.chance_id = b.id
|
693
|
)a left outer join chance b on a.chance_id = b.id
|
706
|
- where b.review_status=3 and b.enable_status=1 and b.status=1 and b.check_result_status <=%v and length(b.self_checks)>5
|
694
|
+ where b.review_status=3 and b.enable_status=1 and b.status=1 and b.type=0 and b.check_result_status <=%v and length(b.self_checks)>5
|
707
|
)a left outer join chance_data b on a.chance_id =b.chance_id
|
695
|
)a left outer join chance_data b on a.chance_id =b.chance_id
|
708
|
%v
|
696
|
%v
|
709
|
limit %v,%v`, uid, uid, submitStatus, checkResultStatus, where, offset, pageSize) //,update_at process_create_time
|
697
|
limit %v,%v`, uid, uid, submitStatus, checkResultStatus, where, offset, pageSize) //,update_at process_create_time
|
|
@@ -711,14 +699,14 @@ limit %v,%v`, uid, uid, submitStatus, checkResultStatus, where, offset, pageSize |
|
@@ -711,14 +699,14 @@ limit %v,%v`, uid, uid, submitStatus, checkResultStatus, where, offset, pageSize |
711
|
sqlCount := fmt.Sprintf(`select count(0)
|
699
|
sqlCount := fmt.Sprintf(`select count(0)
|
712
|
from (
|
700
|
from (
|
713
|
select a.*,b.user_id chance_user_id,b.source_content,b.enable_status,b.review_status,b.create_at,
|
701
|
select a.*,b.user_id chance_user_id,b.source_content,b.enable_status,b.review_status,b.create_at,
|
714
|
- b.update_at,b.approve_time chance_approve_time,b.status,b.self_checks,b.check_result_status
|
702
|
+ b.update_at,b.approve_time chance_approve_time,b.status,b.self_checks,b.check_result_status,b.type
|
715
|
from (
|
703
|
from (
|
716
|
select max(id) id,approve_time,approve_data,uid,chance_id,submit_check_status,submit_check_time,level
|
704
|
select max(id) id,approve_time,approve_data,uid,chance_id,submit_check_status,submit_check_time,level
|
717
|
from audit_flow_process a,(select MAX(id) AS max_id from audit_flow_process as t where t.uid=%v group by chance_id) b
|
705
|
from audit_flow_process a,(select MAX(id) AS max_id from audit_flow_process as t where t.uid=%v group by chance_id) b
|
718
|
where a.uid=%v and b.max_id=a.id and a.submit_check_status=%v and level>0
|
706
|
where a.uid=%v and b.max_id=a.id and a.submit_check_status=%v and level>0
|
719
|
GROUP BY chance_id
|
707
|
GROUP BY chance_id
|
720
|
)a left outer join chance b on a.chance_id = b.id
|
708
|
)a left outer join chance b on a.chance_id = b.id
|
721
|
- where b.review_status=3 and b.enable_status=1 and b.status=1 and b.check_result_status <=%v and length(b.self_checks)>5
|
709
|
+ where b.review_status=3 and b.enable_status=1 and b.status=1 and b.type=0 and b.check_result_status <=%v and length(b.self_checks)>5
|
722
|
)a
|
710
|
)a
|
723
|
`, uid, uid, submitStatus, checkResultStatus) //and enable_status =1
|
711
|
`, uid, uid, submitStatus, checkResultStatus) //and enable_status =1
|
724
|
if err = utils.ExecuteQueryOne(&total, sqlCount); err != nil {
|
712
|
if err = utils.ExecuteQueryOne(&total, sqlCount); err != nil {
|
|
@@ -747,7 +735,7 @@ from ( |
|
@@ -747,7 +735,7 @@ from ( |
747
|
where a.uid=%v and b.max_id=a.id and a.submit_check_status=%v and level>0
|
735
|
where a.uid=%v and b.max_id=a.id and a.submit_check_status=%v and level>0
|
748
|
GROUP BY chance_id
|
736
|
GROUP BY chance_id
|
749
|
)a left outer join chance b on a.chance_id = b.id
|
737
|
)a left outer join chance b on a.chance_id = b.id
|
750
|
- where b.review_status=3 and b.enable_status=1 and b.status=1 and b.check_result_status =%v
|
738
|
+ where b.review_status=3 and b.enable_status=1 and b.status=1 and b.type=0 and b.check_result_status =%v
|
751
|
)a left outer join chance_data b on a.chance_id =b.chance_id
|
739
|
)a left outer join chance_data b on a.chance_id =b.chance_id
|
752
|
order by a.check_time desc
|
740
|
order by a.check_time desc
|
753
|
limit %v,%v`, uid, uid, submitStatus, checkResultStatus, offset, pageSize) //,update_at process_create_time
|
741
|
limit %v,%v`, uid, uid, submitStatus, checkResultStatus, offset, pageSize) //,update_at process_create_time
|
|
@@ -762,7 +750,7 @@ from ( |
|
@@ -762,7 +750,7 @@ from ( |
762
|
where a.uid=%v and b.max_id=a.id and a.submit_check_status=%v and level>0
|
750
|
where a.uid=%v and b.max_id=a.id and a.submit_check_status=%v and level>0
|
763
|
GROUP BY chance_id
|
751
|
GROUP BY chance_id
|
764
|
)a left outer join chance b on a.chance_id = b.id
|
752
|
)a left outer join chance b on a.chance_id = b.id
|
765
|
- where b.review_status=3 and b.enable_status=1 and b.status=1 and b.check_result_status =%v
|
753
|
+ where b.review_status=3 and b.enable_status=1 and b.status=1 and b.type=0 and b.check_result_status =%v
|
766
|
)a
|
754
|
)a
|
767
|
`, uid, uid, submitStatus, checkResultStatus) //and enable_status =1
|
755
|
`, uid, uid, submitStatus, checkResultStatus) //and enable_status =1
|
768
|
if err = utils.ExecuteQueryOne(&total, sqlCount); err != nil {
|
756
|
if err = utils.ExecuteQueryOne(&total, sqlCount); err != nil {
|