修改待办存储过程

This commit is contained in:
高飞 2023-07-04 16:30:48 +08:00
parent 96825ce046
commit 2acaf7721b
1 changed files with 46 additions and 0 deletions

View File

@ -0,0 +1,46 @@
--
ALTER PROCEDURE [dbo].[Sp_Project_GetToDoItems]
@projectId NVARCHAR(50)=NULL,
@personId NVARCHAR(200)=NULL
AS
/*获取当前人本部待办事项*/
BEGIN
SELECT CostManageId AS DataId
,'HSE费用申请' AS MenuName
,('HSE费用申请'+ CONVERT(varchar(100),CostManage.CostManageDate, 23)+'待处理。') AS Content
,PersonId
,persons.PersonName
,CostManage.CostManageDate AS DataTime
,CONVERT(varchar(100),CostManage.CostManageDate, 23) AS DataTimeStr
,(CASE WHEN CostManage.States = '0' THEN '../HSSE/CostGoods/CostManageEdit.aspx?CostManageId='+CostManageId
ELSE '../HSSE/CostGoods/CostManageAudit.aspx?CostManageId='+CostManageId END)AS PCUrl
FROM CostGoods_CostManage AS CostManage
LEFT JOIN Person_Persons AS persons ON CostManage.NextManId= persons.PersonId
WHERE CostManage.ProjectId=@projectId AND (CostManage.States = '0' or CostManage.States='1' )
AND CostManage.NextManId =@personId
UNION ALL
SELECT ActionPlan.ActionPlanListId AS DataId
,'安全实施计划' AS MenuName
,('安全实施计划'+ CONVERT(varchar(100),ActionPlan.CompileDate, 23)+'待处理。')+'待处理' AS Content
,approve.ApproveMan AS PersonId
,persons.PersonName
,CompileDate AS DataTime
,CONVERT(varchar(100),CompileDate, 23) AS DataTimeStr
,'../HSSE/ActionPlan/ActionPlanListEdit.aspx?ActionPlanListId='+ActionPlan.ActionPlanListId AS PCUrl
FROM ActionPlan_ActionPlanList AS ActionPlan
LEFT JOIN ActionPlan_ActionPlanListApprove as approve on ActionPlan.ActionPlanListId=approve.ActionPlanListId and ApproveType!='S' and approve.ApproveMan=@personId and ApproveDate is null
LEFT JOIN Person_Persons AS persons ON persons.PersonId =approve.ApproveMan
WHERE ActionPlan.ProjectId=@projectId and ActionPlan.ActionPlanListId in (select ActionPlanListId from dbo.ActionPlan_ActionPlanListApprove
where PersonId=@PersonId and ApproveDate is null and ApproveType!='S')
ORDER BY DataTime DESC
END
GO