USE [$DBName$]

CREATE TABLE [dbo].[Session](
	[id] [char](36) NOT NULL,
	[v] [varchar](30) NULL,
	[createdate] [smalldatetime] NULL,
	[status] [tinyint] NULL,
	[t] [smallint] NULL,
 CONSTRAINT [PK_Session] PRIMARY KEY CLUSTERED 
(
	[id] ASC
)WITH (PAD_INDEX  = OFF, STATISTICS_NORECOMPUTE  = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS  = ON, ALLOW_PAGE_LOCKS  = ON) ON [PRIMARY]
) ON [PRIMARY]

CREATE TABLE [dbo].[template](
	[id] [int] IDENTITY(1,1) NOT NULL,
	[title] [nvarchar](50) NULL,
	[fieldcontent] [ntext] NULL,
	[uid] [varchar](50) NULL,
	[isdefault] [smallint] NULL,
	[totalColumn] [smallint] NULL
) ON [PRIMARY] TEXTIMAGE_ON [PRIMARY]

CREATE TABLE [dbo].[stattable](
	[statfield] [varchar](50) NULL,
	[statnum] [int] NULL,
	[stattable] [varchar](50) NULL,
	[statmemo] [varchar](200) NULL,
	[uid] [varchar](50) NULL
) ON [PRIMARY]

CREATE TABLE [dbo].[SalaryDetailTable](
	[f1] [varchar](50) NULL,
	[f2] [varchar](50) NULL,
	[f3] [varchar](50) NULL,
	[f4] [varchar](50) NULL,
	[f5] [varchar](50) NULL,
	[f6] [varchar](50) NULL,
	[f7] [varchar](50) NULL,
	[f8] [varchar](50) NULL,
	[f9] [varchar](50) NULL,
	[f10] [varchar](50) NULL,
	[f11] [varchar](50) NULL,
	[f12] [varchar](50) NULL,
	[f13] [varchar](50) NULL,
	[f14] [varchar](50) NULL,
	[f15] [varchar](50) NULL,
	[f16] [varchar](50) NULL,
	[f17] [varchar](50) NULL,
	[f18] [varchar](50) NULL,
	[f19] [varchar](50) NULL,
	[f20] [varchar](50) NULL,
	[f21] [varchar](50) NULL,
	[f22] [varchar](50) NULL,
	[f23] [varchar](50) NULL,
	[f24] [varchar](50) NULL,
	[f25] [varchar](50) NULL,
	[f26] [varchar](50) NULL,
	[f27] [varchar](50) NULL,
	[f28] [varchar](50) NULL,
	[f29] [varchar](50) NULL,
	[f30] [varchar](50) NULL,
	[f31] [varchar](50) NULL,
	[f32] [varchar](50) NULL,
	[f33] [varchar](50) NULL,
	[f34] [varchar](50) NULL,
	[f35] [varchar](50) NULL,
	[f36] [varchar](50) NULL,
	[f37] [varchar](50) NULL,
	[f38] [varchar](50) NULL,
	[f39] [varchar](50) NULL,
	[f40] [varchar](50) NULL,
	[f41] [varchar](50) NULL,
	[f42] [varchar](50) NULL,
	[f43] [varchar](50) NULL,
	[f44] [varchar](50) NULL,
	[f45] [varchar](50) NULL,
	[f46] [varchar](50) NULL,
	[f47] [varchar](50) NULL,
	[f48] [varchar](50) NULL,
	[f49] [varchar](50) NULL,
	[f50] [varchar](50) NULL,
	[id] [int] IDENTITY(1,1) NOT NULL,
	[tableid] [int] NULL,
	[viewed] [smallint] NULL CONSTRAINT [DF_SalaryDetailTable_viewed]  DEFAULT ((0)),
	[year] [smallint] NULL,
	[month] [smallint] NULL,
	[totalsalary] [varchar](50) NULL,
	[audit] [tinyint] NULL CONSTRAINT [DF_SalaryDetailTable_audit]  DEFAULT ((0)),
	[userclear] [tinyint] NULL CONSTRAINT [DF_SalaryDetailTable_userclear]  DEFAULT ((0)),
 CONSTRAINT [PK_SalaryDetailTable] PRIMARY KEY NONCLUSTERED 
(
	[id] ASC
)WITH (PAD_INDEX  = OFF, STATISTICS_NORECOMPUTE  = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS  = ON, ALLOW_PAGE_LOCKS  = ON) ON [PRIMARY]
) ON [PRIMARY]

CREATE TABLE [dbo].[ut](
	[uid] [int] IDENTITY(1,1) NOT NULL,
	[un] [varchar](50) NULL,
	[pwd] [varchar](50) NULL,
	[openid] [varchar](50) NOT NULL,
	[accounttype] [smallint] NULL,
	[status] [smallint] NULL,
	[active] [smallint] NULL,
	[createdate] [smalldatetime] NULL,
	[mob] [varchar](50) NULL,
	[ico] [varchar](200) NULL,
	[nickname] [nvarchar](50) NULL,
	[binduser] [varchar](50) NULL,
	[bindtouser] [varchar](50) NULL,
	[loginnum] [int] NULL,
	[lastlogin] [smalldatetime] NULL,
	[userlevel] [smallint] NULL,
	[msg] [nvarchar](50) NULL,
	[unitsid] [int] NULL,
	[unitsidstr] [varchar](50) NULL,
	[recommend] [varchar](50) NULL,
	[gender] [tinyint] NULL,
	[city] [nvarchar](20) NULL,
	[age] [smallint] NULL,
	[province] [nvarchar](50) NULL,
	[area] [nvarchar](50) NULL,
	[UNIONID] [varchar](50) NULL,
	[openid_wx] [varchar](50) NULL,
	[source] [varchar](10) NULL,
	[expiredate] [smalldatetime] NULL,
	[ad_show] [smallint] NULL,
	[ad_expiredate] [smalldatetime] NULL,
	[modifypwd] [smallint] NULL CONSTRAINT [DF_ut_modifypwd]  DEFAULT ((1)),
 CONSTRAINT [PK_ut] PRIMARY KEY CLUSTERED 
(
	[openid] ASC
)WITH (PAD_INDEX  = OFF, STATISTICS_NORECOMPUTE  = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS  = ON, ALLOW_PAGE_LOCKS  = ON) ON [PRIMARY]
) ON [PRIMARY]

CREATE TABLE [dbo].[SalaryTable](
	[id] [int] IDENTITY(1,1) NOT NULL,
	[uid] [varchar](50) NULL,
	[year] [smallint] NULL,
	[month] [smallint] NULL,
	[createdate] [smalldatetime] NULL,
	[status] [smallint] NULL CONSTRAINT [DF_SalaryTable_status]  DEFAULT ((1)),
	[issuedate] [smalldatetime] NULL,
	[tablehead] [ntext] NULL,
	[unitsid] [int] NULL,
	[datastartrow] [smallint] NULL,
	[mobcolumnindex] [tinyint] NULL,
	[rownum] [smallint] NULL,
	[colnum] [int] NULL,
	[totalColumn] [int] NULL,
	[dataendrow] [smallint] NULL,
	[headrow] [smallint] NULL,
	[datanum] [smallint] NULL,
	[title] [nvarchar](50) NULL,
	[datasource] [varchar](50) NULL,
 CONSTRAINT [PK_SalaryTable] PRIMARY KEY CLUSTERED 
(
	[id] ASC
)WITH (PAD_INDEX  = OFF, STATISTICS_NORECOMPUTE  = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS  = ON, ALLOW_PAGE_LOCKS  = ON) ON [PRIMARY]
) ON [PRIMARY] TEXTIMAGE_ON [PRIMARY]

CREATE TABLE [dbo].[img](
	[id] [int] IDENTITY(1,1) NOT NULL,
	[un] [varchar](50) NULL,
	[imgname] [varchar](50) NULL,
	[createdate] [smalldatetime] NULL,
	[num] [int] NULL CONSTRAINT [DF_img_num]  DEFAULT ((0)),
	[dealed] [smallint] NULL CONSTRAINT [DF_img_dealed]  DEFAULT ((0)),
	[name] [nvarchar](50) NULL,
	[total_fee] [int] NULL,
	[openid] [varchar](50) NULL,
 CONSTRAINT [PK_img] PRIMARY KEY CLUSTERED 
(
	[id] ASC
)WITH (PAD_INDEX  = OFF, STATISTICS_NORECOMPUTE  = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS  = ON, ALLOW_PAGE_LOCKS  = ON) ON [PRIMARY]
) ON [PRIMARY]

CREATE TABLE [dbo].[units](
	[id] [int] IDENTITY(1,1) NOT NULL,
	[unitsname] [nvarchar](50) NULL,
	[un] [varchar](50) NULL,
	[status] [smallint] NULL CONSTRAINT [DF_units_status]  DEFAULT ((0)),
	[createdate] [smalldatetime] NULL,
	[tel] [varchar](20) NULL,
	[homepage] [varchar](50) NULL,
	[code] [varchar](20) NULL,
	[email] [varchar](40) NULL,
	[type] [nvarchar](50) NULL,
	[audit] [tinyint] NULL CONSTRAINT [DF_units_audit]  DEFAULT ((0)),
	[codefile] [varchar](50) NULL,
	[authfile] [varchar](50) NULL,
	[msg] [nvarchar](100) NULL,
	[qrcodefile] [varchar](50) NULL,
	[topbgfile] [varchar](50) NULL,
	[logofile] [varchar](50) NULL,
	[mainbgfile] [varchar](50) NULL,
	[showtitle] [varchar](50) NULL,
	[mobstr] [varchar](50) NULL,
	[filled] [tinyint] NULL CONSTRAINT [DF_units_filled]  DEFAULT ((0)),
	[dataapiurl] [varchar](200) NULL,
	[securitykey] [varchar](50) NULL,
	[useremotedata] [tinyint] NULL,
	[dataurl] [varchar](50) NULL,
	[memo] [nvarchar](50) NULL,
 CONSTRAINT [PK_units] PRIMARY KEY CLUSTERED 
(
	[id] ASC
)WITH (PAD_INDEX  = OFF, STATISTICS_NORECOMPUTE  = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS  = ON, ALLOW_PAGE_LOCKS  = ON) ON [PRIMARY]
) ON [PRIMARY]


CREATE TABLE [dbo].[recommend](
	[openid] [varchar](50) NOT NULL,
	[totalnum] [int] NULL CONSTRAINT [DF_recommend_totalnum]  DEFAULT ((0)),
	[monthnum] [int] NULL CONSTRAINT [DF_recommend_monthnum]  DEFAULT ((0)),
	[id] [int] IDENTITY(1,1) NOT NULL,
 CONSTRAINT [PK_recommend] PRIMARY KEY CLUSTERED 
(
	[openid] ASC
)WITH (PAD_INDEX  = OFF, STATISTICS_NORECOMPUTE  = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS  = ON, ALLOW_PAGE_LOCKS  = ON) ON [PRIMARY]
) ON [PRIMARY]


CREATE TABLE [dbo].[recommend_ut](
	[openid] [varchar](50) NOT NULL,
	[recommend] [varchar](50) NULL,
	[createdate] [smalldatetime] NULL,
	[status] [smallint] NULL,
	[month] [smallint] NULL,
	[year] [smallint] NULL,
 CONSTRAINT [PK_recommend_ut] PRIMARY KEY CLUSTERED 
(
	[openid] ASC
)WITH (PAD_INDEX  = OFF, STATISTICS_NORECOMPUTE  = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS  = ON, ALLOW_PAGE_LOCKS  = ON) ON [PRIMARY]
) ON [PRIMARY]


CREATE TABLE [dbo].[memo](
	[id] [varchar](32) NOT NULL,
	[openid] [varchar](30) NULL,
	[memo] [ntext] NULL,
	[createdate] [smalldatetime] NULL,
	[month] [smallint] NULL,
	[year] [smallint] NULL,
 CONSTRAINT [PK_memo] PRIMARY KEY CLUSTERED 
(
	[id] ASC
)WITH (PAD_INDEX  = OFF, STATISTICS_NORECOMPUTE  = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS  = ON, ALLOW_PAGE_LOCKS  = ON) ON [PRIMARY]
) ON [PRIMARY] TEXTIMAGE_ON [PRIMARY]


CREATE TABLE [dbo].[SysConfig](
	[id] [varchar](50) NOT NULL,
	[name] [nvarchar](50) NULL,
	[config] [nvarchar](50) NULL,
 CONSTRAINT [PK_SysConfig] PRIMARY KEY CLUSTERED 
(
	[id] ASC
)WITH (PAD_INDEX  = OFF, STATISTICS_NORECOMPUTE  = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS  = ON, ALLOW_PAGE_LOCKS  = ON) ON [PRIMARY]
) ON [PRIMARY]

CREATE TABLE [dbo].[msg](
	[id] [int] IDENTITY(1,1) NOT NULL,
	[uid_send] [varchar](50) NULL,
	[uid_receive] [varchar](50) NULL,
	[status] [nchar](10) NULL CONSTRAINT [DF_msg_status]  DEFAULT ((0)),
	[createdate] [smalldatetime] NULL,
	[title] [nvarchar](50) NULL,
	[memo] [ntext] NULL,
	[targetid] [int] NULL
) ON [PRIMARY] TEXTIMAGE_ON [PRIMARY]
