46 lines
2.2 KiB
Transact-SQL
46 lines
2.2 KiB
Transact-SQL
CREATE VIEW [dbo].[View_Hazard_HazardRegisterList]
|
|
AS
|
|
/**********°²È«Ñ²¼ìÊÓͼ*************/
|
|
SELECT Registration.ProjectId,
|
|
Registration.HazardRegisterId,
|
|
Registration.ResponsibleUnit,
|
|
Registration.CheckTime,
|
|
Registration.ProblemTypes,
|
|
User2.PersonName AS CheckManName,
|
|
RegisterTypes.RegisterTypesName,
|
|
ISNULL(WorkArea.UnitWorkName,'') AS WorkAreaName,
|
|
Unit.UnitName AS ResponsibilityUnitName,
|
|
Registration.RectificationTime,
|
|
Registration.states,
|
|
Registration.RegisterDef,
|
|
Registration.HazardValue,
|
|
Registration.RegisterTypes2Id ,
|
|
RegisterTypes2.RegisterTypesName as RegisterTypes2Name,
|
|
Registration.RegisterTypes3Id ,
|
|
RegisterTypes3.RegisterTypesName as RegisterTypes3Name,
|
|
Registration.RegisterTypes4Id ,
|
|
RegisterTypes4.RegisterTypesName as RegisterTypes4Name,
|
|
User1.PersonName AS ResponsibilityManName,
|
|
User2.UnitId AS SendUnitId,
|
|
Registration.Rectification,
|
|
Registration.RectificationPeriod,
|
|
Registration.RegisterDate,
|
|
(CASE WHEN Registration.states='1' and (Registration.SafeSupervisionIsOK is null OR Registration.SafeSupervisionIsOK=0) THEN '´ýÕû¸Ä'
|
|
WHEN Registration.states='1' and Registration.SafeSupervisionIsOK=1 THEN 'ºÏ¸ñ'
|
|
WHEN Registration.states='2' THEN 'ÒÑÕû¸Ä'
|
|
WHEN Registration.states='3' THEN 'Òѱջ·' ELSE 'ÒÑ×÷·Ï' END ) AS StatesStr
|
|
FROM dbo.HSSE_Hazard_HazardRegister AS Registration
|
|
LEFT JOIN dbo.Base_Project AS Project ON Project.ProjectId = Registration.ProjectId
|
|
LEFT JOIN dbo.HSSE_Hazard_HazardRegisterTypes AS RegisterTypes ON RegisterTypes.RegisterTypesId = Registration.RegisterTypesId
|
|
LEFT JOIN dbo.HSSE_Hazard_HazardRegisterTypes AS RegisterTypes2 ON RegisterTypes2.RegisterTypesId = Registration.RegisterTypes2Id
|
|
LEFT JOIN dbo.HSSE_Hazard_HazardRegisterTypes AS RegisterTypes3 ON RegisterTypes3.RegisterTypesId = Registration.RegisterTypes3Id
|
|
LEFT JOIN dbo.HSSE_Hazard_HazardRegisterTypes AS RegisterTypes4 ON RegisterTypes4.RegisterTypesId = Registration.RegisterTypes4Id
|
|
LEFT JOIN dbo.Base_Unit AS Unit ON Unit.UnitId = Registration.ResponsibleUnit
|
|
LEFT JOIN dbo.Person_Persons AS User1 ON User1.PersonId = Registration.ResponsibleMan
|
|
LEFT JOIN dbo.Person_Persons AS User2 ON User2.PersonId = Registration.CheckManId
|
|
LEFT JOIN dbo.WBS_UnitWork AS WorkArea ON WorkArea.UnitWorkId = Registration.Place
|
|
|
|
GO
|
|
|
|
|