跳至内容
- — 2项目ID、项目名称、项目开始时间、项目结束时间、项目负责人、项目进度、项目状态、所量产品名称、研发需求数量、项
- — 目预算、研发需求总耗时(预计)、研发需求总耗时(实际)、待评审需求、以评审待开发需求、开发中雾求、开发结束票
- — 求(数量、预计耗时、实际耗时)
- select
- distinct
- result1.id, — 项目id
- result1.name, — 项目名称
- result1.lifetime,– 项目周期
- result1.realBegan, — 项目开始时间
- result1.realEnd,– 项目结束时间
- result1.PO, — 项目负责人
- result1.progress, — 项目进度
- result1.status, — 项目状态
- result1.zt_name, — 所属产品名称
- count(result1.story) over(partition by result1.id) stories, — 研发需求总数
- result1.budget, — 项目预算
- sum(result1.estimate) over(partition by result1.id) estimate_sum, — 研发需求总耗时(预计)
- sum((TIMESTAMPDIFF(day,result1.began_time,result1.end_time))*5*8/7) over(partition by result1.id) truetime_sum , — 研发需求实际耗时(实际)
- sum(result1.draftStories) over(partition by result1.id) dpsxq_sum , — 待评审需求 当前先关注每行的需求状态 0 , 1. 后续需要关注不同状态的数量,累计预计耗时,累计实际耗时
- sum(result1.finishedStories) over(partition by result1.id) ypsxq_sum , — 已评审待开发需求 当前先关注每行的需求状态 0 , 1 后续需要关注不同状态的数量,累计预计耗时,累计实际耗时
- sum(result1.activeStories) over(partition by result1.id) kfzxq_sum , — 开发中需求 当前先关注每行的需求状态 0 , 1 后续需要关注不同状态的数量,累计预计耗时,累计实际耗时
- sum(result1.closedStories) over(partition by result1.id) kfjsxq_sum — 开发结束需求 当前先关注每行的需求状态 0 , 1 后续需要关注不同状态的数量,累计预计耗时,累计实际耗时
- from (
- select
- zp.id , — 项目id
- zp.name , — 项目名称
- zp.lifetime , — 项目周期
- zp.realBegan , — 项目开始时间
- zp.realEnd , — 项目结束时间
- zp.PO , — 项目负责人
- zp.progress , — 项目进度
- zp.status , — 项目状态
- zt.name as zt_name , — 所属产品名称
- zps.story , — 研发需求列表(后续需统计count值,才能得到研发需求总数)
- zp.budget , — 项目预算
- zp.estimate , — 研发需求耗时(预计),需要按项目id分组,求sum和才能得到 研发需求总耗时(预计)
- case when cast(zp.realBegan as char) = ‘0000-00-00’ then now()
- when zp.realBegan is NULL then now()
- else zp.realBegan
- end began_time, — 实际开始时间
- case when cast(zp.realEnd as char ) = ‘0000-00-00’ then now()
- when zp.realEnd is NULL then now()
- else zp.realEnd
- end end_time , — 实际结束时间 — 项目总耗时需要用实际开始时间 和 实际结束时间求差值。再减去周末的时间,才能得到实际总耗时
- case when zt.draftStories > 0 then 1 else 0 end draftStories , — 待评审需求 当前先关注每行的需求状态 0 , 1. 后续需要关注不同状态的数量,累计预计耗时,累计实际耗时
- case when zt.finishedStories > 0 then 1 else 0 end finishedStories , — 已评审待开发需求 当前先关注每行的需求状态 0 , 1 后续需要关注不同状态的数量,累计预计耗时,累计实际耗时
- case when zt.activeStories > 0 then 1 else 0 end activeStories , — 开发中需求 当前先关注每行的需求状态 0 , 1 后续需要关注不同状态的数量,累计预计耗时,累计实际耗时
- case when zt.closedStories > 0 then 1 else 0 end closedStories — 开发结束需求 当前先关注每行的需求状态 0 , 1 后续需要关注不同状态的数量,累计预计耗时,累计实际耗时
- from zt_project zp
- left join zt_projectproduct zpp
- on zp.id = zpp.project
- left join zt_product zt
- on zpp.product = zt.id
- left join zt_projectstory zps
- on zp.id = zps.project
- and zps.product = zpp.product ) result1