select concat(a.id)as pissueId,
ifnull(concat("EXEPD-", k.issuenum),"无父任务")as pikey,
k.SUMMARY as pisummary,
concat("EXEPD-", a.issuenum)as ikey,'子任务'as itype,
a.SUMMARY,
b.pname,
ifnull(ifnull(i.vname, e.customvalue),'版本为空')as vname,
ac.last_name,
ad.lower_parent_name,(case ad.lower_parent_name
when'org-pd-qa'then'测试'when'org-pd-frontside-h5'then'前端h5'when'org-pd-frontside-native'then'原生'when'org-pd-serverside-b'then'业务'when'org-pd-serverside-a'then'架构'when'org-pd-product'then'产物UI'else''end)as deptname,
DATE_FORMAT(a.CREATED,'%Y-%m-%d')as creatdate,
DATE_FORMAT(a.DUEDATE,'%m/%d/%Y')as enddate,
DATE_FORMAT(cd.DATEVALUE,'%m/%d/%Y')as startdate,
concat(ab.ID)as asid,
concat(ad.parent_id)as dpid,
concat(ROUND(ifnull(a.TIMESPENT,0)/3600,1))as timespent,
ab.lower_user_name asname,1as nums
from jiraissue a
join app_user ab on ab.user_key = a.ASSIGNEE
join cwd_user ac on ac.lower_user_name = ab.lower_user_name
join cwd_membership ad on ad.lower_child_name = ab.lower_user_name and ad.lower_parent_name in('org-pd-frontside-h5','org-pd-frontside-native','org-pd-serverside-a','org-pd-serverside-b','org-pd-qa','org-pd-product')join issuestatus b on b.ID = a.issuestatus
leftjoin nodeassociation f on f.SOURCE_NODE_ID = a.ID and f.ASSOCIATION_TYPE ='IssueFixVersion'leftjoin projectversion i on i.ID = f.SINK_NODE_ID
leftjoin customfield c on c.cfname ='修正状态'leftjoin customfieldvalue d on d.CUSTOMFIELD = c.id and d.ISSUE = a.ID
leftjoin customfieldoption e on e.CUSTOMFIELD = c.ID and e.id = d.STRINGVALUE
leftjoin customfieldvalue dd on dd.CUSTOMFIELD =10400and dd.ISSUE = a.ID
leftjoin customfieldoption de on de.CUSTOMFIELD =10400and de.id = dd.STRINGVALUE
leftjoin customfield cc on cc.cfname ='开始日'leftjoin customfieldvalue cd on cd.CUSTOMFIELD = cc.id and cd.ISSUE = a.ID
leftjoin issuelink j on j.DESTINATION = a.ID
leftjoin jiraissue k on k.ID = j.SOURCE
where a.issuetype =10003and a.PROJECT =10000and a.issuestatus !=10001and a.PRIORITY<=5orderby ad.lower_parent_name,ac.last_name,cd.DATEVALUE
select concat('C_', a.id)as pissueId,
concat("EXEPD-", a.issuenum)as ikey,
k.pname as itype,
a.SUMMARY,sum((ifnull(a.TIMESPENT,0)+ ifnull(j.TIMESPENT,0))/3600)as allTimeSpent,sum(ifnull(ll.timeworked,0))/3600as cuMonthTimeSpent,
b.pname,
ifnull(ifnull((casewhen i.vname='hotfix'thennullelse i.vname end), e.customvalue),'版本为空')as vname,1as nums
from jiraissue a
join issuestatus b on b.ID = a.issuestatus
leftjoin nodeassociation f on f.SOURCE_NODE_ID = a.ID and f.ASSOCIATION_TYPE ='IssueFixVersion'leftjoin projectversion i on i.ID = f.SINK_NODE_ID
leftjoin customfield c on c.cfname ='修正状态'leftjoin customfieldvalue d on d.CUSTOMFIELD = c.id and d.ISSUE = a.ID
leftjoin customfieldoption e on e.CUSTOMFIELD = c.ID and e.id = d.STRINGVALUE
leftjoin issuelink g on g.SOURCE = a.ID and g.LINKTYPE =10100leftjoin jiraissue j on j.ID = g.DESTINATION
join issuetype k on k.id = a.issuetype
leftjoin(select l.issueid,sum(ifnull(l.timeworked,0))as timeworked
from worklog l
where date_format(l.STARTDATE,'%Y-%m')='2019-06'groupby l.issueid) ll on ll.issueid = j.ID
where a.issuenum in(1,2,3,4)and a.PROJECT =10000groupby a.ID
工时分析:
select a.id,
a.issueid,
concat('C_', ifnull(n.SOURCE, a.id))as pissueId,
a.worklogbody,(a.timeworked /3600)as wmin,(a.timeworked /3600/(case d.lower_parent_name
when'org-pd-qa'then10when'org-pd-frontside-h5'then9when'org-pd-frontside-native'then5when'org-pd-serverside-b'then12when'org-pd-serverside-a'then7when'org-pd-product'then9else''end))as wminperm,
date_format(a.STARTDATE,'%Y-%m-%d')as sdate,
date_format(a.STARTDATE,'%Y-%m')as sdm,
c.last_name,(case d.lower_parent_name
when'org-pd-qa'then'测试'when'org-pd-frontside-h5'then'前端h5'when'org-pd-frontside-native'then'原生'when'org-pd-serverside-b'then'业务'when'org-pd-serverside-a'then'架构'when'org-pd-product'then'产物UI'else''end)as deptname,
k.pname,
concat(h.pkey,'-', e.issuenum)as issuekey,
concat('https://jira.exexm.com/browse/', h.pkey,'-', e.issuenum)as issueurl,(case j.pname when'Sub-task'then'任务与子任务'when'Task'then'任务与子任务'else j.pname end)as issuetypename,-- (case j.pname when 'Sub-task' then '子任务' when 'Task' then '任务' else j.pname end) as issuetypename,
e.SUMMARY,-- ifnull(ifnull(i.vname, ifnull(m.customvalue,mm.customvalue)), '版本为空') as vname,
i.vname,(casewhen(i.vname isnulland(l.STRINGVALUE isnotnullor ll.STRINGVALUE isnotnull))then'hotfix'when(i.vname isnullor i.vname='')then'版本为空'when
a.issueid =10752then'一样平常事件'when
a.issueid =18019then'规划外事件'else i.vname end)as cord
from worklog a
join app_user b on b.user_key = a.AUTHOR
join cwd_user c on c.lower_user_name = b.lower_user_name
join cwd_membership d on d.lower_child_name = b.lower_user_name and d.lower_parent_name in('org-pd-frontside-h5','org-pd-frontside-native','org-pd-serverside-a','org-pd-serverside-b','org-pd-qa','org-pd-product')join jiraissue e on e.ID = a.issueid
leftjoin nodeassociation f on f.SOURCE_NODE_ID = e.ID and f.ASSOCIATION_TYPE ='IssueFixVersion'leftjoin projectversion i on i.ID = f.SINK_NODE_ID
join issuetype j on j.id = e.issuetype
join project h on h.ID = e.PROJECT
leftjoin issuelink n on n.DESTINATION = e.ID and n.LINKTYPE =10100join issuestatus k on k.ID = e.issuestatus
leftjoin customfieldvalue l on l.CUSTOMFIELD =10025and l.ISSUE = n.SOURCE
leftjoin customfieldoption m on m.CUSTOMFIELD =10025and m.id = l.STRINGVALUE
leftjoin customfieldvalue ll on ll.CUSTOMFIELD =10025and ll.ISSUE = e.ID
leftjoin customfieldoption mm on mm.CUSTOMFIELD =10025and mm.id = ll.STRINGVALUE
where a.STARTDATE >='2019-1-1'orderby a.STARTDATE asc