升级脚本
This commit is contained in:
parent
1abdaa9476
commit
12a490ab94
|
@ -0,0 +1,13 @@
|
|||
drop INDEX IX_SitePerson_Person ON [dbo].[SitePerson_Person]
|
||||
|
||||
alter table [dbo].[SitePerson_Person]
|
||||
alter column IsUsed [int] NULL
|
||||
|
||||
|
||||
CREATE NONCLUSTERED INDEX [IX_SitePerson_Person] ON [dbo].[SitePerson_Person]
|
||||
(
|
||||
[ProjectId] ASC,
|
||||
[UnitId] ASC,
|
||||
[IsUsed] ASC
|
||||
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]
|
||||
GO
|
|
@ -0,0 +1,30 @@
|
|||
|
||||
|
||||
|
||||
ALTER VIEW [dbo].[View_Law_RulesRegulations]
|
||||
as
|
||||
select
|
||||
R.RulesRegulationsId,
|
||||
R.RulesRegulationsCode,
|
||||
R.RulesRegulationsName,
|
||||
R.RulesRegulationsTypeId,
|
||||
R.CustomDate,
|
||||
R.ApplicableScope,
|
||||
R.Remark,
|
||||
R.AttachUrl,
|
||||
R.CompileMan,
|
||||
R.CompileDate,
|
||||
R.IsPass,
|
||||
R.UnitId,
|
||||
R.IsBuild,
|
||||
T.RulesRegulationsTypeCode AS RulesRegulationsTypeCode,
|
||||
T.RulesRegulationsTypeName AS RulesRegulationsTypeName,
|
||||
Substring(R.AttachUrl,charindex('~',R.AttachUrl)+1,LEN(R.AttachUrl)) as AttachUrlName,
|
||||
(CASE WHEN IsBuild = 1 THEN '¼¯ÍÅ' ELSE '¹«Ë¾' END ) AS IsBuildName
|
||||
FROM dbo.Law_RulesRegulations AS R
|
||||
LEFT JOIN dbo.Base_RulesRegulationsType AS T ON T.RulesRegulationsTypeId=R.RulesRegulationsTypeId
|
||||
|
||||
|
||||
GO
|
||||
|
||||
|
|
@ -0,0 +1,108 @@
|
|||
|
||||
|
||||
/****** Object: View [dbo].[View_SitePerson_Person] Script Date: 2022/12/20 9:34:16 ******/
|
||||
SET ANSI_NULLS ON
|
||||
GO
|
||||
|
||||
SET QUOTED_IDENTIFIER ON
|
||||
GO
|
||||
|
||||
|
||||
ALTER VIEW [dbo].[View_SitePerson_Person]
|
||||
AS
|
||||
SELECT Person.PersonId,
|
||||
Person.CardNo,
|
||||
Person.PersonName,
|
||||
Person.Sex,
|
||||
(Case Person.Sex WHEN '1' THEN '男' WHEN '2' THEN '女' ELSE '' END) AS SexName,
|
||||
Person.IdentityCard,
|
||||
Person.Address,
|
||||
Person.ProjectId,
|
||||
Person.UnitId,
|
||||
Person.Birthday,
|
||||
Person.TeamGroupId,
|
||||
Person.WorkAreaId,
|
||||
Person.WorkPostId,
|
||||
Person.InTime,
|
||||
Person.OutTime,
|
||||
Person.OutResult,
|
||||
Person.Telephone,
|
||||
Person.PositionId,
|
||||
Person.PostTitleId,
|
||||
Person.PhotoUrl,
|
||||
Person.IsUsed,
|
||||
(CASE Person.IsUsed WHEN 1 THEN '在岗' WHEN 0 THEN '离岗' ELSE '待审核' END) AS IsUsedName,
|
||||
Person.IsCardUsed,
|
||||
(CASE Person.IsCardUsed WHEN 'TRUE' THEN '是' ELSE '否' END) AS IsCardUsedName,
|
||||
Person.PersonIndex,
|
||||
Project.ProjectCode,
|
||||
Project.ProjectName,
|
||||
Unit.UnitCode,
|
||||
Unit.UnitName,
|
||||
TeamGroup.TeamGroupName,
|
||||
--WorkArea.UnitWorkCode AS WorkAreaCode,
|
||||
WorkAreaCode= STUFF((SELECT ',' + UnitWorkCode FROM dbo.WBS_UnitWork where PATINDEX('%,' + RTRIM(UnitWorkId) + ',%',',' +Person.WorkAreaId + ',')>0 FOR XML PATH('')), 1, 1,''),
|
||||
--WorkArea.UnitWorkName AS WorkAreaName
|
||||
WorkAreaName= STUFF((SELECT ',' + UnitWorkName FROM dbo.WBS_UnitWork where PATINDEX('%,' + RTRIM(UnitWorkId) + ',%',',' +Person.WorkAreaId + ',')>0 FOR XML PATH('')), 1, 1,''),
|
||||
Post.WorkPostName,
|
||||
Position.PositionName,
|
||||
Title.PostTitleName,
|
||||
Depart.DepartName,
|
||||
Post.PostType,
|
||||
Post.IsHsse,
|
||||
(SELECT COUNT(*) FROM EduTrain_TrainRecordDetail T WHERE T.PersonId=Person.PersonId) AS TrainCount,
|
||||
Person.AuditorId,
|
||||
sysUser.UserName AS AuditorName,
|
||||
Person.AuditorDate,
|
||||
Person.IDCardUrl,
|
||||
Person.IsForeign,
|
||||
case when Person.IsForeign=1 then '是' else '否' end as IsForeignStr,
|
||||
Person.IdcardType,
|
||||
BasicData1.dictName as IdcardTypeName,
|
||||
Person.IdcardStartDate,
|
||||
Person.IdcardEndDate,
|
||||
Person.IdcardForever,
|
||||
case when Person.IdcardForever='Y' then '是' else '否' end as IdcardForeverStr,
|
||||
Person.PoliticsStatus,
|
||||
BasicData2.dictName as PoliticsStatusName,
|
||||
Person.IdcardAddress,
|
||||
Person.Nation,
|
||||
BasicData3.dictName as NationName,
|
||||
Person.EduLevel,
|
||||
BasicData4.dictName as EduLevelName,
|
||||
Person.MaritalStatus,
|
||||
BasicData5.dictName as MaritalStatusName,
|
||||
Person.CountryCode,
|
||||
Country.cname as CountryName,
|
||||
Person.ProvinceCode,
|
||||
City.cname as ProvinceName,
|
||||
Person.MainCNProfessionalId,
|
||||
CNProfessional.ProfessionalName as MainCNProfessionalName,
|
||||
Person.ViceCNProfessionalId,
|
||||
'' as ViceCNProfessionalName,
|
||||
Person.IsOutside,
|
||||
case when Person.IsOutside=1 then '是' else '否' end as IsOutsideStr
|
||||
FROM SitePerson_Person AS Person
|
||||
LEFT JOIN Base_Project AS Project ON Project.ProjectId=Person.ProjectId
|
||||
LEFT JOIN Base_Unit AS Unit ON Unit.UnitId = Person.UnitId
|
||||
LEFT JOIN ProjectData_TeamGroup AS TeamGroup ON TeamGroup.TeamGroupId=Person.TeamGroupId
|
||||
--LEFT JOIN WBS_UnitWork AS WorkArea ON WorkArea.UnitWorkId = Person.WorkAreaId
|
||||
LEFT JOIN Base_WorkPost AS Post ON Post.WorkPostId = Person.WorkPostId
|
||||
LEFT JOIN Base_Position AS Position ON Position.PositionId = Person.PositionId
|
||||
Left JOIN Base_PostTitle AS Title ON Title.PostTitleId = Person.PostTitleId
|
||||
Left JOIN Base_Depart AS Depart ON Depart.DepartId = Person.DepartId
|
||||
Left JOIN Sys_User AS sysUser ON sysUser.UserId = Person.AuditorId
|
||||
Left JOIN RealName_BasicData AS BasicData1 ON BasicData1.dictCode = Person.IdcardType
|
||||
Left JOIN RealName_BasicData AS BasicData2 ON BasicData2.dictCode = Person.PoliticsStatus
|
||||
Left JOIN RealName_BasicData AS BasicData3 ON BasicData3.dictCode = Person.Nation
|
||||
Left JOIN RealName_BasicData AS BasicData4 ON BasicData4.dictCode = Person.EduLevel
|
||||
Left JOIN RealName_BasicData AS BasicData5 ON BasicData5.dictCode = Person.MaritalStatus
|
||||
Left JOIN RealName_Country AS Country ON Country.CountryId = Person.CountryCode
|
||||
Left JOIN RealName_City AS City ON City.provinceCode = Person.ProvinceCode
|
||||
Left JOIN Base_CNProfessional AS CNProfessional ON CNProfessional.CNProfessionalId = Person.MainCNProfessionalId
|
||||
|
||||
|
||||
|
||||
GO
|
||||
|
||||
|
Loading…
Reference in New Issue