...
|
...
|
@@ -249,3 +249,52 @@ func (d *StaffAssessDao) SearchUserAssessContent(param SearchConditin1) ([]UserA |
|
|
_, err := tx.QueryOne(&result, sqlStr, condition...)
|
|
|
return result, err
|
|
|
}
|
|
|
|
|
|
// 根据用户的查看权限 合并用户
|
|
|
// with t_user_department as (
|
|
|
// select "user".id as user_id ,jsonb_array_elements_text ("user".department_id) as depart_id from "user"
|
|
|
// where "user".company_id= 526
|
|
|
// ),
|
|
|
// t_department as (
|
|
|
// select department.id::text as depart_id from department where charge_user_ids @>'[3330208201102336]'
|
|
|
// ),
|
|
|
// -- 如果是部门管理员 获取用户列表
|
|
|
// t_user_1 as (
|
|
|
// select t_user_department.user_id from t_user_department
|
|
|
// join t_department on t_user_department.depart_id = t_department.depart_id
|
|
|
// ),
|
|
|
// -- 如果是hrbp
|
|
|
// t_user_2 as(
|
|
|
// select jsonb_array_elements_text (evaluation_project.recipients) as user_id
|
|
|
// from evaluation_project
|
|
|
// where evaluation_project.cycle_id =1592787960795762688
|
|
|
// and evaluation_project.hr_bp = 1
|
|
|
// ),
|
|
|
// -- 如果是项目管理员
|
|
|
// t_user_3 as(
|
|
|
// select jsonb_array_elements_text (evaluation_project.recipients) as user_id
|
|
|
// from evaluation_project
|
|
|
// where evaluation_project.cycle_id =1592787960795762688
|
|
|
// and evaluation_project.pmp =1
|
|
|
// and evaluation_project.pmp_ids @>'[3330208201102336]'
|
|
|
// ),
|
|
|
// -- 合并用户
|
|
|
// t_user_all as(
|
|
|
// select t_user_1.user_id::text from t_user_1
|
|
|
// union
|
|
|
// select t_user_2.user_id::text from t_user_2
|
|
|
// union
|
|
|
// select t_user_3.user_id::text from t_user_3
|
|
|
// ),
|
|
|
// -- 根据用户提取评估列表
|
|
|
// t_staff_assess as(
|
|
|
// select staff_assess.id as assess_id,
|
|
|
// staff_assess.target_user->>'userId' as user_id,
|
|
|
// staff_assess.target_user->>'userName' as user_name
|
|
|
// from staff_assess
|
|
|
// join t_user_all on staff_assess.target_user->>'userId'= t_user_all.user_id
|
|
|
// where staff_assess.cycle_id = 1592787960795762688
|
|
|
// and to_char(staff_assess.begin_time,'YYYY-MM-DD')='2022-11-24'
|
|
|
// and staff_assess."types" ='self'
|
|
|
// limit 1 offset 0
|
|
|
// ) |
...
|
...
|
|