IF NOT EXISTS (SELECT 1 FROM sys.objects WHERE object_id = OBJECT_ID('[dbo].[mps_login_role]') AND type = 'U')
CREATE TABLE [dbo].[mps_login_role]
(
    [lgu_id] int NOT NULL IDENTITY(1, 1),
    [lgu_cuid] int NULL DEFAULT((0)),
    [lgu_name] nvarchar(50) COLLATE Chinese_PRC_CI_AS NULL DEFAULT(''),
    [lgu_bcid] int NULL DEFAULT((0)),
    [lgu_branch] nvarchar(200) COLLATE Chinese_PRC_CI_AS NULL DEFAULT(''),
    [lgu_dpid] int NULL DEFAULT((0)),
    [lgu_depart] nvarchar(50) COLLATE Chinese_PRC_CI_AS NULL DEFAULT(''),
    [lgu_otid] int NULL DEFAULT((0)),
    [lgu_title] nvarchar(50) COLLATE Chinese_PRC_CI_AS NULL DEFAULT(''),
    [lgu_function] int NULL DEFAULT((0)),
    [lgu_managelevel] int NULL DEFAULT((0)),
    [lgu_professionlevel] int NULL DEFAULT((0)),
    [lgu_otlevel] int NULL DEFAULT((0)),
    [lgu_defaultrole] int NOT NULL DEFAULT((1)),
    [lgu_dingdpid] int NULL,
    [lgu_ccid] bigint NULL DEFAULT((0)),
    [lgu_type] bigint NULL DEFAULT((0)),
    [lgu_loginscope] varchar(150) COLLATE Chinese_PRC_CI_AS NULL DEFAULT(''),
    CONSTRAINT [PK_MPS_LOGIN_ROLE] PRIMARY KEY ([lgu_id] ASC)
)


IF NOT EXISTS (SELECT 1 FROM sys.indexes WHERE object_id = OBJECT_ID('[dbo].[mps_login_role]') AND name = 'mps_login_role_index')
CREATE NONCLUSTERED INDEX [mps_login_role_index] ON [dbo].[mps_login_role]([lgu_cuid] ASC)