--员工禁用账号没禁用
SELECT t.fname_l2
FROM t_pm_user t
INNER JOIN t_bd_person t1 ON t1.fid = t.fpersonid
AND t1.fdeletedstatus = 2
WHERE t.fforbidden = 0;
--员工禁用后,禁用账号
UPDATE t_pm_user c
SET c.fforbidden = 1
WHERE c.fid IN (SELECT t.fid
FROM t_pm_user t
INNER JOIN t_bd_person t1 ON t1.fid = t.fpersonid
AND t1.fdeletedstatus = 2
WHERE t.fforbidden = 0);
--账号禁用员工没禁用(一个员工可能对应多个账号)
SELECT t.fname_l2,
t.fid
FROM t_pm_user t
INNER JOIN t_bd_person t1 ON t1.fid = t.fpersonid
AND t1.fdeletedstatus = 1
WHERE t.fforbidden = 1;
-- 账号禁用后,禁用员工
UPDATE t_bd_person c
SET c.fdeletedstatus = 2
WHERE c.fid IN (SELECT t.fpersonid
FROM t_pm_user t
INNER JOIN t_bd_person t1 ON t1.fid = t.fpersonid
AND t1.fdeletedstatus = 1
WHERE t.fforbidden = 1);
公司员工离职后需要禁用账号和员工,但是因之前一直没有相对的管理,所以比较混乱,就帮同事写了以上SQL,用于在金蝶EAS 7.5 下禁用相关员工及账号信息.
来源:oschina
链接:https://my.oschina.net/u/67403/blog/207911