
if not exists (select 1 from ksql_usertables where ksql_tabname = 't_bdm_issue_biz_type')
 create table t_bdm_issue_biz_type (
fid bigint default 0 not null,
fnumber varchar(30) default ' ' not null,
fname varchar(50) default ' ' not null,
fstatus varchar(30) default ' ' not null,
fcreatorid bigint default 0 not null,
fmodifierid bigint default 0 not null,
fenable varchar(30) default ' ' not null,
fcreatetime datetime,
fmodifytime datetime,
fmasterid bigint default 0 not null,
finvoicelimit       decimal(23,10) default 0 not null,
fdelaytime          int default 0 not null,
fissuetimeallenable char(1) default ' ' not null,
ftaxcodeenable      char(1) default ' ' not null
);

if not exists (select 1 from ksql_usertables where ksql_tabname = 't_bdm_issue_biz_type_code')
 create table t_bdm_issue_biz_type_code (
fid bigint default 0 not null,
fentryid bigint default 0 not null,
fseq        int default 0 not null,
ftaxcodeid  bigint default 0 not null,
fsimplename varchar(50) default ' ' not null,
ftaxcode    varchar(50) default ' ' not null
);

if not exists (select 1 from ksql_usertables where ksql_tabname = 't_bdm_issue_biz_type_item')
create table t_bdm_issue_biz_type_item (
fid bigint default 0 not null,
fentryid bigint default 0 not null,
fseq        int default 0 not null,
fstarttime        int default 0 not null,
fendtime        int default 0 not null
);


if not exists (select 1 from ksql_usertables where ksql_tabname = 't_bdm_issue_biz_type_l')
create table t_bdm_issue_biz_type_l (
fid bigint default 0 not null,
fpkid varchar(50) default ' ' not null,
flocaleid varchar(50) default ' ' not null,
fname varchar(50) default ' ' not null
);

if not exists (select 1 from ksql_usertables where ksql_tabname = 't_bdm_issue_biz_type_r3')
create table t_bdm_issue_biz_type_r3 (
fid bigint default 0 not null,
frefstatus char(1) default ' ' not null
);


if not exists (select 1 from ksql_usertables where ksql_tabname = 't_bdm_issue_policy_log')
create table t_bdm_issue_policy_log (
fid bigint default 0 not null,
fbizcontroltype bigint default 0 not null,
fcreatetime datetime,
fuseamount       decimal(23,10) default 0 not null,
finvoiceid bigint default 0 not null
);

if not exists (select 1 from ksql_usertables where ksql_tabname = 't_bdm_channel_policy')
 create table t_bdm_channel_policy (
fid bigint default 0 not null,
fnumber varchar(30) default ' ' not null,
fname varchar(50) default ' ' not null,
fstatus varchar(30) default ' ' not null,
fcreatorid bigint default 0 not null,
fmodifierid bigint default 0 not null,
fenable varchar(30) default ' ' not null,
fcreatetime datetime,
fmodifytime datetime,
fmasterid bigint default 0 not null
);

if not exists (select 1 from ksql_usertables where ksql_tabname = 't_bdm_channel_polic_item')
create table t_bdm_channel_polic_item (
fid bigint default 0 not null,
fentryid bigint default 0 not null,
fseq        int default 0 not null,
fpriority   varchar(50) default ' ' not null,
frulenumber   varchar(50) default ' ' not null,
frulemark   varchar(50) default ' ' not null,
frulename   varchar(50) default ' ' not null
);


if not exists (select 1 from ksql_usertables where ksql_tabname = 't_bdm_channel_policy_l')
create table t_bdm_channel_policy_l (
fid bigint default 0 not null,
fpkid varchar(50) default ' ' not null,
flocaleid varchar(50) default ' ' not null,
fname varchar(50) default ' ' not null
);

if not exists (select 1 from ksql_usertables where ksql_tabname = 't_bdm_channel_policy_r3')
create table t_bdm_channel_policy_r3 (
fid bigint default 0 not null,
frefstatus char(1) default ' ' not null
);


if not exists (select 1 from ksql_usertables where ksql_tabname = 't_bdm_biz_control')
 create table t_bdm_biz_control (
fid bigint default 0 not null,
fnumber varchar(30) default ' ' not null,
fname varchar(50) default ' ' not null,
fstatus varchar(30) default ' ' not null,
fcreatorid bigint default 0 not null,
fmodifierid bigint default 0 not null,
fenable varchar(30) default ' ' not null,
fcreatetime datetime,
fmodifytime datetime,
fmasterid bigint default 0 not null,
fchannelenable char(1) default ' ' not null,
fchannelpolicy bigint default 0 not null,
fmonthlimit    decimal(15, 2),
fwarninglimit  decimal(15, 2),
fdaylimt       decimal(15, 2),
fissuebiztype  bigint default 0 not null,
forg           bigint default 0 not null,
fuseorg        bigint default 0 not null
);

if not exists (select 1 from ksql_usertables where ksql_tabname = 't_bdm_biz_control_channel')
create table t_bdm_biz_control_channel (
fid bigint default 0 not null,
fentryid bigint default 0 not null,
fseq        int default 0 not null,
fchanneltype   varchar(30) default ' ' not null,
faccount   varchar(50) default ' ' not null,
fdrawer   varchar(50) default ' ' not null,
fdevno   varchar(50) default ' ' not null
);

if not exists (select 1 from ksql_usertables where ksql_tabname = 't_bdm_biz_control_l')
create table t_bdm_biz_control_l (
fid bigint default 0 not null,
fpkid varchar(50) default ' ' not null,
flocaleid varchar(50) default ' ' not null,
fname varchar(50) default ' ' not null
);

if not exists (select 1 from ksql_usertables where ksql_tabname = 't_bdm_biz_control_r3')
create table t_bdm_biz_control_r3 (
fid bigint default 0 not null,
frefstatus char(1) default ' ' not null
);