SGGL_JT/DataBase/版本日志/SGGLDB_2025-12-15-xiaj(View...

57 lines
2.0 KiB
Transact-SQL

ALTER VIEW [dbo].[View_DCGL_CheckRectifyListFromSUB]
AS
/*子公司隐患整改单集团视图*/
SELECT CheckRectifyItem.CheckRectifyItemId
,CheckRectifyItem.CheckRectifyId
,CheckRectifyItem.NoticeItemId
,CheckRectifyItem.ConfirmMan
,CheckRectifyItem.ConfirmManName
,CheckRectifyItem.ConfirmDate
,CheckRectifyItem.OrderEndDate
,CheckRectifyItem.OrderEndPerson
,CheckRectifyItem.RealEndDate
,CheckRectifyItem.Verification
,CheckRectify.CheckRectifyCode
,CheckRectify.ProjectId
,CheckRectify.UnitId
,CheckRectify.CheckDate
,CheckRectify.IssueMan
,CheckRectify.IssueDate
,CheckRectify.HandleState
,NoticeItem.ProblemTypes AS ProblemTypes
,NoticeItem.RiskLevel AS RiskLevel
,NoticeItem.SortIndex AS SortIndex
,NoticeItem.Situation AS Situation
,'' AS WorkType
,'' AS DangerPoint
,'隐患(问题)描述:'+NoticeItem.Describe+';依据标准:'+NoticeItem.Standards+';建议:'+NoticeItem.Advice AS RiskExists
,'' AS IsProject
,'' AS CheckMan
,'' AS SubjectUnitMan
--,Table5Item.SortIndex
--,Table5Item.WorkType
--,Table5Item.DangerPoint
--,Table5Item.RiskExists
--,Table5Item.IsProject
--,Table5Item.CheckMan
--,Table5Item.SubjectUnitMan
,AttachFile.AttachFileId
,AttachFile.ToKeyId
,AttachFile.AttachSource
,AttachFile.AttachUrl
,AttachFile2.AttachFileId AS AttachFileId2
,AttachFile2.ToKeyId AS ToKeyId2
,AttachFile2.AttachSource AS AttachSource2
,AttachFile2.AttachUrl AS AttachUrl2
FROM dbo.DCGL_Check_CheckRectifyItem AS CheckRectifyItem
LEFT JOIN dbo.DCGL_Check_CheckRectify AS CheckRectify ON CheckRectifyItem.CheckRectifyid=CheckRectify.CheckRectifyId
--LEFT JOIN dbo.Check_CheckInfo_Table5Item as Table5Item on CheckRectifyItem.Table5ItemId=Table5Item.ID
LEFT JOIN DCGL_Check_CheckInfo_TableNoticeItem AS NoticeItem ON CheckRectifyItem.NoticeItemId=NoticeItem.ID
LEFT JOIN dbo.AttachFile AS AttachFile on AttachFile.ToKeyId =CheckRectifyItem.NoticeItemId
LEFT JOIN dbo.AttachFile AS AttachFile2 on AttachFile2.ToKeyId =CheckRectifyItem.CheckRectifyItemId
GO