...
|
...
|
@@ -36,6 +36,8 @@ type Chance struct { |
|
|
Code string `orm:"column(code)" description:"机会编码 一级编码+二级编码"`
|
|
|
Status int8 `orm:"column(status)" description:"状态 1:开启 2:关闭 "`
|
|
|
SelfChecks string `orm:"column(self_checks);size(1000);null" description:"自查内容"`
|
|
|
SubmitCheckTime time.Time `orm:"column(submit_check_time);type(timestamp)" description:"提交筛选时间"`
|
|
|
SubmitCheckStatus int `orm:"column(submit_check_status)" description:"提交筛选状态 0:未提交 1:已提交"`
|
|
|
}
|
|
|
|
|
|
const (
|
...
|
...
|
@@ -678,3 +680,55 @@ and department_id in (%v)`, |
|
|
}
|
|
|
return
|
|
|
}
|
|
|
|
|
|
//获取筛选中的机会
|
|
|
//@submitStatus 提交状态:已提交 未提交
|
|
|
//@checkResultStatus 筛选结果状态:通过 / 不通过
|
|
|
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`)
|
|
|
} else {
|
|
|
where = fmt.Sprintf(`where length(self_checks)>5
|
|
|
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
|
|
|
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
|
|
|
%v
|
|
|
limit %v,%v`, uid, uid, submitStatus, checkResultStatus, where, 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
|
|
|
}
|
|
|
if v != nil {
|
|
|
if err = utils.ExecuteQueryAll(v, sql); err != nil {
|
|
|
return
|
|
|
}
|
|
|
}
|
|
|
return
|
|
|
} |
...
|
...
|
|