/* 更新组织表是否业务单元的标志，删除多余的组织视图数据  */
update t_org_org set fisbizorg = '0';
update t_org_org o set fisbizorg = '1' where EXISTS (SELECT 1 from t_org_structure where o.FID = FORGID AND fviewid not in (select fid from t_org_viewschema where ftreetype='01'));

/* 更新是否叶子节点 */
UPDATE t_org_structure P  SET fisleaf = 1;
UPDATE t_org_structure P  SET fisleaf = 0 WHERE EXISTS (SELECT fparentid FROM (SELECT c.fparentid, c.FVIEWID FROM t_org_structure AS c) AS t WHERE (t.fviewid = p.fviewid AND p.forgid = t.fparentid));

/* 当仅有一个根组织时，不标记统计汇总，当添加下级组织时，将上级组织勾选统计汇总标识，依次类推。  */
update t_org_structure set fisstatsum = '1' where fisleaf = '0';
update t_org_structure set fisstatsum = '0' where fisleaf = '1';