...
|
...
|
@@ -111,12 +111,12 @@ func DeleteChance(id int64) (err error) { |
|
|
func GetChanceMyChance(uid, cid int64, reviewStatus []int8, lastId int64, pageSize int, v interface{}) (total int, err error) {
|
|
|
sql := `select a.*,b.images,speechs,videos
|
|
|
from (
|
|
|
select id,user_id,create_at,update_at,approve_time chance_approve_time,source_content,approve_data,review_status,enable_status,status from chance
|
|
|
where user_id=? and company_id=? and review_status in (?) and (?=0 or id<?) and status=1 and enable_status=1
|
|
|
select id,user_id,create_at,update_at,update_at chance_approve_time,source_content,approve_data,review_status,enable_status,status from chance
|
|
|
where user_id=? and company_id=? and review_status in (?) and (?=0 or unix_timestamp(update_at)<?) and status=1 and enable_status=1
|
|
|
) a left JOIN chance_data b on a.id =b.chance_id
|
|
|
order by update_at desc
|
|
|
limit ?
|
|
|
`
|
|
|
` //approve_time
|
|
|
//update_at
|
|
|
sqlCount := fmt.Sprintf(`select count(0) from (
|
|
|
select id,user_id,create_at,source_content from chance
|
...
|
...
|
@@ -137,10 +137,11 @@ func GetChanceMyApproveChance(uid, cid int64, reviewStatus []int8, lastId int64, |
|
|
sql := fmt.Sprintf(`select a.*,b.images,b.speechs,b.videos from (
|
|
|
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 (
|
|
|
select id,approve_time,approve_data,uid,chance_id,approve_message,update_at process_create_time
|
|
|
from audit_flow_process where uid=? and review_status in (%v) and (?=0 or id<?)
|
|
|
from audit_flow_process where uid=? and review_status in (%v)
|
|
|
)a left outer join chance b on a.chance_id = b.id
|
|
|
)a left outer join chance_data b on a.chance_id =b.chance_id
|
|
|
order by process_create_time desc
|
|
|
where (?=0 or unix_timestamp(a.update_at)<?)
|
|
|
order by a.update_at desc
|
|
|
LIMIT ?`, utils.JoinInt8s(reviewStatus, ",")) //and enable_status =1 //就算已经删除了,列表上面还是要体现已经删除
|
|
|
|
|
|
sqlCount := fmt.Sprintf(`select count(0)
|
...
|
...
|
@@ -160,10 +161,11 @@ func GetChanceMyApproveChanceEnable(uid, cid int64, reviewStatus []int8, lastId |
|
|
sql := fmt.Sprintf(`select a.*,b.images,b.speechs,b.videos from (
|
|
|
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 (
|
|
|
select id,approve_time,approve_data,uid,chance_id,approve_message
|
|
|
from audit_flow_process where uid=? and review_status in (%v) and (?=0 or id<?) and enable_status =1
|
|
|
from audit_flow_process where uid=? and review_status in (%v) and enable_status =1
|
|
|
)a left outer join chance b on a.chance_id = b.id
|
|
|
)a left outer join chance_data b on a.chance_id =b.chance_id
|
|
|
order by process_create_time desc
|
|
|
where (?=0 or unix_timestamp(a.update_at)<?)
|
|
|
order by a.update_at desc
|
|
|
LIMIT ?`, utils.JoinInt8s(reviewStatus, ",")) //,update_at process_create_time
|
|
|
|
|
|
sqlCount := fmt.Sprintf(`select count(0)
|
...
|
...
|
@@ -266,17 +268,18 @@ func GetChancePoolAll(uid, cid int64, chanceTypeId int, lastId int64, pageSize i |
|
|
|
|
|
sql := `select a.*,b.images,speechs,videos
|
|
|
from (
|
|
|
select id,user_id,create_at,source_content,review_status,audit_template_id,chance_type_id,comment_total,zan_total,view_total from chance
|
|
|
where company_id=? and review_status=3 and (?=0 or chance_type_id =?) and (?=0 or id<?) and enable_status=1 and status=1
|
|
|
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
|
|
|
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
|
|
|
) a left JOIN chance_data b on a.id =b.chance_id
|
|
|
order by create_at desc
|
|
|
limit ?
|
|
|
) a left JOIN chance_data b on a.id =b.chance_id`
|
|
|
`
|
|
|
|
|
|
//if public==protocol.pu
|
|
|
|
|
|
sqlCount := fmt.Sprintf(`select count(0) from (
|
|
|
select id from chance
|
|
|
where company_id=? and review_status=3 and (%v=0 or chance_type_id =%v) and enable_status=1 and status=1
|
|
|
order by create_at desc
|
|
|
) a left JOIN chance_data b on a.id =b.chance_id`, chanceTypeId, chanceTypeId)
|
|
|
if err = utils.ExecuteQueryOne(&total, sqlCount, cid); err != nil {
|
|
|
return
|
...
|
...
|
@@ -296,46 +299,46 @@ func GetChancePoolSpecialDepartment(uid, cid int64, chanceTypeId int, lastId int |
|
|
select a.*,b.images,speechs,videos from (
|
|
|
select * from (
|
|
|
##公司公开的机会
|
|
|
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
|
|
|
where company_id = %v and publish_status = 2
|
|
|
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
|
|
|
where company_id = %v and publish_status = 2 and review_status=3
|
|
|
UNION
|
|
|
|
|
|
##指定部门-机会提交的部门
|
|
|
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
|
|
|
where department_id in (%v)
|
|
|
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
|
|
|
where department_id in (%v) and review_status=3
|
|
|
UNION
|
|
|
|
|
|
##本人
|
|
|
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
|
|
|
where user_id = %v
|
|
|
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
|
|
|
where user_id = %v and review_status=3
|
|
|
UNION
|
|
|
|
|
|
##我审核
|
|
|
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 (
|
|
|
select DISTINCT chance_id from audit_flow_process where uid =%v
|
|
|
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 (
|
|
|
select DISTINCT chance_id from audit_flow_process where uid =%v
|
|
|
) a inner join chance b on a.chance_id = b.id
|
|
|
|
|
|
) 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
|
|
|
) 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
|
|
|
) a left JOIN chance_data b on a.id =b.chance_id
|
|
|
order by create_at desc
|
|
|
limit %v
|
|
|
) a left JOIN chance_data b on a.id =b.chance_id
|
|
|
`, cid, utils.JoinInt64s(departmentIds, ","), uid, uid, chanceTypeId, chanceTypeId, lastId, lastId, pageSize)
|
|
|
|
|
|
sqlCount := fmt.Sprintf(`
|
|
|
select count(0) from (
|
|
|
##公司公开的机会
|
|
|
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
|
|
|
where company_id = %v and publish_status = 2
|
|
|
where company_id = %v and publish_status = 2 and review_status=3
|
|
|
UNION
|
|
|
|
|
|
##指定部门-机会提交的部门
|
|
|
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
|
|
|
where department_id in (%v)
|
|
|
where department_id in (%v) and review_status=3
|
|
|
UNION
|
|
|
|
|
|
##本人
|
|
|
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
|
|
|
where user_id = %v
|
|
|
where user_id = %v and review_status=3
|
|
|
UNION
|
|
|
|
|
|
##我审核
|
...
|
...
|
@@ -363,35 +366,37 @@ func GetChancePoolDepartment(uid, cid int64, chanceTypeId int, lastId int64, pag |
|
|
select a.*,b.images,speechs,videos from (
|
|
|
select * from (
|
|
|
##指定部门-机会公开的部门
|
|
|
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 (
|
|
|
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 (
|
|
|
select DISTINCT chance_id from chance_department where department_id in (%v)
|
|
|
)a inner join chance b on a.chance_id = b.id
|
|
|
where review_status=3
|
|
|
|
|
|
UNION
|
|
|
|
|
|
##公司公开的机会
|
|
|
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
|
|
|
where company_id = %v and publish_status = 2
|
|
|
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
|
|
|
where company_id = %v and publish_status = 2 and review_status=3
|
|
|
UNION
|
|
|
|
|
|
##指定部门-机会提交的部门
|
|
|
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
|
|
|
where department_id in (%v)
|
|
|
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
|
|
|
where department_id in (%v) and review_status=3
|
|
|
UNION
|
|
|
|
|
|
##本人
|
|
|
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
|
|
|
where user_id = %v
|
|
|
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
|
|
|
where user_id = %v and review_status=3
|
|
|
UNION
|
|
|
|
|
|
##我审核
|
|
|
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 (
|
|
|
select DISTINCT chance_id from audit_flow_process where uid =%v
|
|
|
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 (
|
|
|
select DISTINCT chance_id from audit_flow_process where uid =%v
|
|
|
) a inner join chance b on a.chance_id = b.id
|
|
|
|
|
|
) 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
|
|
|
) 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
|
|
|
) a left JOIN chance_data b on a.id =b.chance_id
|
|
|
order by create_at desc
|
|
|
limit %v
|
|
|
) a left JOIN chance_data b on a.id =b.chance_id
|
|
|
`, utils.JoinInt64s(userDepartmetIds, ","), cid, utils.JoinInt64s(departmentIds, ","), uid, uid, chanceTypeId, chanceTypeId, lastId, lastId, pageSize)
|
|
|
|
|
|
sqlCount := fmt.Sprintf(`
|
...
|
...
|
@@ -400,26 +405,28 @@ select count(0) from ( |
|
|
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 (
|
|
|
select DISTINCT chance_id from chance_department where department_id in (%v)
|
|
|
)a inner join chance b on a.chance_id = b.id
|
|
|
where review_status=3
|
|
|
|
|
|
UNION
|
|
|
|
|
|
##公司公开的机会
|
|
|
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
|
|
|
where company_id = %v and publish_status = 2
|
|
|
where company_id = %v and publish_status = 2 and review_status=3
|
|
|
UNION
|
|
|
|
|
|
##指定部门-机会提交的部门
|
|
|
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
|
|
|
where department_id in (%v)
|
|
|
where department_id in (%v) and review_status=3
|
|
|
UNION
|
|
|
|
|
|
##本人
|
|
|
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
|
|
|
where user_id = %v
|
|
|
where user_id = %v and review_status=3
|
|
|
UNION
|
|
|
|
|
|
##我审核
|
|
|
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 (
|
|
|
select DISTINCT chance_id from audit_flow_process where uid =%v
|
|
|
select DISTINCT chance_id from audit_flow_process where uid =%v
|
|
|
) a inner join chance b on a.chance_id = b.id
|
|
|
|
|
|
) 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, |
|
|
select a.*,b.images,speechs,videos from (
|
|
|
select * from (
|
|
|
##公司公开的机会
|
|
|
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
|
|
|
where company_id = %v and publish_status = 2
|
|
|
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
|
|
|
where company_id = %v and publish_status = 2 and review_status=3
|
|
|
|
|
|
UNION
|
|
|
##指定部门-机会公开的部门
|
|
|
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 (
|
|
|
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 (
|
|
|
select DISTINCT chance_id from chance_department where department_id in (%v)
|
|
|
)a inner join chance b on a.chance_id = b.id
|
|
|
where review_status=3
|
|
|
|
|
|
UNION
|
|
|
|
|
|
##本人
|
|
|
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
|
|
|
where user_id = %v
|
|
|
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
|
|
|
where user_id = %v and review_status=3
|
|
|
UNION
|
|
|
|
|
|
##我审核
|
|
|
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 (
|
|
|
select DISTINCT chance_id from audit_flow_process where uid =%v
|
|
|
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 (
|
|
|
select DISTINCT chance_id from audit_flow_process where uid =%v
|
|
|
) a inner join chance b on a.chance_id = b.id
|
|
|
|
|
|
) 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
|
|
|
) 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
|
|
|
) a left JOIN chance_data b on a.id =b.chance_id
|
|
|
order by create_at desc
|
|
|
limit %v
|
|
|
) a left JOIN chance_data b on a.id =b.chance_id
|
|
|
`, cid, utils.JoinInt64s(departmentIds, ","), uid, uid, chanceTypeId, chanceTypeId, lastId, lastId, pageSize)
|
|
|
|
|
|
sqlCount := fmt.Sprintf(`
|
|
|
select count(0) from (
|
|
|
##公司公开的机会
|
|
|
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
|
|
|
where company_id = %v and publish_status = 2
|
|
|
where company_id = %v and publish_status = 2 and review_status=3
|
|
|
|
|
|
UNION
|
|
|
##指定部门-机会公开的部门
|
|
|
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 (
|
|
|
select DISTINCT chance_id from chance_department where department_id in (%v)
|
|
|
)a inner join chance b on a.chance_id = b.id
|
|
|
where review_status=3
|
|
|
|
|
|
UNION
|
|
|
|
|
|
##本人
|
|
|
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
|
|
|
where user_id = %v
|
|
|
where user_id = %v and review_status=3
|
|
|
UNION
|
|
|
|
|
|
##我审核
|
...
|
...
|
@@ -509,26 +520,26 @@ func GetChancePoolMyself(uid, cid int64, chanceTypeId int, lastId int64, pageSiz |
|
|
select a.*,b.images,speechs,videos from (
|
|
|
select * from (
|
|
|
##本人
|
|
|
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
|
|
|
where user_id = %v
|
|
|
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
|
|
|
where user_id = %v and review_status=3
|
|
|
UNION
|
|
|
|
|
|
##我审核
|
|
|
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 (
|
|
|
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 (
|
|
|
select DISTINCT chance_id from audit_flow_process where uid =%v
|
|
|
) a inner join chance b on a.chance_id = b.id
|
|
|
|
|
|
) 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
|
|
|
) 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
|
|
|
) a left JOIN chance_data b on a.id =b.chance_id
|
|
|
order by create_at desc
|
|
|
limit %v
|
|
|
) a left JOIN chance_data b on a.id =b.chance_id
|
|
|
`, uid, uid, chanceTypeId, chanceTypeId, lastId, lastId, pageSize)
|
|
|
|
|
|
sqlCount := fmt.Sprintf(`
|
|
|
select count(0) from (
|
|
|
##本人
|
|
|
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
|
|
|
where user_id = %v
|
|
|
where user_id = %v and review_status=3
|
|
|
UNION
|
|
|
|
|
|
##我审核
|
...
|
...
|
|