use ZSAsscess
/***建表***/

/***权限表***/
if exists(select * from sysobjects where name='Authority')
begin
  drop table Authority
end
create table Authority
(
  AuID nvarchar(50) primary key not null,
  AuName nvarchar(100) not null,  
  Remark nvarchar(50),
  AuTag nvarchar(20)
)

go

insert into Authority(AuID,AuName,Remark,AuTag)
values('594BC28B-A514-4AC0-B56B-AA07F2EA4DFB','系统管理','系统管理','Manage')
insert into Authority(AuID,AuName,Remark,AuTag)
values('570BB151-4234-42F4-9E1C-F65B58737F99','设备管理','设备管理','Device')
insert into Authority(AuID,AuName,Remark,AuTag)
values('460B9EE4-8ED5-4FB3-AA3A-7586FB9602E2','人员管理','人员管理','Person')
insert into Authority(AuID,AuName,Remark,AuTag)
values('023BBC7F-8DC0-42EF-8D6B-0295CB456902','门禁管理','门禁管理','Gate')
insert into Authority(AuID,AuName,Remark,AuTag)
values('9F64F151-26E3-4930-AAD6-866CE5F918B1','实时监控','实时监控','Surveil')
insert into Authority(AuID,AuName,Remark,AuTag)
values('17356ED8-9D7B-45F8-81D6-DDF4CF1A5213','报表','报表','Report')
insert into Authority(AuID,AuName,Remark,AuTag)
values('0CE948F7-3C51-4900-A584-77AA970CA39C','部门管理','部门管理','Dept')
insert into Authority(AuID,AuName,Remark,AuTag)
values('E98DC2D2-0DA2-4573-94FA-05A0C5FECE0E','考勤设置','考勤设置','Attendance')
insert into Authority(AuID,AuName,Remark,AuTag)
values('153B05F2-3DCA-452D-8C17-5AF165055A32','考勤班次','考勤班次','Service')
insert into Authority(AuID,AuName,Remark,AuTag)
values('F9DAD706-3B67-4C32-B05E-A9F2D9B4BCB3','人员排班','人员排班','Sched')
insert into Authority(AuID,AuName,Remark,AuTag)
values('E43B8E12-6D63-4B31-A705-5AE750872CB6','节假日设置','节假日设置','Holiday')
insert into Authority(AuID,AuName,Remark,AuTag)
values('155C8BFF-8477-414B-AB91-45E6EBDEA145','公休/请假/出差','公休/请假/出差','Leave')
insert into Authority(AuID,AuName,Remark,AuTag)
values('3DFEAF12-5638-4185-A884-733C0694C26C','补签记录','补签记录','Retroactive')
insert into Authority(AuID,AuName,Remark,AuTag)
values('18921CFA-DAC4-4F7E-9533-7631F8681CDB','考勤报表','考勤报表','AttReport')

go

/***角色表***/
if exists(select * from sysobjects where name='RoleInfo')
begin
  drop table RoleInfo
end
create table RoleInfo
(
  RoleID nvarchar(50) primary key not null,
  RoleName nvarchar(20) not null, 
  Remark nvarchar(50),
  RoleLevel int 
)

go
insert into RoleInfo(RoleID,RoleName,Remark,RoleLevel)
values('8A15BD39-03F3-4A79-BF36-EB700A936390','系统管理员','系统管理员',1)

go


/***角色权限表***/
if exists(select * from sysobjects where name='RoleAutInfo')
begin
 drop table RoleAutInfo
end
create table RoleAutInfo
(
  RoleAutID nvarchar(50) primary key not null,
  RoleID nvarchar(50) not null,
  AuID nvarchar(50) not null,
  SeeRes bit ,
  ControlRes bit,
  AuTag nvarchar(20)
)

go

insert into RoleAutInfo(RoleAutID,RoleID,AuID,SeeRes,ControlRes,AuTag)
values('AD65D639-7BE1-4FAF-8D8C-C0D40659A83C','8A15BD39-03F3-4A79-BF36-EB700A936390','594BC28B-A514-4AC0-B56B-AA07F2EA4DFB',1,1,'Manage')
insert into RoleAutInfo(RoleAutID,RoleID,AuID,SeeRes,ControlRes,AuTag)
values('39CCADFA-93F9-43A2-AB07-68BADDE28621','8A15BD39-03F3-4A79-BF36-EB700A936390','570BB151-4234-42F4-9E1C-F65B58737F99',1,1,'Device')
insert into RoleAutInfo(RoleAutID,RoleID,AuID,SeeRes,ControlRes,AuTag)
values('FCD13AF3-E0D2-4AEC-A3B6-619D38B5BD56','8A15BD39-03F3-4A79-BF36-EB700A936390','460B9EE4-8ED5-4FB3-AA3A-7586FB9602E2',1,1,'Person')
insert into RoleAutInfo(RoleAutID,RoleID,AuID,SeeRes,ControlRes,AuTag)
values('D7B0E6F5-C8A7-4673-B577-E19DF51C6188','8A15BD39-03F3-4A79-BF36-EB700A936390','023BBC7F-8DC0-42EF-8D6B-0295CB456902',1,1,'Gate')
insert into RoleAutInfo(RoleAutID,RoleID,AuID,SeeRes,ControlRes,AuTag)
values('5D2EA30F-47CA-4999-B44F-892D33D79491','8A15BD39-03F3-4A79-BF36-EB700A936390','9F64F151-26E3-4930-AAD6-866CE5F918B1',1,1,'Surveil')
insert into RoleAutInfo(RoleAutID,RoleID,AuID,SeeRes,ControlRes,AuTag)
values('17BB16F6-FCC4-4337-844C-40E1D6157751','8A15BD39-03F3-4A79-BF36-EB700A936390','17356ED8-9D7B-45F8-81D6-DDF4CF1A5213',1,1,'Report')
insert into RoleAutInfo(RoleAutID,RoleID,AuID,SeeRes,ControlRes,AuTag)
values('CF46CFAA-5604-4EF6-9DBD-9FE8184CCAF3','8A15BD39-03F3-4A79-BF36-EB700A936390','0CE948F7-3C51-4900-A584-77AA970CA39C',1,1,'Dept')
insert into RoleAutInfo(RoleAutID,RoleID,AuID,SeeRes,ControlRes,AuTag)
values('369CF4B0-C687-407B-9727-C359DC563666','8A15BD39-03F3-4A79-BF36-EB700A936390','E98DC2D2-0DA2-4573-94FA-05A0C5FECE0E',1,1,'Attendance')
insert into RoleAutInfo(RoleAutID,RoleID,AuID,SeeRes,ControlRes,AuTag)
values('863CD972-7E2C-420E-AFEF-2FFBBB2B7139','8A15BD39-03F3-4A79-BF36-EB700A936390','153B05F2-3DCA-452D-8C17-5AF165055A32',1,1,'Service')
insert into RoleAutInfo(RoleAutID,RoleID,AuID,SeeRes,ControlRes,AuTag)
values('2B3B96BD-BA33-4EB1-B04B-97A425CBC045','8A15BD39-03F3-4A79-BF36-EB700A936390','F9DAD706-3B67-4C32-B05E-A9F2D9B4BCB3',1,1,'Sched')
insert into RoleAutInfo(RoleAutID,RoleID,AuID,SeeRes,ControlRes,AuTag)
values('7217C2D9-4DD1-46DB-AED4-D1A1275A883D','8A15BD39-03F3-4A79-BF36-EB700A936390','E43B8E12-6D63-4B31-A705-5AE750872CB6',1,1,'Holiday')
insert into RoleAutInfo(RoleAutID,RoleID,AuID,SeeRes,ControlRes,AuTag)
values('8E003AB0-D3D9-43C3-8C2D-8E4112292855','8A15BD39-03F3-4A79-BF36-EB700A936390','155C8BFF-8477-414B-AB91-45E6EBDEA145',1,1,'Leave')
insert into RoleAutInfo(RoleAutID,RoleID,AuID,SeeRes,ControlRes,AuTag)
values('6A82A92E-57F8-479F-A48E-F90567040BDC','8A15BD39-03F3-4A79-BF36-EB700A936390','3DFEAF12-5638-4185-A884-733C0694C26C',1,1,'Retroactive')
insert into RoleAutInfo(RoleAutID,RoleID,AuID,SeeRes,ControlRes,AuTag)
values('0840DCF2-6F30-4C80-8F8C-C9A0E1DC27D0','8A15BD39-03F3-4A79-BF36-EB700A936390','18921CFA-DAC4-4F7E-9533-7631F8681CDB',1,1,'AttReport')

go

/***用户表***/
if exists(select * from sysobjects where name='UserInfo')
begin
 drop table UserInfo
end
create table UserInfo
(
   UserID nvarchar(50) primary key not null,
   UserName nvarchar(20) not null,
   UserPwd nvarchar(50) not null,
   RoleID nvarchar(50) not null,
   CreateDate datetime not null,
   LoginDate datetime ,
   UserState int not null,
   Remark nvarchar(100),
   UserLevel int
)

go

insert into UserInfo(UserID,UserName,UserPwd,RoleID,CreateDate,LoginDate,UserState,Remark,UserLevel)
values('0B024958-2838-4956-8EDE-11CE3AC2D425','admin','c4ca4238a0b92382dcc509a6f75849b','8A15BD39-03F3-4A79-BF36-EB700A936390',getdate(),getdate(),1,'系统管理员',1)

go

/**人员表**/
if exists(select * from sysobjects where name='PersonInfo')
begin 
  drop table PersonInfo
end
create table PersonInfo
(
   PerID nvarchar(50) primary key not null,
   WUserID int not null,
   Powers tinyint not null,
   FpCnt tinyint ,
   FpCntDetal int,
   PwsFlg bit,
   CardFlg bit,
   CName nvarchar(10) not null,
   CRemark nvarchar(10) ,
   DwCardNum nvarchar(20),
   DwPwd int,
   WRegTime datetime,
   WStopTime datetime,
   DutySequence tinyint,
   Depatment tinyint,
   CGateAg tinyint,
   CGateTZ binary(3),
   CVerifyType tinyint,
   CAccessComb tinyint,
   CGateEnable tinyint,
   DevID nvarchar(50),
   DuressFlg bit,
   PerPhoto image,
   DeptID nvarchar(50)
)

go

/**用户出入记录**/
if exists(select * from sysobjects where name='UserLogInfo')
begin
   drop table UserLogInfo
end
create table UserLogInfo
(
   ULID nvarchar(50) primary key not null,
   WUserID int not null,
   Years nvarchar(4) not null,
   Months nvarchar(2) not null,
   Days  nvarchar(2) not null,
   Actions int not null,
   Status int ,
   JobCode int ,
   Hours nvarchar(2) not null,
   Minutes nvarchar(2) not null,
   Seconds nvarchar(2) not null,
   DevID nvarchar(50) 
)

go

/**设备系统表**/
if exists(select * from sysobjects where name='System_Info')
begin 
  drop table System_Info
end
create table System_Info
(
  CDID nvarchar(50) primary key not null,
  CDeviceName nvarchar(50) not null,
  CSerialNumber nvarchar(20) not null,
  CFireware nvarchar(20),
  CManufactory nvarchar(100),
  CManufactureDate nvarchar(50),
  DWMaxFingerNum int,
  DWSerialaNumber int,
  CBootMenuPic tinyint,
  CMenuBackGround tinyint,
  DevID nvarchar(50),
  MacAdd nvarchar(20)
)

go

/**设备连接表**/
if exists(select * from sysobjects where name='DevicrLinkInfo')
begin
  drop table DevicrLinkInfo
end
create table DevicrLinkInfo
(
   DevID nvarchar(50) primary key not null,
   DevName nvarchar(30) not null,
   DevCom nvarchar(100),
   Baudrate int,
   DataBit tinyint,
   StopBit tinyint,
   CheckMode tinyint,
   DeviceAdd nvarchar(30),
   PassWords nvarchar(30) ,
   Rport int,
   IPAddress nvarchar(20), 
   LinkType nvarchar(20),
   IFStart bit,
   RecordNum int,
   ExitDoorStart nvarchar(20),
   ExitDoorEnd nvarchar(20),
   DoorInOut int
)

go

Insert into DevicrLinkInfo(DevID,DevName,DevCom,Baudrate,DataBit,StopBit,CheckMode,DeviceAdd,PassWords,Rport,IPAddress,LinkType,IFStart,RecordNum,ExitDoorStart,ExitDoorEnd,DoorInOut)
values(NEWID(),'device','',0,0,0,0,1,0,6000,'192.168.1.110','TCP/IP',1,0,'','',0)

/**门禁时间段表**/
if exists(select * from sysobjects where name='RKEDateInfo')
begin
  drop table RKEDateInfo
end
create table RKEDateInfo
(
   RKEID nvarchar(50) primary key not null,
   RKEName nvarchar(100) not null,
   RKENo int not null,
   Remark nvarchar(100),
   DevID nvarchar(50),
   IfUp bit
)

go

/**门禁时间段子表**/
if exists(select * from  sysobjects where name='RKEDateDetail')
begin
   drop table RKEDateDetail
end
create table RKEDateDetail
(
  RKEDelID nvarchar(50) primary key not null,
  RKEID nvarchar(50) not null,
  DateContent nvarchar(100),
  StartTime int ,
  EndTime int
)

go

/**门禁组表**/
if exists(select * from sysobjects where name='GateAGInfo')
begin 
  drop table GateAGInfo
end
create table GateAGInfo
(
  AGID nvarchar(50) primary key not null,
  AGName nvarchar(50) not null,
  AGNo int not null,
  Remark nvarchar(20),
  DevID nvarchar(50),
  GateAG binary(3),
  IfUp bit
)

go


/**开锁组合表**/
if exists(select * from sysobjects where name='GateLGInfo')
begin
   drop table GateLGInfo
end
create table GateLGInfo
(
  LGID nvarchar(50) primary key not null,
  LGName nvarchar(50) not null,
  LGNo int not null,
  Remark nvarchar(20),
  DevID nvarchar(50),
  GateLG binary(5),
  IfUp bit
)

go


/**监控日志表**/
if exists(select * from sysobjects where name='SurLogInfo')
begin
   drop table SurLogInfo
end
create table SurLogInfo
(
  SUID nvarchar(50) primary key not null,
  SUDate datetime not null,
  SUContent nvarchar(200) not null,
  UserID nvarchar(50) not null,
  UserName nvarchar(20) not null,
  SUType nvarchar(20) not null,
  WUserID int ,
  CVerifyType int,
  DevName nvarchar(50) not null,
  DevID nvarchar(50) not null,
  IFDoor int
)

go

/**人员指纹表**/
if exists(select * from sysobjects where name='PerFingerInfo')
begin
  drop table PerFingerInfo
end
create table PerFingerInfo
(
   PerFiID nvarchar(50) primary key not null,
   FPNo int not null,
   PerID nvarchar(50) not null,
   WUserID int ,
   FPdate binary(1024) not null,
   FPLen int not null
)

go

/**人员设备表**/
if exists(select * from sysobjects where name='DevPerInfo')
begin
  drop table DevPerInfo
end
create table DevPerInfo
(
   DevPerID nvarchar(50) primary key not null,
   DevID nvarchar(50) not null,
   PerID nvarchar(50) not null
)

go

/**部门表**/
if exists(select * from sysobjects where name='DeptInfo')
begin
   drop table DeptInfo
end
create table DeptInfo
(
    DeptID nvarchar(50) primary key not null,
    DeptName nvarchar(200) not null,
    DeptParent nvarchar(50) ,
    DeptRemark nvarchar(300)
)
go


/**班次表**/
if exists(select * from sysobjects where name='ServiceInfo')
begin
   drop table ServiceInfo
end
create table ServiceInfo
(
   SerID nvarchar(50) primary key not null,
   SerName nvarchar(50),
   SerColor nvarchar(20),
   CreatePer nvarchar(20),
   CreateDate nvarchar(30),
   IFDefault bit,
   SerType int
)
go

INSERT INTO ServiceInfo(SerID,SerName,SerColor,CreatePer,CreateDate,IFDefault) values('f65ac67c-2c61-44d6-b6e5-2defe8ad298e','默认班','255,0,255,255','admin','2017-05-31',1)
go

/**班次明细**/
if exists(select * from sysobjects where name='ServiceDateInfo')
begin
    drop table ServiceDateInfo
end
create table ServiceDateInfo
(
     SerDateID nvarchar(50) primary key not null,
     StartDate datetime,
     EndDate   datetime,
     SerID     nvarchar(50),
     SerDateNo int,
     RegistrStart datetime,
     RegistrEnd   datetime,
     SignOffStart datetime,
     SignOffEnd   datetime,
     CrossDay int
)
go

INSERT INTO ServiceDateInfo(SerDateID,StartDate,EndDate,SerID,SerDateNo,RegistrStart,RegistrEnd,SignOffStart,SignOffEnd,CrossDay)
VALUES('4d2d5ac2-8a03-4932-a997-d75d033724a0','2017-05-31 14:00:00','2017-05-31 18:00:00','f65ac67c-2c61-44d6-b6e5-2defe8ad298e',2,'2017-05-31 13:01:00','2017-05-31 16:59:00','2017-05-31 17:00:00','2017-05-31 23:59:00',0)
INSERT INTO ServiceDateInfo(SerDateID,StartDate,EndDate,SerID,SerDateNo,RegistrStart,RegistrEnd,SignOffStart,SignOffEnd,CrossDay)
VALUES('594172d1-76cc-4d03-8878-8a8f44218119','2017-05-31 08:00:00','2017-05-31 12:00:00','f65ac67c-2c61-44d6-b6e5-2defe8ad298e',1,'2017-05-31 06:30:00','2017-05-31 11:00:00','2017-05-31 11:05:00','2017-05-31 13:00:00',0)
go

/**ServiceFreeInfo**/
if exists(select * from sysobjects where name='ServiceFreeInfo')
begin
   drop table ServiceFreeInfo
end
create table ServiceFreeInfo
(
   SFID nvarchar(36) primary key not null,
   SerID  nvarchar(36),
   SFDefault bit,
   ParSerID nvarchar(36)
)
go


/**人员排班表**/
if exists(select * from sysobjects where name='PersonSchedInfo')
begin
   drop table PersonSchedInfo
end
create table PersonSchedInfo
(
     PSID nvarchar(50) primary key not null,
     PerID nvarchar(50),
     PerNo int,
     CreateDate nvarchar(20),
     PSType int
)
go

/**排班明细表**/
if exists(select * from sysobjects where name='WeekSchedInfo')
begin
   drop table WeekSchedInfo
end
create table WeekSchedInfo
(
    WSID nvarchar(50) primary key not null,
    PSID nvarchar(50),
    WeekNo int,
    SerID nvarchar(50),
    PSDate datetime
    )
go


/**节假日信息表**/
if exists(select * from sysobjects where name='HolidayInfo')
begin
    drop table HolidayInfo
end
create table HolidayInfo
(
      HDID nvarchar(50) primary key not null,
      StartDate datetime,
      EndDate datetime,
      Holiday nvarchar(100),
      CreateDate nvarchar(20),
      Remark nvarchar(255),
      HDName nvarchar(50),
      SerID nvarchar(50),
      WorkStartDate datetime,
      WorkEndDate datetime      
)
go

/**类别表**/
if exists(select * from sysobjects where name='AttendanceType')
begin
     drop table AttendanceType
end
create table AttendanceType
(
     ATID int primary key,
     ATName nvarchar(50),
     ATNo int identity(1,1),
)

go

Insert into AttendanceType(ATID,ATName) 
values(1,'公假')
Insert into AttendanceType(ATID,ATName) 
values(2,'事假')
Insert into AttendanceType(ATID,ATName) 
values(3,'出差')
Insert into AttendanceType(ATID,ATName) 
values(4,'加班')
Insert into AttendanceType(ATID,ATName) 
values(5,'病假')
Insert into AttendanceType(ATID,ATName) 
values(6,'工伤假')
Insert into AttendanceType(ATID,ATName) 
values(7,'婚假')
Insert into AttendanceType(ATID,ATName) 
values(8,'丧假')
Insert into AttendanceType(ATID,ATName) 
values(9,'产假')
Insert into AttendanceType(ATID,ATName) 
values(10,'年休')

go

/**休假表**/
if exists(select * from sysobjects where name='LeaveInfo')
begin
   drop table LeaveInfo
end
create table  LeaveInfo
(
     LEID nvarchar(50) primary key not null,
     PerID nvarchar(50),
     PerNo int,
     DeptName nvarchar(255),
     Reason  text,
     StartDate datetime,
     EndDate   datetime,
     ReviewPerson nvarchar(10),
     CreateDate nvarchar(20),
     ATID nvarchar(50)
)
go

/**补签记录表**/
if exists(select * from sysobjects where name='RetroactiveInfo')
begin
    drop table RetroactiveInfo
end
create table RetroactiveInfo
(
     RTID nvarchar(50) primary key not null,
     PerID nvarchar(50),
     PerNo int,
     DeptName nvarchar(255),
     Reason   text,
     RTDate datetime,
     ReviewPerson nvarchar(10),
     CreateDate nvarchar(20)
)
go

/**考勤规则表**/
if exists(select * from sysobjects where name='AttendanceRules')
begin
     drop table AttendanceRules
end
create table AttendanceRules
(
      ARID nvarchar(50) primary key not null,
      MonthStart int,
      WeekStart int,
      LateTime int,
      LeaveTime int,
      RegistrLate int,
      SignoffLeave int,
      LateAbsent int,
      LeaveAbsent int,
      DayTime  int,
      AbsentLate int,
      AbsentLeave int,
      WorkLate int,
      WorkLeave int,
      WorkLateMinute int,
      WorkLeaveMinute int,
      IFLateWorkTime int,
      LateWorkTime int,
      IFLeaveWorkTime int,
      LeaveWorkTime int,
      LateOverTime int,
      LeaveOverTime int
)
go

insert into AttendanceRules(ARID,MonthStart,WeekStart,LateTime,LeaveTime,RegistrLate,SignoffLeave,LateAbsent,LeaveAbsent,DayTime,AbsentLate,AbsentLeave,WorkLate,WorkLeave,WorkLateMinute,WorkLeaveMinute,IFLateWorkTime,LateWorkTime,IFLeaveWorkTime,LeaveWorkTime,LateOverTime,LeaveOverTime)
values('d5dfc75a-7cf8-4c62-08a4-9bd936dbcc3a',1,1,1,1,1,1,1,1,480,1,1,0,0,1,1,0,60,1,60,60,60)

go

/**周末设置**/
if exists(select * from sysobjects where name='WeekWriteInfo')
begin
     drop table WeekWriteInfo
end
create table WeekWriteInfo
(
    WEID int identity(1,1) primary key,
    WeekName nvarchar(50),
    WeekContent bit,
    WeekNo int
)
go

insert into WeekWriteInfo(WeekName,WeekContent,WeekNo)
values('Sunday',0,1)
insert into WeekWriteInfo(WeekName,WeekContent,WeekNo)
values('Monday',1,2)
insert into WeekWriteInfo(WeekName,WeekContent,WeekNo)
values('Tuesday',1,3)
insert into WeekWriteInfo(WeekName,WeekContent,WeekNo)
values('Wednesday',1,4)
insert into WeekWriteInfo(WeekName,WeekContent,WeekNo)
values('Thursday',1,5)
insert into WeekWriteInfo(WeekName,WeekContent,WeekNo)
values('Friday',1,6)
insert into WeekWriteInfo(WeekName,WeekContent,WeekNo)
values('Saturday',0,7)

/**人员加班排班表**/
if exists(select * from sysobjects where name='PersonWorkTime')
begin
    drop table PersonWorkTime
end
create table PersonWorkTime
(
     PWTID nvarchar(50) primary key not null,
     PerID nvarchar(50) not null,
     PerNo int ,
     SerID nvarchar(50) not null,
     PWTDate datetime
)

go

/**LogInfo**/
if exists(select * from sysobjects where name='LogInfo')
begin
   drop table LogInfo
end
create table LogInfo
(
   LogID nvarchar(36) primary key not null,
   LogContent text,
   LogUser nvarchar(40),
   LogDate nvarchar(30),
   LogFunction nvarchar(50),
   LogDetail text
)

go


/**LanguageInfo**/
if exists(select * from sysobjects where name='LanguageInfo')
begin
   drop table LanguageInfo
end
create table LanguageInfo
(
  LanID nvarchar(36) primary key not null,
  LanName nvarchar(50) not null,
  LanFileName nvarchar(100) not null,
  LanSeq int,
  LanType int,
  IFDefault int
)

go

insert into LanguageInfo(LanID,LanName,LanFileName,LanSeq,LanType,IFDefault)
values('DF25ADA1-A413-4C2D-A5D2-3FF78A3105C0','中文简体','Language_zh-CHS.xml',1,1,0)
insert into LanguageInfo(LanID,LanName,LanFileName,LanSeq,LanType,IFDefault)
values('760B8836-6274-402A-A2EC-3679F83B54D1','中文繁体','Language_zh-CHT.xml',2,1,1)
insert into LanguageInfo(LanID,LanName,LanFileName,LanSeq,LanType,IFDefault)
values('6746D761-4C93-4BCC-8D59-5DE5A18432D9','English','Language_en.xml',3,1,1)
insert into LanguageInfo(LanID,LanName,LanFileName,LanSeq,LanType,IFDefault)
values('7a8ef3e0-ea53-4135-8bd7-8e67140d3d88','한국의','Language_ko-KR.xml',4,2,1)

go

/**DataVerInfo**/
if exists(select * from sysobjects where name='DataVerInfo')
begin
   drop table DataVerInfo
end
create table DataVerInfo
(
   VerID int identity(1,1) primary key not null,
   VerContent int,
   IFLogin int,
   Languages nvarchar(100)
)

go

Insert into DataVerInfo(VerContent,IFLogin,Languages)
values(3,0,'Language_zh-CHS.xml')

go

/**DataUpdateInfo**/
if exists(select * from sysobjects where name='DataUpdateInfo')
begin
   drop table DataUpdateInfo
end
create table DataUpdateInfo
(
  DUID int identity(1,1) primary key not null,
  DataVer int,
  DUContent text,
  Remark text,
  DataType int,
  DUDate nvarchar(30)
)

go

INSERT [dbo].[DataUpdateInfo] ( [DataVer], [DUContent], [Remark], [DataType], [DUDate]) VALUES (1, N'Create table LogInfo(LogID varchar(36) not null Primary key,LogContent text,LogUser varchar(40) not null,LogDate varchar(30) not null,LogFunction varchar(50) not null,LogDetail text)', N'创建日志记录表', 1, N'2016-12-13 16:38:46')
INSERT [dbo].[DataUpdateInfo] ( [DataVer], [DUContent], [Remark], [DataType], [DUDate]) VALUES (1,N'Drop table LanguageInfo', N'删除语言文件', 1, N'2016-12-13 16:38:46')
INSERT [dbo].[DataUpdateInfo] ( [DataVer], [DUContent], [Remark], [DataType], [DUDate]) VALUES (1, N'Create table LanguageInfo(LanID varchar(36) not null Primary key,LanName varchar(50) not null,LanFileName varchar(100) not null,LanSeq int,LanType int,IFDefault int)', N'创建语言信息表', 1, N'2016-12-13 16:38:46')
INSERT [dbo].[DataUpdateInfo] ( [DataVer], [DUContent], [Remark], [DataType], [DUDate]) VALUES (1, N'Insert into LanguageInfo(LanID,LanName,LanFileName,LanSeq,LanType,IFDefault) values(''6746D761-4C93-4BCC-8D59-5DE5A18432D9'',''English'',''Language_en.xml'',3,1,0)', N'添加语言信息', 1, N'2016-12-13 16:38:46')
INSERT [dbo].[DataUpdateInfo] ( [DataVer], [DUContent], [Remark], [DataType], [DUDate]) VALUES (1, N'Insert into LanguageInfo(LanID,LanName,LanFileName,LanSeq,LanType,IFDefault) values(''760B8836-6274-402A-A2EC-3679F83B54D1'',''中文繁体'',''Language_zh-CHT.xml'',2,1,1)', N'添加语言信息', 1, N'2016-12-13 16:38:46')
INSERT [dbo].[DataUpdateInfo] ( [DataVer], [DUContent], [Remark], [DataType], [DUDate]) VALUES (1, N'Insert into LanguageInfo(LanID,LanName,LanFileName,LanSeq,LanType,IFDefault) values(''7a8ef3e0-ea53-4135-8bd7-8e67140d3d88'',''???'',''Language_ko-KR.xml'',4,2,1)', N'添加语言信息', 1, N'2016-12-13 16:38:46')
INSERT [dbo].[DataUpdateInfo] ( [DataVer], [DUContent], [Remark], [DataType], [DUDate]) VALUES (1, N'Insert into LanguageInfo(LanID,LanName,LanFileName,LanSeq,LanType,IFDefault) values(''DF25ADA1-A413-4C2D-A5D2-3FF78A3105C0'',''中文简体'',''Language_zh-CHS.xml'',1,1,1)', N'添加语言信息', 1, N'2016-12-13 16:38:46')
INSERT [dbo].[DataUpdateInfo] ( [DataVer], [DUContent], [Remark], [DataType], [DUDate]) VALUES (1, N'Create table DataVerInfo(VerID int Primary key not null,VerContent int not null,IFLogin int,Languages varchar(100))', N'创建数据版本表', 1, N'2016-12-13 16:38:46')
INSERT [dbo].[DataUpdateInfo] ( [DataVer], [DUContent], [Remark], [DataType], [DUDate]) VALUES (1, N'Insert into DataVerInfo(VerID,VerContent,IFLogin,Languages) values(1,1,0,''Language_zh-CHS.xml'')', N'添加数据库版本信息', 1, N'2016-12-13 16:38:46')
INSERT [dbo].[DataUpdateInfo] ( [DataVer], [DUContent], [Remark], [DataType], [DUDate]) VALUES (1, N'Create table DataUpdateInfo(DUID AutoIncrement not null  Primary key,DataVer int not null,DUContent text not null,Remark text,DataType int not null,DUDate varchar(30))', N'创建数据更新内容表', 1, N'2016-12-13 16:38:46')
INSERT [dbo].[DataUpdateInfo] ( [DataVer], [DUContent], [Remark], [DataType], [DUDate]) VALUES (1, N'Create Table PersonDetail(PerID varchar(36) primary key not null,PerSex int,Nation varchar(100),JobTitle varchar(100),Religion varchar(50),TechnicalLevel varchar(50),Hometown varchar(100),Birthday varchar(30),IDCard varchar(50),Marriage int,SocialSecurity varchar(50),Politicalstatus varchar(50),EntryTime varchar(36),Educational varchar(50),PerTel varchar(50),PerEmail varchar(100),PerPhone varchar(50),PerAddress text,HomePhone varchar(50),EnglishName varchar(100),TumoverTime varchar(36),Remark text,TumoverDay int,EntryDay int)', N'创建人员明细表', 1, N'2016-12-13 16:38:46')
INSERT [dbo].[DataUpdateInfo] ( [DataVer], [DUContent], [Remark], [DataType], [DUDate]) VALUES (1, N'Create Table PerTypeInfo(PTID AutoIncrement Primary key not null,PTName varchar(200) not null,PTType int)', N'创建人员类型表', 1, N'2016-12-13 16:38:46')
INSERT [dbo].[DataUpdateInfo] ( [DataVer], [DUContent], [Remark], [DataType], [DUDate]) VALUES (1, N'Create Table PerGateAGInfo(PGID AutoIncrement Primary key not null,AGNO int,PerID varchar(36),WUserID int)', N'创建人员门禁组关系表', 1, N'2016-12-13 16:38:46')
INSERT [dbo].[DataUpdateInfo] ( [DataVer], [DUContent], [Remark], [DataType], [DUDate]) VALUES (1, N'Create Table AttReportSetInfo(ARID AutoIncrement Primary key not null,ARNo int not null,ARType int not null,ARUnit int not null,CountType int not null,ARColor varchar(100),ARBout int not null,IFUnit int not null)', N'创建报表设置表', 1, N'2016-12-13 16:38:46')
INSERT [dbo].[DataUpdateInfo] ( [DataVer], [DUContent], [Remark], [DataType], [DUDate]) VALUES (1, N'Insert into AttReportSetInfo(ARNo,ARType,ARUnit,CountType,ARColor,ARBout,IFUnit) values(1,1,1,2,'''',0,1)', N'添加报表设置', 1, N'2016-12-13 16:38:46')
INSERT [dbo].[DataUpdateInfo] ( [DataVer], [DUContent], [Remark], [DataType], [DUDate]) VALUES (1, N'Insert into AttReportSetInfo(ARNo,ARType,ARUnit,CountType,ARColor,ARBout,IFUnit) values(2,1,1,2,'''',0,1)', N'添加报表设置', 1, N'2016-12-13 16:38:46')
INSERT [dbo].[DataUpdateInfo] ( [DataVer], [DUContent], [Remark], [DataType], [DUDate]) VALUES (1, N'Insert into AttReportSetInfo(ARNo,ARType,ARUnit,CountType,ARColor,ARBout,IFUnit) values(3,2,3,2,''255,255,0,0'',0,1)', N'添加报表设置', 1, N'2016-12-13 16:38:46')
INSERT [dbo].[DataUpdateInfo] ( [DataVer], [DUContent], [Remark], [DataType], [DUDate]) VALUES (1, N'Insert into AttReportSetInfo(ARNo,ARType,ARUnit,CountType,ARColor,ARBout,IFUnit) values(4,2,3,2,''255,255,128,128'',0,1)', N'添加报表设置', 1, N'2016-12-13 16:38:46')
INSERT [dbo].[DataUpdateInfo] ( [DataVer], [DUContent], [Remark], [DataType], [DUDate]) VALUES (1, N'Insert into AttReportSetInfo(ARNo,ARType,ARUnit,CountType,ARColor,ARBout,IFUnit) values(5,2,3,1,''255,255,255,0'',0,1)', N'添加报表设置', 1, N'2016-12-13 16:38:46')
INSERT [dbo].[DataUpdateInfo] ( [DataVer], [DUContent], [Remark], [DataType], [DUDate]) VALUES (1, N'Insert into AttReportSetInfo(ARNo,ARType,ARUnit,CountType,ARColor,ARBout,IFUnit) values(6,2,2,3,''255,255,128,128'',0,1)', N'添加报表设置', 1, N'2016-12-13 16:38:46')
INSERT [dbo].[DataUpdateInfo] ( [DataVer], [DUContent], [Remark], [DataType], [DUDate]) VALUES (1, N'Insert into AttReportSetInfo(ARNo,ARType,ARUnit,CountType,ARColor,ARBout,IFUnit) values(7,2,3,2,''255,255,128,128'',0,0)', N'添加报表设置', 1, N'2016-12-13 16:38:46')
INSERT [dbo].[DataUpdateInfo] ( [DataVer], [DUContent], [Remark], [DataType], [DUDate]) VALUES (1, N'Insert into AttReportSetInfo(ARNo,ARType,ARUnit,CountType,ARColor,ARBout,IFUnit) values(8,3,0,0,''255,255,128,128'',0,0)', N'添加报表设置', 1, N'2016-12-13 16:38:46')
INSERT [dbo].[DataUpdateInfo] ( [DataVer], [DUContent], [Remark], [DataType], [DUDate]) VALUES (1, N'Insert into AttReportSetInfo(ARNo,ARType,ARUnit,CountType,ARColor,ARBout,IFUnit) values(9,3,0,0,''255,255,128,128'',0,0)', N'添加报表设置', 1, N'2016-12-13 16:38:46')
INSERT [dbo].[DataUpdateInfo] ( [DataVer], [DUContent], [Remark], [DataType], [DUDate]) VALUES (1, N'Alter Table LeaveInfo Alter Column ATID int', N'修改请假表ATID数据类型', 1, N'2016-12-13 16:38:46')
INSERT [dbo].[DataUpdateInfo] ( [DataVer], [DUContent], [Remark], [DataType], [DUDate]) VALUES (1, N'Alter Table AttendanceType Alter Column ATID int', N'修改请假类型主键类型', 1, N'2016-12-13 16:38:46')
INSERT [dbo].[DataUpdateInfo] ( [DataVer], [DUContent], [Remark], [DataType], [DUDate]) VALUES (1, N'Insert into AttendanceType(ATID,ATName) values(1,''公假'')', N'添加请假类型', 1, N'2016-12-13 16:38:46')
INSERT [dbo].[DataUpdateInfo] ( [DataVer], [DUContent], [Remark], [DataType], [DUDate]) VALUES (1, N'Insert into AttendanceType(ATID,ATName) values(2,''事假'')', N'添加请假类型', 1, N'2016-12-13 16:38:46')
INSERT [dbo].[DataUpdateInfo] ( [DataVer], [DUContent], [Remark], [DataType], [DUDate]) VALUES (1, N'Insert into AttendanceType(ATID,ATName) values(3,''出差'')', N'添加请假类型', 1, N'2016-12-13 16:38:46')
INSERT [dbo].[DataUpdateInfo] ( [DataVer], [DUContent], [Remark], [DataType], [DUDate]) VALUES (1, N'Insert into AttendanceType(ATID,ATName) values(4,''加班'')', N'', 1, N'2016-12-13 16:38:46')
INSERT [dbo].[DataUpdateInfo] ( [DataVer], [DUContent], [Remark], [DataType], [DUDate]) VALUES (1, N'Insert into AttendanceType(ATID,ATName) values(5,''病假'')', N'', 1, N'2016-12-13 16:38:46')
INSERT [dbo].[DataUpdateInfo] ( [DataVer], [DUContent], [Remark], [DataType], [DUDate]) VALUES (1, N'Insert into AttendanceType(ATID,ATName) values(6,''工伤假'')', N'', 1, N'2016-12-13 16:38:46')
INSERT [dbo].[DataUpdateInfo] ( [DataVer], [DUContent], [Remark], [DataType], [DUDate]) VALUES (1, N'Insert into AttendanceType(ATID,ATName) values(7,''婚假'')', N'', 1, N'2016-12-13 16:38:46')
INSERT [dbo].[DataUpdateInfo] ( [DataVer], [DUContent], [Remark], [DataType], [DUDate]) VALUES (1, N'Insert into AttendanceType(ATID,ATName) values(8,''丧假'')', N'', 1, N'2016-12-13 16:38:46')
INSERT [dbo].[DataUpdateInfo] ( [DataVer], [DUContent], [Remark], [DataType], [DUDate]) VALUES (1, N'Insert into AttendanceType(ATID,ATName) values(9,''产假'')', N'', 1, N'2016-12-13 16:38:46')
INSERT [dbo].[DataUpdateInfo] ( [DataVer], [DUContent], [Remark], [DataType], [DUDate]) VALUES (1, N'Insert into AttendanceType(ATID,ATName) values(10,''年休'')', N'', 1, N'2016-12-13 16:38:46')
INSERT [dbo].[DataUpdateInfo] ( [DataVer], [DUContent], [Remark], [DataType], [DUDate]) VALUES (1, N'Alter Table WeekSchedInfo add PSDate DateTime', N'', 1, N'2016-12-13 16:38:46')
INSERT [dbo].[DataUpdateInfo] ( [DataVer], [DUContent], [Remark], [DataType], [DUDate]) VALUES (1, N'alter table PersonInfo alter column DwCardNum varchar(255)', N'', 1, N'2016-12-13 16:38:46')
INSERT [dbo].[DataUpdateInfo] ( [DataVer], [DUContent], [Remark], [DataType], [DUDate]) VALUES (1, N'Alter table UserLogInfo alter column WUserID int', N'', 1, N'2016-12-13 16:38:46')
INSERT [dbo].[DataUpdateInfo] ( [DataVer], [DUContent], [Remark], [DataType], [DUDate]) VALUES (1, N'Alter Table DevicrLinkInfo Add Column DoorInOut int', N'', 1, N'2016-12-13 16:38:46')
INSERT [dbo].[DataUpdateInfo] ( [DataVer], [DUContent], [Remark], [DataType], [DUDate]) VALUES (1, N'Update DevicrLinkInfo set DoorInOut=1', N'', 1, N'2016-12-13 16:38:46')
INSERT [dbo].[DataUpdateInfo] ( [DataVer], [DUContent], [Remark], [DataType], [DUDate]) VALUES (1, N'Update RoleAutInfo set AuTag=''DeptManage'' where AuTag=''Dept''', N'', 1, N'2016-12-13 16:38:46')
INSERT [dbo].[DataUpdateInfo] ( [DataVer], [DUContent], [Remark], [DataType], [DUDate]) VALUES (1, N'Update RoleAutInfo set AuTag=''GateManage'' where AuTag=''Gate''', N'', 1, N'2016-12-13 16:38:46')
INSERT [dbo].[DataUpdateInfo] ( [DataVer], [DUContent], [Remark], [DataType], [DUDate]) VALUES (1, N'Update RoleAutInfo set AuTag=''PersonManage'' where AuTag=''Person''', N'', 1, N'2016-12-13 16:38:46')
INSERT [dbo].[DataUpdateInfo] ( [DataVer], [DUContent], [Remark], [DataType], [DUDate]) VALUES (1, N'Update Authority set AuTag=''DeptManage'' where AuTag=''Dept''', N'', 1, N'2016-12-13 16:38:46')
INSERT [dbo].[DataUpdateInfo] ( [DataVer], [DUContent], [Remark], [DataType], [DUDate]) VALUES (1, N'Update Authority set AuTag=''GateManage'' where AuTag=''Gate''', N'', 1, N'2016-12-13 16:38:46')
INSERT [dbo].[DataUpdateInfo] ( [DataVer], [DUContent], [Remark], [DataType], [DUDate]) VALUES (1, N'Update Authority set AuTag=''PersonManage'' where AuTag=''Person''', N'', 1, N'2016-12-13 16:38:46')
INSERT [dbo].[DataUpdateInfo] ( [DataVer], [DUContent], [Remark], [DataType], [DUDate]) VALUES (1, N'delete from Authority where AuTag=''Report''', N'', 1, N'2016-12-13 16:38:46')
INSERT [dbo].[DataUpdateInfo] ( [DataVer], [DUContent], [Remark], [DataType], [DUDate]) VALUES (1, N'delete from RoleAutInfo where AuTag=''Report''', N'', 1, N'2016-12-13 16:38:46')
INSERT [dbo].[DataUpdateInfo] ( [DataVer], [DUContent], [Remark], [DataType], [DUDate]) VALUES (1, N'Insert into Authority(AuID,AuName,Remark,AuTag) values(''17CF4EF1-ECC2-4B7E-9DEB-DBAE62401835'',''人员出入记录'',''人员出入记录'',''PersonReport'')', N'', 1, N'2016-12-13 16:38:46')
INSERT [dbo].[DataUpdateInfo] ( [DataVer], [DUContent], [Remark], [DataType], [DUDate]) VALUES (1, N'Insert into RoleAutInfo(RoleAutID,RoleID,AuID,SeeRes,ControlRes,AuTag) values(''88BDB3B3-E7B9-4C81-B5EF-8972DB780A70'',''8A15BD39-03F3-4A79-BF36-EB700A936390'',''17CF4EF1-ECC2-4B7E-9DEB-DBAE62401835'',1,1,''PersonReport'')', N'', 1, N'2016-12-13 16:38:46')
INSERT [dbo].[DataUpdateInfo] ( [DataVer], [DUContent], [Remark], [DataType], [DUDate]) VALUES (2, N'Alter Table ServiceInfo Add Column IFDefault bit', N'添加班次默认字段', 1, N'2016-12-13 16:38:46')
INSERT [dbo].[DataUpdateInfo] ( [DataVer], [DUContent], [Remark], [DataType], [DUDate]) VALUES (3, N'Alter Table ServiceInfo Add Column SerType int', N'添加班次类型字段', 1, N'2016-12-13 16:38:46')
INSERT [dbo].[DataUpdateInfo] ( [DataVer], [DUContent], [Remark], [DataType], [DUDate]) VALUES (3, N'Update ServiceInfo set SerType=1', N'修改班次类型', 1, N'2016-12-13 16:38:46')
INSERT [dbo].[DataUpdateInfo] ( [DataVer], [DUContent], [Remark], [DataType], [DUDate]) VALUES (3, N'Create table ServiceFreeInfo(SFID varchar(36) not null Primary key,SerID varchar(36) not null,SFDefault bit,ParSerID varchar(36))', N'添加自由排班表', 1, N'2016-12-13 16:38:46')
INSERT [dbo].[DataUpdateInfo] ( [DataVer], [DUContent], [Remark], [DataType], [DUDate]) VALUES (1, N'Create table LogInfo(LogID nvarchar(36) not null Primary key,LogContent text,LogUser nvarchar(40) not null,LogDate nvarchar(30) not null,LogFunction nvarchar(50) not null,LogDetail text)', N'创建日志记录表', 2, N'2016-12-13 16:38:46')
INSERT [dbo].[DataUpdateInfo] ( [DataVer], [DUContent], [Remark], [DataType], [DUDate]) VALUES (1, N'Drop table LanguageInfo', N'删除语言文件', 1, N'2016-12-13 16:38:46')
INSERT [dbo].[DataUpdateInfo] ( [DataVer], [DUContent], [Remark], [DataType], [DUDate]) VALUES (1, N'Create table LanguageInfo(LanID nvarchar(36) not null Primary key,LanName nvarchar(50) not null,LanFileName nvarchar(100) not null,LanSeq int,LanType int,IFDefault int)', N'创建语言信息表', 2, N'2016-12-13 16:38:46')
INSERT [dbo].[DataUpdateInfo] ( [DataVer], [DUContent], [Remark], [DataType], [DUDate]) VALUES (1, N'Insert into LanguageInfo(LanID,LanName,LanFileName,LanSeq,LanType,IFDefault) values(''6746D761-4C93-4BCC-8D59-5DE5A18432D9'',''English'',''Language_en.xml'',3,1,0)', N'添加语言信息', 2, N'2016-12-13 16:38:46')
INSERT [dbo].[DataUpdateInfo] ( [DataVer], [DUContent], [Remark], [DataType], [DUDate]) VALUES (1, N'Insert into LanguageInfo(LanID,LanName,LanFileName,LanSeq,LanType,IFDefault) values(''760B8836-6274-402A-A2EC-3679F83B54D1'',''中文繁体'',''Language_zh-CHT.xml'',2,1,1)', N'添加语言信息', 2, N'2016-12-13 16:38:46')
INSERT [dbo].[DataUpdateInfo] ( [DataVer], [DUContent], [Remark], [DataType], [DUDate]) VALUES (1, N'Insert into LanguageInfo(LanID,LanName,LanFileName,LanSeq,LanType,IFDefault) values(''7a8ef3e0-ea53-4135-8bd7-8e67140d3d88'',''???'',''Language_ko-KR.xml'',4,2,1)', N'添加语言信息', 2, N'2016-12-13 16:38:46')
INSERT [dbo].[DataUpdateInfo] ( [DataVer], [DUContent], [Remark], [DataType], [DUDate]) VALUES (1, N'Insert into LanguageInfo(LanID,LanName,LanFileName,LanSeq,LanType,IFDefault) values(''DF25ADA1-A413-4C2D-A5D2-3FF78A3105C0'',''中文简体'',''Language_zh-CHS.xml'',1,1,1)', N'添加语言信息', 2, N'2016-12-13 16:38:46')
INSERT [dbo].[DataUpdateInfo] ( [DataVer], [DUContent], [Remark], [DataType], [DUDate]) VALUES (1, N'Create table DataVerInfo(VerID int Primary key not null,VerContent int not null,IFLogin int,Languages nvarchar(100))', N'创建数据版本表', 2, N'2016-12-13 16:38:46')
INSERT [dbo].[DataUpdateInfo] ( [DataVer], [DUContent], [Remark], [DataType], [DUDate]) VALUES (1, N'Insert into DataVerInfo(VerID,VerContent,IFLogin,Languages) values(1,1,0,''Language_zh-CHS.xml'')', N'添加数据库版本信息', 2, N'2016-12-13 16:38:46')
INSERT [dbo].[DataUpdateInfo] ( [DataVer], [DUContent], [Remark], [DataType], [DUDate]) VALUES (1, N'Create table DataUpdateInfo(DUID int identity(1,1) not null  Primary key,DataVer int not null,DUContent text not null,Remark text,DataType int not null,DUDate nvarchar(30))', N'创建数据更新内容表', 2, N'2016-12-13 16:38:46')
INSERT [dbo].[DataUpdateInfo] ( [DataVer], [DUContent], [Remark], [DataType], [DUDate]) VALUES (1, N'Create Table PersonDetail(PerID nvarchar(36) primary key not null,PerSex int,Nation nvarchar(100),JobTitle nvarchar(100),Religion nvarchar(50),TechnicalLevel nvarchar(50),Hometown nvarchar(100),Birthday nvarchar(30),IDCard nvarchar(50),Marriage int,SocialSecurity nvarchar(50),Politicalstatus nvarchar(50),EntryTime nvarchar(36),Educational nvarchar(50),PerTel nvarchar(50),PerEmail nvarchar(100),PerPhone nvarchar(50),PerAddress text,HomePhone nvarchar(50),EnglishName nvarchar(100),TumoverTime nvarchar(36),Remark text,TumoverDay int,EntryDay int)', N'创建人员明细表', 2, N'2016-12-13 16:38:46')
INSERT [dbo].[DataUpdateInfo] ( [DataVer], [DUContent], [Remark], [DataType], [DUDate]) VALUES (1, N'Create Table PerTypeInfo(PTID int identity(1,1) Primary key not null,PTName nvarchar(200) not null,PTType int)', N'创建人员类型表', 2, N'2016-12-13 16:38:46')
INSERT [dbo].[DataUpdateInfo] ( [DataVer], [DUContent], [Remark], [DataType], [DUDate]) VALUES (1, N'Create Table PerGateAGInfo(PGID int identity(1,1) Primary key not null,AGNO int,PerID nvarchar(36),WUserID int)', N'创建人员门禁组关系表', 2, N'2016-12-13 16:38:46')
INSERT [dbo].[DataUpdateInfo] ( [DataVer], [DUContent], [Remark], [DataType], [DUDate]) VALUES (1, N'Create Table AttReportSetInfo(ARID int identity(1,1) Primary key not null,ARNo int not null,ARType int not null,ARUnit int not null,CountType int not null,ARColor nvarchar(100),ARBout int not null,IFUnit int not null)', N'创建报表设置表', 2, N'2016-12-13 16:38:46')
INSERT [dbo].[DataUpdateInfo] ( [DataVer], [DUContent], [Remark], [DataType], [DUDate]) VALUES (1, N'Insert into AttReportSetInfo(ARNo,ARType,ARUnit,CountType,ARColor,ARBout,IFUnit) values(1,1,1,2,'''',0,1)', N'添加报表设置', 2, N'2016-12-13 16:38:46')
INSERT [dbo].[DataUpdateInfo] ( [DataVer], [DUContent], [Remark], [DataType], [DUDate]) VALUES (1, N'Insert into AttReportSetInfo(ARNo,ARType,ARUnit,CountType,ARColor,ARBout,IFUnit) values(2,1,1,2,'''',0,1)', N'添加报表设置', 2, N'2016-12-13 16:38:46')
INSERT [dbo].[DataUpdateInfo] ( [DataVer], [DUContent], [Remark], [DataType], [DUDate]) VALUES (1, N'Insert into AttReportSetInfo(ARNo,ARType,ARUnit,CountType,ARColor,ARBout,IFUnit) values(3,2,3,2,''255,255,0,0'',0,1)', N'添加报表设置', 2, N'2016-12-13 16:38:46')
INSERT [dbo].[DataUpdateInfo] ( [DataVer], [DUContent], [Remark], [DataType], [DUDate]) VALUES (1, N'Insert into AttReportSetInfo(ARNo,ARType,ARUnit,CountType,ARColor,ARBout,IFUnit) values(4,2,3,2,''255,255,128,128'',0,1)', N'添加报表设置', 2, N'2016-12-13 16:38:46')
INSERT [dbo].[DataUpdateInfo] ( [DataVer], [DUContent], [Remark], [DataType], [DUDate]) VALUES (1, N'Insert into AttReportSetInfo(ARNo,ARType,ARUnit,CountType,ARColor,ARBout,IFUnit) values(5,2,3,1,''255,255,255,0'',0,1)', N'添加报表设置', 2, N'2016-12-13 16:38:46')
INSERT [dbo].[DataUpdateInfo] ( [DataVer], [DUContent], [Remark], [DataType], [DUDate]) VALUES (1, N'Insert into AttReportSetInfo(ARNo,ARType,ARUnit,CountType,ARColor,ARBout,IFUnit) values(6,2,2,3,''255,255,128,128'',0,1)', N'添加报表设置', 2, N'2016-12-13 16:38:46')
INSERT [dbo].[DataUpdateInfo] ( [DataVer], [DUContent], [Remark], [DataType], [DUDate]) VALUES (1, N'Insert into AttReportSetInfo(ARNo,ARType,ARUnit,CountType,ARColor,ARBout,IFUnit) values(7,2,3,2,''255,255,128,128'',0,0)', N'添加报表设置', 2, N'2016-12-13 16:38:46')
INSERT [dbo].[DataUpdateInfo] ( [DataVer], [DUContent], [Remark], [DataType], [DUDate]) VALUES (1, N'Insert into AttReportSetInfo(ARNo,ARType,ARUnit,CountType,ARColor,ARBout,IFUnit) values(8,3,0,0,''255,255,128,128'',0,0)', N'添加报表设置', 2, N'2016-12-13 16:38:46')
INSERT [dbo].[DataUpdateInfo] ( [DataVer], [DUContent], [Remark], [DataType], [DUDate]) VALUES (1, N'Insert into AttReportSetInfo(ARNo,ARType,ARUnit,CountType,ARColor,ARBout,IFUnit) values(9,3,0,0,''255,255,128,128'',0,0)', N'添加报表设置', 2, N'2016-12-13 16:38:46')
INSERT [dbo].[DataUpdateInfo] ( [DataVer], [DUContent], [Remark], [DataType], [DUDate]) VALUES (1, N'Alter Table LeaveInfo Alter Column ATID int', N'修改请假表ATID数据类型', 2, N'2016-12-13 16:38:46')
INSERT [dbo].[DataUpdateInfo] ( [DataVer], [DUContent], [Remark], [DataType], [DUDate]) VALUES (1, N'Drop Table AttendanceType', N'修改请假类型主键类型', 2, N'2016-12-13 16:38:46')
INSERT [dbo].[DataUpdateInfo] ( [DataVer], [DUContent], [Remark], [DataType], [DUDate]) VALUES (1, N'Create table AttendanceType(ATID int primary key not null,ATName nvarchar(100),ATNo int identity(1,1))', N'修改请假类型主键类型', 2, N'2016-12-13 16:38:46')
INSERT [dbo].[DataUpdateInfo] ( [DataVer], [DUContent], [Remark], [DataType], [DUDate]) VALUES (1, N'Insert into AttendanceType(ATID,ATName) values(1,''公假'')', N'添加请假类型', 2, N'2016-12-13 16:38:46')
INSERT [dbo].[DataUpdateInfo] ( [DataVer], [DUContent], [Remark], [DataType], [DUDate]) VALUES (1, N'Insert into AttendanceType(ATID,ATName) values(2,''事假'')', N'添加请假类型', 2, N'2016-12-13 16:38:46')
INSERT [dbo].[DataUpdateInfo] ( [DataVer], [DUContent], [Remark], [DataType], [DUDate]) VALUES (1, N'Insert into AttendanceType(ATID,ATName) values(3,''出差'')', N'添加请假类型', 2, N'2016-12-13 16:38:46')
INSERT [dbo].[DataUpdateInfo] ( [DataVer], [DUContent], [Remark], [DataType], [DUDate]) VALUES (1, N'Insert into AttendanceType(ATID,ATName) values(4,''加班'')', N'', 2, N'2016-12-13 16:38:46')
INSERT [dbo].[DataUpdateInfo] ( [DataVer], [DUContent], [Remark], [DataType], [DUDate]) VALUES (1, N'Insert into AttendanceType(ATID,ATName) values(5,''病假'')', N'', 2, N'2016-12-13 16:38:46')
INSERT [dbo].[DataUpdateInfo] ( [DataVer], [DUContent], [Remark], [DataType], [DUDate]) VALUES (1, N'Insert into AttendanceType(ATID,ATName) values(6,''工伤假'')', N'', 2, N'2016-12-13 16:38:46')
INSERT [dbo].[DataUpdateInfo] ( [DataVer], [DUContent], [Remark], [DataType], [DUDate]) VALUES (1, N'Insert into AttendanceType(ATID,ATName) values(7,''婚假'')', N'', 2, N'2016-12-13 16:38:46')
INSERT [dbo].[DataUpdateInfo] ( [DataVer], [DUContent], [Remark], [DataType], [DUDate]) VALUES (1, N'Insert into AttendanceType(ATID,ATName) values(8,''丧假'')', N'', 2, N'2016-12-13 16:38:46')
INSERT [dbo].[DataUpdateInfo] ( [DataVer], [DUContent], [Remark], [DataType], [DUDate]) VALUES (1, N'Insert into AttendanceType(ATID,ATName) values(9,''产假'')', N'', 2, N'2016-12-13 16:38:46')
INSERT [dbo].[DataUpdateInfo] ( [DataVer], [DUContent], [Remark], [DataType], [DUDate]) VALUES (1, N'Insert into AttendanceType(ATID,ATName) values(10,''年休'')', N'', 2, N'2016-12-13 16:38:46')
INSERT [dbo].[DataUpdateInfo] ( [DataVer], [DUContent], [Remark], [DataType], [DUDate]) VALUES (1, N'Alter Table DevicrLinkInfo Add DoorInOut int', N'', 2, N'2016-12-13 16:38:46')
INSERT [dbo].[DataUpdateInfo] ( [DataVer], [DUContent], [Remark], [DataType], [DUDate]) VALUES (1, N'Update DevicrLinkInfo set DoorInOut=1', N'', 2, N'2016-12-13 16:38:46')
INSERT [dbo].[DataUpdateInfo] ( [DataVer], [DUContent], [Remark], [DataType], [DUDate]) VALUES (1, N'Update RoleAutInfo set AuTag=''DeptManage'' where AuTag=''Dept''', N'', 2, N'2016-12-13 16:38:46')
INSERT [dbo].[DataUpdateInfo] ( [DataVer], [DUContent], [Remark], [DataType], [DUDate]) VALUES (1, N'Update RoleAutInfo set AuTag=''GateManage'' where AuTag=''Gate''', N'', 2, N'2016-12-13 16:38:46')
INSERT [dbo].[DataUpdateInfo] ( [DataVer], [DUContent], [Remark], [DataType], [DUDate]) VALUES (1, N'Update RoleAutInfo set AuTag=''PersonManage'' where AuTag=''Person''', N'', 2, N'2016-12-13 16:38:46')
INSERT [dbo].[DataUpdateInfo] ( [DataVer], [DUContent], [Remark], [DataType], [DUDate]) VALUES (1, N'Update Authority set AuTag=''DeptManage'' where AuTag=''Dept''', N'', 2, N'2016-12-13 16:38:46')
INSERT [dbo].[DataUpdateInfo] ( [DataVer], [DUContent], [Remark], [DataType], [DUDate]) VALUES (1, N'Update Authority set AuTag=''GateManage'' where AuTag=''Gate''', N'', 2, N'2016-12-13 16:38:46')
INSERT [dbo].[DataUpdateInfo] ( [DataVer], [DUContent], [Remark], [DataType], [DUDate]) VALUES (1, N'Update Authority set AuTag=''PersonManage'' where AuTag=''Person''', N'', 2, N'2016-12-13 16:38:46')
INSERT [dbo].[DataUpdateInfo] ( [DataVer], [DUContent], [Remark], [DataType], [DUDate]) VALUES (1, N'delete from Authority where AuTag=''Report''', N'', 2, N'2016-12-13 16:38:46')
INSERT [dbo].[DataUpdateInfo] ( [DataVer], [DUContent], [Remark], [DataType], [DUDate]) VALUES (1, N'delete from RoleAutInfo where AuTag=''Report''', N'', 2, N'2016-12-13 16:38:46')
INSERT [dbo].[DataUpdateInfo] ( [DataVer], [DUContent], [Remark], [DataType], [DUDate]) VALUES (1, N'Insert into Authority(AuID,AuName,Remark,AuTag) values(''17CF4EF1-ECC2-4B7E-9DEB-DBAE62401835'',''人员出入记录'',''人员出入记录'',''PersonReport'')', N'', 2, N'2016-12-13 16:38:46')
INSERT [dbo].[DataUpdateInfo] ( [DataVer], [DUContent], [Remark], [DataType], [DUDate]) VALUES (1, N'Insert into RoleAutInfo(RoleAutID,RoleID,AuID,SeeRes,ControlRes,AuTag) values(''88BDB3B3-E7B9-4C81-B5EF-8972DB780A70'',''8A15BD39-03F3-4A79-BF36-EB700A936390'',''17CF4EF1-ECC2-4B7E-9DEB-DBAE62401835'',1,1,''PersonReport'')', N'', 2, N'2016-12-13 16:38:46')
INSERT [dbo].[DataUpdateInfo] ( [DataVer], [DUContent], [Remark], [DataType], [DUDate]) VALUES (2, N'Alter Table ServiceInfo Add Column IFDefault bool', N'添加默认班次字段', 2, N'2017-05-31 16:38:46')
INSERT [dbo].[DataUpdateInfo] ( [DataVer], [DUContent], [Remark], [DataType], [DUDate]) VALUES (2, N'Alter Table ServiceInfo Add Column IFDefault bool', N'添加默认班次字段', 2, N'2017-05-31 16:38:46')
INSERT [dbo].[DataUpdateInfo] ( [DataVer], [DUContent], [Remark], [DataType], [DUDate]) VALUES (2, N'Alter Table ServiceInfo Add Column IFDefault bit', N'添加班次默认字段', 2, N'2016-12-13 16:38:46')
INSERT [dbo].[DataUpdateInfo] ( [DataVer], [DUContent], [Remark], [DataType], [DUDate]) VALUES (3, N'Alter Table ServiceInfo Add Column SerType int', N'添加班次类型字段', 2, N'2016-12-13 16:38:46')
INSERT [dbo].[DataUpdateInfo] ( [DataVer], [DUContent], [Remark], [DataType], [DUDate]) VALUES (3, N'Update ServiceInfo set SerType=1', N'修改班次类型', 2, N'2016-12-13 16:38:46')
INSERT [dbo].[DataUpdateInfo] ( [DataVer], [DUContent], [Remark], [DataType], [DUDate]) VALUES (3, N'Create table ServiceFreeInfo(SFID nvarchar(36) not null Primary key,SerID nvarchar(36) not null,SFDefault bit,ParSerID nvarchar(36))', N'添加自由排班表', 2, N'2016-12-13 16:38:46')

go

/**PersonDetail**/
if exists(select * from sysobjects where name='PersonDetail')
begin
   drop table PersonDetail
end
create table PersonDetail
(
   PerID nvarchar(36) primary key not null,
   PerSex int,
   Nation nvarchar(100),
   JobTitle nvarchar(100),
   Religion nvarchar(50),
   TechnicalLevel nvarchar(50),
   Hometown nvarchar(100),
   Birthday nvarchar(30),
   IDCard nvarchar(50),
   Marriage int,
   SocialSecurity nvarchar(50),
   Politicalstatus nvarchar(50),
   EntryTime nvarchar(36),
   Educational nvarchar(50),
   PerTel nvarchar(50),
   PerEmail nvarchar(100),
   PerPhone nvarchar(50),
   PerAddress nvarchar(500),
   HomePhone nvarchar(50),
   EnglishName nvarchar(100),
   TumoverTime nvarchar(36),
   Remark nvarchar(500),
   TumoverDay int,
   EntryDay int
)

go

/**PerTypeInfo**/
if exists(select * from sysobjects where name='PerTypeInfo')
begin
   drop table PerTypeInfo
end
create table PerTypeInfo
(
   PTID int identity(1,1) primary key not null,
   PTName nvarchar(100),
   PTType int
)

go

/**PerGateAGInfo**/
if exists(select * from sysobjects where name='PerGateAGInfo')
begin
    drop table PerGateAGInfo
end
create Table PerGateAGInfo
(
    PGID int identity(1,1) Primary key not null,
	AGNO int,PerID nvarchar(36),
	WUserID int
)

go

/**AttReportSetInfo**/
if exists(select * from sysobjects where name='AttReportSetInfo')
begin
   drop table AttReportSetInfo
end
create table AttReportSetInfo
(
    ARID int identity(1,1) primary key not null,
	ARNo int,
	ARType int,
	ARUnit int,
	CountType int,
	ARColor nvarchar(100),
	ARBout int,
	IFUnit int
)

go

Insert into AttReportSetInfo(ARNo,ARType,ARUnit,CountType,ARColor,ARBout,IFUnit)
values(1,1,1,2,'',0,1)
Insert into AttReportSetInfo(ARNo,ARType,ARUnit,CountType,ARColor,ARBout,IFUnit)
values(2,1,1,2,'',0,1)
Insert into AttReportSetInfo(ARNo,ARType,ARUnit,CountType,ARColor,ARBout,IFUnit)
values(3,2,2,2,'255,255,128,128',0,1)
Insert into AttReportSetInfo(ARNo,ARType,ARUnit,CountType,ARColor,ARBout,IFUnit)
values(4,2,2,2,'255,255,128,128',0,1)
Insert into AttReportSetInfo(ARNo,ARType,ARUnit,CountType,ARColor,ARBout,IFUnit)
values(5,2,2,2,'255,255,128,128',0,1)
Insert into AttReportSetInfo(ARNo,ARType,ARUnit,CountType,ARColor,ARBout,IFUnit)
values(6,2,2,2,'255,255,128,128',0,1)
Insert into AttReportSetInfo(ARNo,ARType,ARUnit,CountType,ARColor,ARBout,IFUnit)
values(7,2,2,2,'255,255,128,128',0,0)
Insert into AttReportSetInfo(ARNo,ARType,ARUnit,CountType,ARColor,ARBout,IFUnit)
values(8,3,0,0,'255,255,128,128',0,0)
Insert into AttReportSetInfo(ARNo,ARType,ARUnit,CountType,ARColor,ARBout,IFUnit)
values(9,3,0,0,'255,255,128,128',0,0)

go

Update RoleAutInfo set AuTag='DeptManage' where AuTag='Dept'
Update RoleAutInfo set AuTag='GateManage' where AuTag='Gate'
Update RoleAutInfo set AuTag='PersonManage' where AuTag='Person'
Update Authority set AuTag='DeptManage' where AuTag='Dept'
Update Authority set AuTag='GateManage' where AuTag='Gate'
Update Authority set AuTag='PersonManage' where AuTag='Person'
delete from Authority where AuTag='Report'
delete from RoleAutInfo where AuTag='Report'
Insert into Authority(AuID,AuName,Remark,AuTag) values('17CF4EF1-ECC2-4B7E-9DEB-DBAE62401835','人员出入记录','人员出入记录','PersonReport')
Insert into RoleAutInfo(RoleAutID,RoleID,AuID,SeeRes,ControlRes,AuTag) values(NEWID(),'8A15BD39-03F3-4A79-BF36-EB700A936390','17CF4EF1-ECC2-4B7E-9DEB-DBAE62401835',1,1,'PersonReport')

go
