修复t_org_structure表数据
问题描述:
现场的组织数据,可能是集成平台集成的,但是集成方案有缺漏;又或者是现场通过二开导入的,但是二开的方法存在bug,导致t_org_structure表的长编码长名称存在脏数据,进而导致组织单元保存报错。
以下是修复方案:
--备份数据
SELECT * into t_org_structure0510 FROM t_org_structure
--查验数据
SELECT * FROM t_org_structure where FTREEID = 'hK8AAAAE99xPKCf9'order by flevel
SELECT * FROM t_org_structure0510 where FTREEID = 'hK8AAAAE99xPKCf9' order by flevel
--修复长编码
UPDATE t_org_structure s SET flongnumber = concat(concat((SELECT s1.flongnumber FROM t_org_structure s1 where s.fparentid = s1.fid),'!'),(SELECT b.fnumber FROM t_org_baseunit b where s.funitid = b.fid))
WHERE exists (SELECT 1 FROM t_org_baseunit b where s.funitid = b.fid)
and exists (SELECT 1 FROM t_org_structure s1 where s.fparentid = s1.fid)
and s.FTREEID = 'hK8AAAAE99xPKCf9' and s.flevel = '4'
--修复长名称
UPDATE t_org_structure s SET fdisplayname_l2 = concat(concat((SELECT s1.fdisplayname_l2 FROM t_org_structure s1 where s.fparentid = s1.fid),'_'),(SELECT b.fname_l2 FROM t_org_baseunit b where s.funitid = b.fid))
WHERE exists (SELECT 1 FROM t_org_baseunit b where s.funitid = b.fid)
and exists (SELECT 1 FROM t_org_structure s1 where s.fparentid = s1.fid)
and s.FTREEID = 'hK8AAAAE99xPKCf9' and s.flevel = '4'
备注:上述指定的FTREEID和flevel仅是参考。ftreeid要根据此次打算修复何种组织视图的组织架构数据来决定(可查询t_org_tree)。flevel是组织的级次,由于是根据上级组织的id来修复,故建议从2级,3级,4级,逐级修复。
修复t_org_structure表数据
本文2024-09-22 20:01:44发表“eas cloud知识”栏目。
本文链接:https://wenku.my7c.com/article/kingdee-eas-110987.html