/* 预置职能类型 */
DELETE FROM t_org_bizlist WHERE FID = 40;
INSERT INTO t_org_bizlist(FID,FISENABLED,FDISABLEDATE,FMASTERID,FSTATUS,FUSERDEFINE,FVISIABLE,FNAME,FNUMBER,FPROPERTYNAME,FCREATETIME,FENABLE,FMODIFIERID,FMODIFYTIME,FISBASETYPE,FCATEGORY,FFIELDNAME,FCREATORID,FDISABLERID) VALUES (40,'1',NULL,40,'C','0','1','税务组织','40','fistax',{ts'2018-08-08  18:08:08'},'1',1,{ts'2018-08-08  18:08:08'},'1','1','fistax',1,0);

DELETE FROM t_org_bizlist_l WHERE FPKID = '1VKAP5+GZGDT';
INSERT INTO t_org_bizlist_l(FID,FPKID,FLOCALEID,FNAME) VALUES (40,'1VKAP5+GZGDT','zh_CN','税务组织');

DELETE FROM t_org_viewschema WHERE FID = 40;
INSERT INTO t_org_viewschema(FID,FSTARTDATE,FCHECKDATE,FISDEFAULT,FMASTERID,FSTATUS,FNUMBER,FNAME,FCREATETIME,FTREETYPE,FENABLE,FMODIFIERID,FTREETYPEID,FMODIFYTIME,FENDDATE,FUSAGE,FCHECKERID,FCREATORID) VALUES (40,{ts'2018-08-08  18:08:08'},NULL,'1',40,'C','40','税务组织',{ts'2018-08-08  18:08:08'},'40','1',1,40,{ts'2018-08-08  18:08:08'},{ts'2999-12-31  00:00:00'},' ',0,1);

DELETE FROM t_org_viewschema_l WHERE FPKID = '1VKAP5057YW0';
INSERT INTO t_org_viewschema_l(FID,FPKID,FLOCALEID,FCOMMENT,FNAME) VALUES (40,'1VKAP5057YW0','zh_CN',' ','税务业务视图默认方案');

DELETE from t_org_structure WHERE forgid = 100000 and fviewid in (40);
DELETE from t_org_structure_l t WHERE not exists (SELECT FID from t_org_structure s where s.fid = t.fid);

DELETE FROM t_org_structure WHERE FID = 1234075514780531712;
INSERT INTO t_org_structure(FSEALUPTIME,FCREATEORGID,FISHR,FYZJORGID,FMASTERID,FCREATETIME,FENABLE,FVIEWID,FLEVEL,FLONGNUMBER,FFULLNAME,FID,FSORTCODE,FMODIFYORGID,FSTARTDATE,FISBIZUNIT,FYZJPARENTORGID,FORGID,FSTATUS,FPARENTID,FNUMBER,FISFREEZE,FMODIFIERID,FISLEAF,FISSTATSUM,FISCTRLUNIT,FMODIFYTIME,FENDDATE,FCREATORID) VALUES (NULL,0,'0',' ',1234075514780531712,{ts'2018-08-08  18:08:08'},'1',40,1,' ',' ',1234075514780531712,'0',0,{ts'2018-08-08  18:08:08'},'1',' ',100000,'C',0,' ','0',1,'1','0','1',{ts'2018-08-08  18:08:08'},{ts'2999-12-31  00:00:00'},1);

DELETE FROM t_org_structure_l WHERE FPKID = '1VKAP52=MH=U';
INSERT INTO t_org_structure_l(FID,FPKID,FLOCALEID,FFULLNAME,FNAME) VALUES (1234075514780531712,'1VKAP52=MH=U','zh_CN',' ',' ');


/** 更新根组织长编码、长名称 */
update T_ORG_STRUCTURE set flongnumber = isnull(select max(fnumber) from t_org_org where fid = 100000, ' ') where forgid = 100000 and fviewid = 40;
update T_ORG_STRUCTURE set ffullname = isnull(select max(fname) from t_org_org_l ol where flocaleid = 'zh_CN' and fid = 100000, ' ') where forgid = 100000 and fviewid = 40;
update T_ORG_STRUCTURE_L set ffullname = isnull(select max(fname) from t_org_org_l ol where T_ORG_STRUCTURE_L.flocaleid = ol.flocaleid and fid = 100000, ' ') where fid in (select fid from t_org_structure where forgid = 100000 and  fviewid = 40);

/** 组织表勾选相应职能类型 */
update t_org_org set fistax = '1' where fid = 100000;

