跳至内容
- — 1.产品ID、产品名称、产品开始日期、产品结束日期、产品负责人、研发需求数量、研发需求总耗时(预计)、研发需求总耗
- — 时(实)
- select
- id , — 产品id
- name , — 产品名称
- createdDate , — 产品创建时间
- closedDate , — 产品结束日期
- PO , — 产品负责人
- totalStories , — 研发需求数量
- sum(estimate) as sum_estimate , — 根据产品id分组求和,得到单个产品的总预估时长
- sum(estimate_truely) as sum_estimate_truely — 根据产品id分组求和,得到单个产品的实际总耗费时长
- from
- (
- select
- zp.id , #–产品ID
- zp.name , #–产品名称
- zp.createdDate , #–产品创建时间 产品创建时间 就是 产品开始日期 吗 ?
- zt_story_result.title , — 研发需求名字
- zp.closedDate , #–产品结束日期
- zp.PO , #–产品负责人
- zp.totalStories , #–研发需求数量
- zt_story_result.estimate , # 研发需求总耗时(预计)
- zt_story_result.estimate_truely # –研发需求总耗时(实际)
- from zt_product zp
- left join
- (
- select
- result1.product,
- result1.title,
- result1.estimate,
- result1.end_time,
- result1.start_time,
- TIMESTAMPDIFF(day,result1.start_time,result1.end_time)*5*8/7 as estimate_truely
- from
- (
- select
- zs.product , # — 所属产品id
- zs.title , # — 研发需求名称
- zs.estimate , # — 研发需求预计耗时
- — 单个研发需求实际耗时
- case
- when cast(zs.closedDate as char) = ‘0000-00-00 00:00:00’ then now()
- when zs.closedDate is null then now()
- else zs.closedDate end end_time , — 研发需求结束时间
- case
- when cast(zs.assignedDate as char) = ‘0000-00-00 00:00:00’ then zs.openedDate
- when zs.assignedDate is null then zs.openedDate else zs.assignedDate
- end start_time — 研发需求开始时间
- from zt_story zs
- ) result1
- ) zt_story_result
- on zp.id = zt_story_result.product
- ) zt_story_result2
- group by
- id , — 产品id
- name , — 产品名称
- createdDate , — 产品创建时间
- closedDate , — 产品结束日期
- PO , — 产品负责人
- totalStories — 研发需求数量