-- 预置京东电商授权

-- 如果之前存在京东的电商授权，让它的状态改为运行中
UPDATE t_mal_ecadmit set FOPENSTATUS = '2' WHERE (FNUMBER = 'JD' or FPLATFORM = '2') and (FOPENSTATUS ='' or FOPENSTATUS =' ');

-- 如果不存在京东的电商授权，则新建一个运行中的电商授权
IF NOT EXISTS (SELECT 1 FROM t_mal_ecadmit WHERE FNUMBER = 'JD' or FPLATFORM = '2') 
INSERT INTO t_mal_ecadmit(FID,FPLATFORM,FMASTERID,FNUMBER,FOPENSTATUS,FENABLE) VALUES (988174405500718081,'2',988174405500718081,'JD','1','1'); 

DELETE FROM t_mal_ecadmit_l WHERE FPKID = '12C84+1FDCK1';
INSERT INTO t_mal_ecadmit_l(FID,FPKID,FLOCALEID,FREMARK,FNAME) VALUES (988174405500718081,'12C84+1FDCK1','zh_CN',' ','京东商城'); 
DELETE FROM t_mal_ecadmit_l WHERE FPKID = '12C84+1FDCK2';
INSERT INTO t_mal_ecadmit_l(FID,FPKID,FLOCALEID,FREMARK,FNAME) VALUES (988174405500718081,'12C84+1FDCK2','zh_TW',' ','京東商城'); 




-- 预置苏宁电商授权
IF NOT EXISTS (SELECT 1 FROM t_mal_ecadmit WHERE FNUMBER = 'SN' or FPLATFORM = '3')
INSERT INTO t_mal_ecadmit(FID,FPLATFORM,FMASTERID,FNUMBER,FOPENSTATUS,FENABLE) VALUES (988174405500718082,'3',988174405500718082,'SN','1','1'); 

DELETE FROM t_mal_ecadmit_l WHERE FPKID = '173TT87ZDB5U';
INSERT INTO t_mal_ecadmit_l(FID,FPKID,FLOCALEID,FREMARK,FNAME) VALUES (988174405500718082,'173TT87ZDB5U','zh_CN',' ','苏宁'); 
DELETE FROM t_mal_ecadmit_l WHERE FPKID = '173TT87ZDB5V';
INSERT INTO t_mal_ecadmit_l(FID,FPKID,FLOCALEID,FREMARK,FNAME) VALUES (988174405500718082,'173TT87ZDB5V','zh_TW',' ','蘇寧'); 
