|
...
|
...
|
@@ -687,23 +687,21 @@ and department_id in (%v)`, |
|
|
|
func GetSiftingChance(uid int64, submitStatus int, checkResultStatus int, offset int, pageSize int, v interface{}) (total int, err error) {
|
|
|
|
var where string
|
|
|
|
if submitStatus == 1 {
|
|
|
|
where = fmt.Sprintf(`where length(self_checks)>5
|
|
|
|
order by a.submit_check_time desc`)
|
|
|
|
where = fmt.Sprintf(`order by a.submit_check_time desc`)
|
|
|
|
} else {
|
|
|
|
where = fmt.Sprintf(`where length(self_checks)>5
|
|
|
|
order by a.chance_approve_time desc`)
|
|
|
|
where = fmt.Sprintf(`order by a.chance_approve_time desc`)
|
|
|
|
}
|
|
|
|
sql := fmt.Sprintf(`select a.*,b.images,b.speechs,b.videos
|
|
|
|
from (
|
|
|
|
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,
|
|
|
|
b.update_at,b.approve_time chance_approve_time,b.status,b.self_checks,b.check_result_status
|
|
|
|
b.update_at,b.approve_time chance_approve_time,b.status,b.self_checks,b.check_result_status,b.check_time
|
|
|
|
from (
|
|
|
|
select max(id) id,approve_time,approve_data,uid,chance_id,submit_check_status,submit_check_time,level
|
|
|
|
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
|
|
|
|
where a.uid=%v and b.max_id=a.id and a.submit_check_status=%v and level>0
|
|
|
|
GROUP BY chance_id
|
|
|
|
)a left outer join chance b on a.chance_id = b.id
|
|
|
|
where b.review_status=3 and b.enable_status=1 and b.status=1 and b.check_result_status =%v and a.level=b.audit_level
|
|
|
|
where b.review_status=3 and b.enable_status=1 and b.status=1 and b.check_result_status =%v and a.level=b.audit_level and length(b.self_checks)>5
|
|
|
|
)a left outer join chance_data b on a.chance_id =b.chance_id
|
|
|
|
%v
|
|
|
|
limit %v,%v`, uid, uid, submitStatus, checkResultStatus, where, offset, pageSize) //,update_at process_create_time
|
|
...
|
...
|
@@ -718,9 +716,51 @@ from ( |
|
|
|
where a.uid=%v and b.max_id=a.id and a.submit_check_status=%v and level>0
|
|
|
|
GROUP BY chance_id
|
|
|
|
)a left outer join chance b on a.chance_id = b.id
|
|
|
|
where b.review_status=3 and b.enable_status=1 and b.status=1 and b.check_result_status =%v and a.level=b.audit_level and length(b.self_checks)>5
|
|
|
|
)a
|
|
|
|
`, uid, uid, submitStatus, checkResultStatus) //and enable_status =1
|
|
|
|
if err = utils.ExecuteQueryOne(&total, sqlCount); err != nil {
|
|
|
|
return
|
|
|
|
}
|
|
|
|
if v != nil {
|
|
|
|
if err = utils.ExecuteQueryAll(v, sql); err != nil {
|
|
|
|
return
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return
|
|
|
|
}
|
|
|
|
|
|
|
|
//获取筛选结果的机会
|
|
|
|
//@submitStatus 提交状态:已提交 未提交
|
|
|
|
//@checkResultStatus 筛选结果状态:通过 / 不通过
|
|
|
|
func GetSiftingResults(uid int64, submitStatus, checkResultStatus int, offset int, pageSize int, v interface{}) (total int, err error) {
|
|
|
|
sql := fmt.Sprintf(`select a.*,b.images,b.speechs,b.videos
|
|
|
|
from (
|
|
|
|
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,
|
|
|
|
b.update_at,b.approve_time chance_approve_time,b.status,b.self_checks,b.check_result_status,b.check_time
|
|
|
|
from (
|
|
|
|
select max(id) id,approve_time,approve_data,uid,chance_id,submit_check_status,submit_check_time,level
|
|
|
|
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
|
|
|
|
where a.uid=%v and b.max_id=a.id and a.submit_check_status=%v and level>0
|
|
|
|
GROUP BY chance_id
|
|
|
|
)a left outer join chance b on a.chance_id = b.id
|
|
|
|
where b.review_status=3 and b.enable_status=1 and b.status=1 and b.check_result_status =%v and a.level=b.audit_level
|
|
|
|
)a left outer join chance_data b on a.chance_id =b.chance_id
|
|
|
|
order by a.check_time desc
|
|
|
|
limit %v,%v`, uid, uid, submitStatus, checkResultStatus, offset, pageSize) //,update_at process_create_time
|
|
|
|
|
|
|
|
sqlCount := fmt.Sprintf(`select count(0)
|
|
|
|
from (
|
|
|
|
select a.*,b.user_id chance_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.self_checks,b.check_result_status
|
|
|
|
from (
|
|
|
|
select max(id) id,approve_time,approve_data,uid,chance_id,submit_check_status,submit_check_time,level
|
|
|
|
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
|
|
|
|
where a.uid=%v and b.max_id=a.id and a.submit_check_status=%v and level>0
|
|
|
|
GROUP BY chance_id
|
|
|
|
)a left outer join chance b on a.chance_id = b.id
|
|
|
|
where b.review_status=3 and b.enable_status=1 and b.status=1 and b.check_result_status =%v and a.level=b.audit_level
|
|
|
|
)a
|
|
|
|
where length(self_checks)>5
|
|
|
|
`, uid, uid, submitStatus, checkResultStatus) //and enable_status =1
|
|
|
|
if err = utils.ExecuteQueryOne(&total, sqlCount); err != nil {
|
|
|
|
return
|
...
|
...
|
|