|
--他表选择获取人员换岗前的岗位ID和人员ID值
SELECT b.ID 人员编号,
b.USER_NAME 姓名,
d.dept_name 部门,
d.dept_name || ' {' || c.dept_name || '}' 部门岗位,
d.dept_id 部门编号,
c.dept_id 岗位编号,
b.INP_CODE 输入码
FROM sa_staff_info b
LEFT JOIN SA_STAFF_ROLE a
ON a.user_id = b.ID
LEFT JOIN SA_DEPT_DICT c
ON c.dept_id = a.dept_id
LEFT JOIN SA_DEPT_DICT d
ON c.upper_id = d.dept_id
order by d.dept_name, c.dept_name, b.user_name;
--他表选择获取将要调换的岗位ID,注数据展现样式应为树型
SELECT DEPT_ID, DEPT_NAME 部门名称, UPPER_ID, SORT_ORDER FROM SA_DEPT_DICT;
--根据user_id(人员编号)\dept_id(岗位编号)确定修改数据
update SA_STAFF_ROLE set dept_id = '2614' where user_id = '21978' and dept_id = '2256';
|
|