|
--查询组织选择部件选中的人员ID信息
select distinct t.index_id as ID ,L.user_id from
sa_selected_user_item t,
SA_DEPT_DICT d ,
(select l1.user_id,l1.dept_id,l2.tree_code from SA_STAFF_ROLE l1,SA_DEPT_DICT l2 where l1.dept_id=l2.dept_id) L
where t.item_id=d.dept_id and t.item_type in(0,1,2,3,6)
and L.tree_code like d.tree_code||'%'
--上面是找到机构、部门、岗位(特权、领导、普通)中的人员
union
select index_id as ID ,item_id from sa_selected_user_item where item_type=5
--上面是人员ID,直接找到人员ID
union
select s.index_id as ID ,g.user_id from sa_selected_user_item s ,SA_USER_OF_GROUP g where s.item_id=g.group_id and item_type=4
--设置的是工作组,找到工作组中的人员ID
;
|
|