正在显示
1 个修改的文件
包含
49 行增加
和
0 行删除
@@ -249,3 +249,52 @@ func (d *StaffAssessDao) SearchUserAssessContent(param SearchConditin1) ([]UserA | @@ -249,3 +249,52 @@ func (d *StaffAssessDao) SearchUserAssessContent(param SearchConditin1) ([]UserA | ||
249 | _, err := tx.QueryOne(&result, sqlStr, condition...) | 249 | _, err := tx.QueryOne(&result, sqlStr, condition...) |
250 | return result, err | 250 | return result, err |
251 | } | 251 | } |
252 | + | ||
253 | +// 根据用户的查看权限 合并用户 | ||
254 | +// with t_user_department as ( | ||
255 | +// select "user".id as user_id ,jsonb_array_elements_text ("user".department_id) as depart_id from "user" | ||
256 | +// where "user".company_id= 526 | ||
257 | +// ), | ||
258 | +// t_department as ( | ||
259 | +// select department.id::text as depart_id from department where charge_user_ids @>'[3330208201102336]' | ||
260 | +// ), | ||
261 | +// -- 如果是部门管理员 获取用户列表 | ||
262 | +// t_user_1 as ( | ||
263 | +// select t_user_department.user_id from t_user_department | ||
264 | +// join t_department on t_user_department.depart_id = t_department.depart_id | ||
265 | +// ), | ||
266 | +// -- 如果是hrbp | ||
267 | +// t_user_2 as( | ||
268 | +// select jsonb_array_elements_text (evaluation_project.recipients) as user_id | ||
269 | +// from evaluation_project | ||
270 | +// where evaluation_project.cycle_id =1592787960795762688 | ||
271 | +// and evaluation_project.hr_bp = 1 | ||
272 | +// ), | ||
273 | +// -- 如果是项目管理员 | ||
274 | +// t_user_3 as( | ||
275 | +// select jsonb_array_elements_text (evaluation_project.recipients) as user_id | ||
276 | +// from evaluation_project | ||
277 | +// where evaluation_project.cycle_id =1592787960795762688 | ||
278 | +// and evaluation_project.pmp =1 | ||
279 | +// and evaluation_project.pmp_ids @>'[3330208201102336]' | ||
280 | +// ), | ||
281 | +// -- 合并用户 | ||
282 | +// t_user_all as( | ||
283 | +// select t_user_1.user_id::text from t_user_1 | ||
284 | +// union | ||
285 | +// select t_user_2.user_id::text from t_user_2 | ||
286 | +// union | ||
287 | +// select t_user_3.user_id::text from t_user_3 | ||
288 | +// ), | ||
289 | +// -- 根据用户提取评估列表 | ||
290 | +// t_staff_assess as( | ||
291 | +// select staff_assess.id as assess_id, | ||
292 | +// staff_assess.target_user->>'userId' as user_id, | ||
293 | +// staff_assess.target_user->>'userName' as user_name | ||
294 | +// from staff_assess | ||
295 | +// join t_user_all on staff_assess.target_user->>'userId'= t_user_all.user_id | ||
296 | +// where staff_assess.cycle_id = 1592787960795762688 | ||
297 | +// and to_char(staff_assess.begin_time,'YYYY-MM-DD')='2022-11-24' | ||
298 | +// and staff_assess."types" ='self' | ||
299 | +// limit 1 offset 0 | ||
300 | +// ) |
-
请 注册 或 登录 后发表评论