From 79e01512944ddafa3f7308c2112ffd1e98d7681b Mon Sep 17 00:00:00 2001 From: songchenxuan Date: Thu, 8 Jun 2023 13:54:51 +0800 Subject: [PATCH] * Modify date 0000 to null in install sql. --- db/zentao.sql | 42 +++++++++++++++++++++--------------------- 1 file changed, 21 insertions(+), 21 deletions(-) diff --git a/db/zentao.sql b/db/zentao.sql index 7b5294150f..4bba2aa87d 100755 --- a/db/zentao.sql +++ b/db/zentao.sql @@ -14076,7 +14076,7 @@ INSERT INTO `zt_dimension`(`id`, `name`, `code`, `desc`, `createdBy`, `createdDa (3, '质量管理维度', 'quality', '', 'system', '2023-04-27 20:22:16', '', NULL, '0'); INSERT INTO `zt_pivot`(`id`, `dimension`, `group`, `name`, `desc`, `sql`, `fields`, `langs`, `vars`, `objects`, `settings`, `filters`, `step`, `stage`, `builtin`, `createdBy`, `createdDate`, `editedBy`, `editedDate`, `deleted`) VALUES -(1000, 2, '86', '{\"zh-cn\":\"\\u5b8c\\u6210\\u9879\\u76ee\\u5de5\\u671f\\u900f\\u89c6\\u8868\",\"zh-tw\":\"\",\"en\":\"\",\"de\":\"\",\"fr\":\"\"}', '', 'select\nt1.name,\nt2.1program,\nt1.begin,\nt1.end,\nt1.realBegan,\nt1.realEnd,\nt1.closedDate,\nt1.realduration,\nt1.realduration-t1.planduration duration_deviation,\nround((t1.realduration-t1.planduration)/t1.planduration,3) rate\nfrom\n(select \nname,\nsubstr(`path`,2,4) 1program,\nbegin,\nend,\nrealBegan,\nrealEnd,\nleft(closedDate,10) closedDate,\ndatediff(`end`,`begin`) planduration,\nifnull(if(left(`realEnd`,4) != \'0000\',datediff(`realEnd`,`realBegan`),datediff(`closedDate`,`realBegan`)),0) realduration\nfrom\nzt_project\nwhere type=\'project\' and status=\'closed\' and deleted=\'0\') t1\nleft join\n(select\nid programid,\nname 1program\nfrom\nzt_project\nwhere type=\'program\' and grade=1) t2\non t1.1program=t2.programid', '{\"name\":{\"name\":\"\\u9879\\u76ee\\u540d\\u79f0\",\"object\":\"project\",\"field\":\"name\",\"type\":\"string\"},\"1program\":{\"name\":\"1program\",\"object\":\"project\",\"field\":\"1program\",\"type\":\"string\"},\"begin\":{\"name\":\"\\u8ba1\\u5212\\u5f00\\u59cb\\u65e5\\u671f\",\"object\":\"project\",\"field\":\"begin\",\"type\":\"date\"},\"end\":{\"name\":\"\\u8ba1\\u5212\\u5b8c\\u6210\\u65e5\\u671f\",\"object\":\"project\",\"field\":\"end\",\"type\":\"date\"},\"realBegan\":{\"name\":\"\\u5b9e\\u9645\\u5f00\\u59cb\\u65e5\\u671f\",\"object\":\"project\",\"field\":\"realBegan\",\"type\":\"date\"},\"realEnd\":{\"name\":\"\\u5b9e\\u9645\\u5b8c\\u6210\\u65e5\\u671f\",\"object\":\"project\",\"field\":\"realEnd\",\"type\":\"date\"},\"closedDate\":{\"name\":\"\\u5173\\u95ed\\u65e5\\u671f\",\"object\":\"project\",\"field\":\"closedDate\",\"type\":\"date\"},\"realduration\":{\"name\":\"realduration\",\"object\":\"project\",\"field\":\"realduration\",\"type\":\"number\"},\"duration_deviation\":{\"name\":\"duration_deviation\",\"object\":\"project\",\"field\":\"duration_deviation\",\"type\":\"number\"},\"rate\":{\"name\":\"rate\",\"object\":\"project\",\"field\":\"rate\",\"type\":\"number\"}}', '{\"name\":{\"zh-cn\":\"\\u9879\\u76ee\\u540d\\u79f0\",\"zh-tw\":\"\",\"en\":\"\",\"de\":\"\",\"fr\":\"\"},\"1program\":{\"zh-cn\":\"\\u4e00\\u7ea7\\u9879\\u76ee\\u96c6\",\"zh-tw\":\"\",\"en\":\"\",\"de\":\"\",\"fr\":\"\"},\"begin\":{\"zh-cn\":\"\\u8ba1\\u5212\\u5f00\\u59cb\\u65e5\\u671f\",\"zh-tw\":\"\",\"en\":\"\",\"de\":\"\",\"fr\":\"\"},\"end\":{\"zh-cn\":\"\\u8ba1\\u5212\\u5b8c\\u6210\\u65e5\\u671f\",\"zh-tw\":\"\",\"en\":\"\",\"de\":\"\",\"fr\":\"\"},\"realBegan\":{\"zh-cn\":\"\\u5b9e\\u9645\\u5f00\\u59cb\\u65e5\\u671f\",\"zh-tw\":\"\",\"en\":\"\",\"de\":\"\",\"fr\":\"\"},\"realEnd\":{\"zh-cn\":\"\\u5b9e\\u9645\\u5b8c\\u6210\\u65e5\\u671f\",\"zh-tw\":\"\",\"en\":\"\",\"de\":\"\",\"fr\":\"\"},\"closedDate\":{\"zh-cn\":\"\\u5173\\u95ed\\u65e5\\u671f\",\"zh-tw\":\"\",\"en\":\"\",\"de\":\"\",\"fr\":\"\"},\"realduration\":{\"zh-cn\":\"\\u5b9e\\u9645\\u5de5\\u671f\",\"zh-tw\":\"\",\"en\":\"\",\"de\":\"\",\"fr\":\"\"},\"duration_deviation\":{\"zh-cn\":\"\\u5de5\\u671f\\u504f\\u5dee\",\"zh-tw\":\"\",\"en\":\"\",\"de\":\"\",\"fr\":\"\"},\"rate\":{\"zh-cn\":\"\\u5de5\\u671f\\u504f\\u5dee\\u7387\",\"zh-tw\":\"\",\"en\":\"\",\"de\":\"\",\"fr\":\"\"}}', '', '', '{\"columns\":[{\"field\":\"begin\",\"stat\":\"sum\",\"slice\":\"noSlice\",\"showMode\":\"default\",\"monopolize\":\"0\",\"showTotal\":\"noShow\"},{\"field\":\"end\",\"stat\":\"sum\",\"slice\":\"noSlice\",\"showMode\":\"default\",\"monopolize\":\"0\",\"showTotal\":\"noShow\"},{\"field\":\"realBegan\",\"stat\":\"sum\",\"slice\":\"noSlice\",\"showMode\":\"default\",\"monopolize\":\"0\",\"showTotal\":\"noShow\"},{\"field\":\"realEnd\",\"stat\":\"sum\",\"slice\":\"noSlice\",\"showMode\":\"default\",\"monopolize\":\"0\",\"showTotal\":\"noShow\"},{\"field\":\"closedDate\",\"stat\":\"sum\",\"slice\":\"noSlice\",\"showMode\":\"default\",\"monopolize\":\"0\",\"showTotal\":\"noShow\"},{\"field\":\"realduration\",\"stat\":\"sum\",\"slice\":\"noSlice\",\"showMode\":\"default\",\"monopolize\":\"0\",\"showTotal\":\"noShow\"},{\"field\":\"duration_deviation\",\"stat\":\"sum\",\"slice\":\"noSlice\",\"showMode\":\"default\",\"monopolize\":\"0\",\"showTotal\":\"noShow\"},{\"field\":\"rate\",\"stat\":\"sum\",\"slice\":\"noSlice\",\"showMode\":\"default\",\"monopolize\":\"0\",\"showTotal\":\"noShow\"}],\"group3\":\"1program\",\"group6\":\"name\",\"lastStep\":\"4\"}', '[]', 0, 'published', '1', 'admin', '2023-04-06 14:07:26', 'admin', '2023-04-06 14:07:26', '0'), +(1000, 2, '86', '{\"zh-cn\":\"\\u5b8c\\u6210\\u9879\\u76ee\\u5de5\\u671f\\u900f\\u89c6\\u8868\",\"zh-tw\":\"\",\"en\":\"\",\"de\":\"\",\"fr\":\"\"}', '', 'select\nt1.name,\nt2.1program,\nt1.begin,\nt1.end,\nt1.realBegan,\nt1.realEnd,\nt1.closedDate,\nt1.realduration,\nt1.realduration-t1.planduration duration_deviation,\nround((t1.realduration-t1.planduration)/t1.planduration,3) rate\nfrom\n(select \nname,\nsubstr(`path`,2,4) 1program,\nbegin,\nend,\nrealBegan,\nrealEnd,\nleft(closedDate,10) closedDate,\ndatediff(`end`,`begin`) planduration,\nifnull(if(`realEnd` != null,datediff(`realEnd`,`realBegan`),datediff(`closedDate`,`realBegan`)),0) realduration\nfrom\nzt_project\nwhere type=\'project\' and status=\'closed\' and deleted=\'0\') t1\nleft join\n(select\nid programid,\nname 1program\nfrom\nzt_project\nwhere type=\'program\' and grade=1) t2\non t1.1program=t2.programid', '{\"name\":{\"name\":\"\\u9879\\u76ee\\u540d\\u79f0\",\"object\":\"project\",\"field\":\"name\",\"type\":\"string\"},\"1program\":{\"name\":\"1program\",\"object\":\"project\",\"field\":\"1program\",\"type\":\"string\"},\"begin\":{\"name\":\"\\u8ba1\\u5212\\u5f00\\u59cb\\u65e5\\u671f\",\"object\":\"project\",\"field\":\"begin\",\"type\":\"date\"},\"end\":{\"name\":\"\\u8ba1\\u5212\\u5b8c\\u6210\\u65e5\\u671f\",\"object\":\"project\",\"field\":\"end\",\"type\":\"date\"},\"realBegan\":{\"name\":\"\\u5b9e\\u9645\\u5f00\\u59cb\\u65e5\\u671f\",\"object\":\"project\",\"field\":\"realBegan\",\"type\":\"date\"},\"realEnd\":{\"name\":\"\\u5b9e\\u9645\\u5b8c\\u6210\\u65e5\\u671f\",\"object\":\"project\",\"field\":\"realEnd\",\"type\":\"date\"},\"closedDate\":{\"name\":\"\\u5173\\u95ed\\u65e5\\u671f\",\"object\":\"project\",\"field\":\"closedDate\",\"type\":\"date\"},\"realduration\":{\"name\":\"realduration\",\"object\":\"project\",\"field\":\"realduration\",\"type\":\"number\"},\"duration_deviation\":{\"name\":\"duration_deviation\",\"object\":\"project\",\"field\":\"duration_deviation\",\"type\":\"number\"},\"rate\":{\"name\":\"rate\",\"object\":\"project\",\"field\":\"rate\",\"type\":\"number\"}}', '{\"name\":{\"zh-cn\":\"\\u9879\\u76ee\\u540d\\u79f0\",\"zh-tw\":\"\",\"en\":\"\",\"de\":\"\",\"fr\":\"\"},\"1program\":{\"zh-cn\":\"\\u4e00\\u7ea7\\u9879\\u76ee\\u96c6\",\"zh-tw\":\"\",\"en\":\"\",\"de\":\"\",\"fr\":\"\"},\"begin\":{\"zh-cn\":\"\\u8ba1\\u5212\\u5f00\\u59cb\\u65e5\\u671f\",\"zh-tw\":\"\",\"en\":\"\",\"de\":\"\",\"fr\":\"\"},\"end\":{\"zh-cn\":\"\\u8ba1\\u5212\\u5b8c\\u6210\\u65e5\\u671f\",\"zh-tw\":\"\",\"en\":\"\",\"de\":\"\",\"fr\":\"\"},\"realBegan\":{\"zh-cn\":\"\\u5b9e\\u9645\\u5f00\\u59cb\\u65e5\\u671f\",\"zh-tw\":\"\",\"en\":\"\",\"de\":\"\",\"fr\":\"\"},\"realEnd\":{\"zh-cn\":\"\\u5b9e\\u9645\\u5b8c\\u6210\\u65e5\\u671f\",\"zh-tw\":\"\",\"en\":\"\",\"de\":\"\",\"fr\":\"\"},\"closedDate\":{\"zh-cn\":\"\\u5173\\u95ed\\u65e5\\u671f\",\"zh-tw\":\"\",\"en\":\"\",\"de\":\"\",\"fr\":\"\"},\"realduration\":{\"zh-cn\":\"\\u5b9e\\u9645\\u5de5\\u671f\",\"zh-tw\":\"\",\"en\":\"\",\"de\":\"\",\"fr\":\"\"},\"duration_deviation\":{\"zh-cn\":\"\\u5de5\\u671f\\u504f\\u5dee\",\"zh-tw\":\"\",\"en\":\"\",\"de\":\"\",\"fr\":\"\"},\"rate\":{\"zh-cn\":\"\\u5de5\\u671f\\u504f\\u5dee\\u7387\",\"zh-tw\":\"\",\"en\":\"\",\"de\":\"\",\"fr\":\"\"}}', '', '', '{\"columns\":[{\"field\":\"begin\",\"stat\":\"sum\",\"slice\":\"noSlice\",\"showMode\":\"default\",\"monopolize\":\"0\",\"showTotal\":\"noShow\"},{\"field\":\"end\",\"stat\":\"sum\",\"slice\":\"noSlice\",\"showMode\":\"default\",\"monopolize\":\"0\",\"showTotal\":\"noShow\"},{\"field\":\"realBegan\",\"stat\":\"sum\",\"slice\":\"noSlice\",\"showMode\":\"default\",\"monopolize\":\"0\",\"showTotal\":\"noShow\"},{\"field\":\"realEnd\",\"stat\":\"sum\",\"slice\":\"noSlice\",\"showMode\":\"default\",\"monopolize\":\"0\",\"showTotal\":\"noShow\"},{\"field\":\"closedDate\",\"stat\":\"sum\",\"slice\":\"noSlice\",\"showMode\":\"default\",\"monopolize\":\"0\",\"showTotal\":\"noShow\"},{\"field\":\"realduration\",\"stat\":\"sum\",\"slice\":\"noSlice\",\"showMode\":\"default\",\"monopolize\":\"0\",\"showTotal\":\"noShow\"},{\"field\":\"duration_deviation\",\"stat\":\"sum\",\"slice\":\"noSlice\",\"showMode\":\"default\",\"monopolize\":\"0\",\"showTotal\":\"noShow\"},{\"field\":\"rate\",\"stat\":\"sum\",\"slice\":\"noSlice\",\"showMode\":\"default\",\"monopolize\":\"0\",\"showTotal\":\"noShow\"}],\"group3\":\"1program\",\"group6\":\"name\",\"lastStep\":\"4\"}', '[]', 0, 'published', '1', 'admin', '2023-04-06 14:07:26', 'admin', '2023-04-06 14:07:26', '0'), (1001, 2, '85', '{\"zh-cn\":\"\\u5b8c\\u6210\\u9879\\u76ee\\u5de5\\u65f6\\u900f\\u89c6\\u8868\",\"zh-tw\":\"\",\"en\":\"\",\"de\":\"\",\"fr\":\"\"}', '', 'select\nt1.name \"项目名称\",\nt4.1program \"一级项目集\",\nround(t2.estimate,2) \"预计工时\",\nround(t2.consumed,2) \"消耗工时\",\nround(t2.consumed-t2.estimate,2) \"工时偏差\",\nround((t2.consumed-t2.estimate)/t2.estimate,2) \"工时偏差率\",\nifnull(t3.storys,0) \"完成需求数\",\nifnull(t3.storyestimate,0) \"完成需求规模数\",\nround(ifnull(t3.storyestimate,0)/ifnull(t2.consumed,0),2) \"单位时间交付需求规模数\",\nt1.closedDate closedDate\nfrom(\nselect\nid,\nname,\nsubstr(`path`,2,4) 1program,\nclosedDate\nfrom\nzt_project\nwhere deleted=\'0\' and type=\'project\' and status=\'closed\') t1\nleft join(\nselect\nproject,\nsum(estimate) estimate,\nsum(consumed) consumed\nfrom\nzt_task\nwhere deleted=\'0\' and project !=0\ngroup by project) t2\non t1.id=t2.project\nleft join (\nselect\ntt3.project,\ncount(tt3.id) storys,\nsum(estimate) storyestimate\nfrom(\nselect\ntt1.id,\ntt1.estimate,\ntt2.project\nfrom\nzt_story tt1\nleft join\nzt_projectstory tt2\non tt1.id=tt2.story\nwhere tt1.deleted=\'0\' and tt1.status=\'closed\' and tt1.closedReason=\'done\') tt3\ngroup by tt3.project) t3\non t1.id=t3.project\nleft join\n(select\nid programid,\nname 1program\nfrom\nzt_project\nwhere type=\'program\' and grade=1) t4\non t1.1program=t4.programid', '{\"\\u9879\\u76ee\\u540d\\u79f0\":{\"name\":\"\\u9879\\u76ee\\u540d\\u79f0\",\"object\":\"project\",\"field\":\"\\u9879\\u76ee\\u540d\\u79f0\",\"type\":\"string\"},\"\\u4e00\\u7ea7\\u9879\\u76ee\\u96c6\":{\"name\":\"\\u4e00\\u7ea7\\u9879\\u76ee\\u96c6\",\"object\":\"project\",\"field\":\"\\u4e00\\u7ea7\\u9879\\u76ee\\u96c6\",\"type\":\"string\"},\"\\u9884\\u8ba1\\u5de5\\u65f6\":{\"name\":\"\\u9884\\u8ba1\\u5de5\\u65f6\",\"object\":\"project\",\"field\":\"\\u9884\\u8ba1\\u5de5\\u65f6\",\"type\":\"number\"},\"\\u6d88\\u8017\\u5de5\\u65f6\":{\"name\":\"\\u6d88\\u8017\\u5de5\\u65f6\",\"object\":\"project\",\"field\":\"\\u6d88\\u8017\\u5de5\\u65f6\",\"type\":\"number\"},\"\\u5de5\\u65f6\\u504f\\u5dee\":{\"name\":\"\\u5de5\\u65f6\\u504f\\u5dee\",\"object\":\"project\",\"field\":\"\\u5de5\\u65f6\\u504f\\u5dee\",\"type\":\"number\"},\"\\u5de5\\u65f6\\u504f\\u5dee\\u7387\":{\"name\":\"\\u5de5\\u65f6\\u504f\\u5dee\\u7387\",\"object\":\"project\",\"field\":\"\\u5de5\\u65f6\\u504f\\u5dee\\u7387\",\"type\":\"number\"},\"\\u5b8c\\u6210\\u9700\\u6c42\\u6570\":{\"name\":\"\\u5b8c\\u6210\\u9700\\u6c42\\u6570\",\"object\":\"project\",\"field\":\"\\u5b8c\\u6210\\u9700\\u6c42\\u6570\",\"type\":\"string\"},\"\\u5b8c\\u6210\\u9700\\u6c42\\u89c4\\u6a21\\u6570\":{\"name\":\"\\u5b8c\\u6210\\u9700\\u6c42\\u89c4\\u6a21\\u6570\",\"object\":\"project\",\"field\":\"\\u5b8c\\u6210\\u9700\\u6c42\\u89c4\\u6a21\\u6570\",\"type\":\"number\"},\"\\u5355\\u4f4d\\u65f6\\u95f4\\u4ea4\\u4ed8\\u9700\\u6c42\\u89c4\\u6a21\\u6570\":{\"name\":\"\\u5355\\u4f4d\\u65f6\\u95f4\\u4ea4\\u4ed8\\u9700\\u6c42\\u89c4\\u6a21\\u6570\",\"object\":\"project\",\"field\":\"\\u5355\\u4f4d\\u65f6\\u95f4\\u4ea4\\u4ed8\\u9700\\u6c42\\u89c4\\u6a21\\u6570\",\"type\":\"number\"},\"closedDate\":{\"name\":\"\\u5173\\u95ed\\u65e5\\u671f\",\"object\":\"project\",\"field\":\"closedDate\",\"type\":\"date\"}}', '', '', '', '{\"columns\":[{\"field\":\"\\u9884\\u8ba1\\u5de5\\u65f6\",\"stat\":\"sum\",\"slice\":\"noSlice\",\"showMode\":\"default\",\"monopolize\":\"0\",\"showTotal\":\"noShow\"},{\"field\":\"\\u6d88\\u8017\\u5de5\\u65f6\",\"stat\":\"sum\",\"slice\":\"noSlice\",\"showMode\":\"default\",\"monopolize\":\"0\",\"showTotal\":\"noShow\"},{\"field\":\"\\u5de5\\u65f6\\u504f\\u5dee\",\"stat\":\"sum\",\"slice\":\"noSlice\",\"showMode\":\"default\",\"monopolize\":\"0\",\"showTotal\":\"noShow\"},{\"field\":\"\\u5de5\\u65f6\\u504f\\u5dee\\u7387\",\"stat\":\"sum\",\"slice\":\"noSlice\",\"showMode\":\"default\",\"monopolize\":\"0\",\"showTotal\":\"noShow\"},{\"field\":\"\\u5b8c\\u6210\\u9700\\u6c42\\u6570\",\"stat\":\"sum\",\"slice\":\"noSlice\",\"showMode\":\"default\",\"monopolize\":\"0\",\"showTotal\":\"noShow\"},{\"field\":\"\\u5b8c\\u6210\\u9700\\u6c42\\u89c4\\u6a21\\u6570\",\"stat\":\"sum\",\"slice\":\"noSlice\",\"showMode\":\"default\",\"monopolize\":\"0\",\"showTotal\":\"noShow\"},{\"field\":\"\\u5355\\u4f4d\\u65f6\\u95f4\\u4ea4\\u4ed8\\u9700\\u6c42\\u89c4\\u6a21\\u6570\",\"stat\":\"sum\",\"slice\":\"noSlice\",\"showMode\":\"default\",\"monopolize\":\"0\",\"showTotal\":\"noShow\"}],\"columnTotal\":\"noShow\",\"group1\":\"\\u4e00\\u7ea7\\u9879\\u76ee\\u96c6\",\"group2\":\"\\u9879\\u76ee\\u540d\\u79f0\",\"lastStep\":\"4\"}', '[{\"field\":\"closedDate\",\"type\":\"date\",\"name\":\"\\u5173\\u95ed\\u65e5\\u671f\",\"default\":{\"begin\":\"\",\"end\":\"\"}}]', 0, 'published', '1', 'admin', '2023-04-11 13:14:37', 'admin', '2023-04-11 13:14:37', '0'), (1002, 3, '100', '{\"zh-cn\":\"\\u4ea7\\u54c1\\u7f3a\\u9677\\u6570\\u636e\\u6c47\\u603b\\u8868\",\"zh-tw\":\"\",\"en\":\"\",\"de\":\"\",\"fr\":\"\"}', '', 'SELECT \n t1.name AS \"产品\", \n IFNULL(t2.name, \'/\') AS \"一级项目集\", \n IFNULL(t3.name, \'/\') AS \"产品线\", \n IFNULL(t6.exfixedstorys, 0) AS \"研发完成需求数\", \n round(IFNULL(t6.exfixedstorysmate, 0),3) AS \"研发完成需求规模数\",\n IFNULL(t8.storycases, 0) AS \"需求用例数\",\n round(storycases/exfixedstorysmate,3) AS \"用例密度\",\n round(IFNULL(t10.casestorys/t6.exfixedstorys,0),3) AS \"用例覆盖率\",\n IFNULL(t7.bug, 0) AS \"Bug数\",\n IFNULL(t7.effbugs, 0) AS \"有效Bug数\",\n IFNULL(t7.pri12bugs, 0) AS \"优先级为1,2的Bug数\",\n round(bug/exfixedstorysmate,3) AS \"Bug密度\",\n IFNULL(t7.fixedbugs, 0) AS \"修复Bug数\",\n round(fixedbugs/bug,3) \"Bug修复率\"\nFROM \n zt_product AS t1 \n LEFT JOIN zt_project AS t2 ON t1.program = t2.id AND t2.type = \'program\' AND t2.grade = 1 \n LEFT JOIN zt_module AS t3 ON t1.line = t3.id AND t3.type = \'line\' \n LEFT JOIN (\n SELECT\n product, \n count(id) exfixedstorys, \n sum(estimate) exfixedstorysmate\n FROM zt_story \n WHERE deleted = \'0\' and (stage in (\'developed\',\'testing\',\'verfied\',\'released\') or (status=\'closed\' and closedReason=\'done\'))\n GROUP BY product) AS t6 ON t1.id = t6.product \n LEFT JOIN (SELECT product, COUNT(id) AS bug,\n SUM(case when resolution in (\'fixed\',\'postponed\') or status=\'active\' then 1 else 0 end) effbugs, \n SUM(CASE WHEN resolution=\'fixed\' then 1 else 0 end) fixedbugs,\n SUM(CASE WHEN severity in (1,2) then 1 else 0 end) pri12bugs\n FROM zt_bug WHERE deleted = \'0\' GROUP BY product) AS t7 ON t1.id = t7.product \n LEFT JOIN (SELECT product, COUNT(id) AS storycases FROM zt_case WHERE deleted=\'0\' GROUP BY product) AS t8 ON t1.id=t8.product\n LEFT JOIN (\n select \n t9.product, \n count(t9.story) casestorys\n from(\n SELECT \n zt_case.product,zt_case.story \n FROM zt_case \n left join zt_story\n on zt_case.story=zt_story.id\n WHERE zt_case.deleted=\'0\' and zt_case.story !=\'0\' and zt_story.deleted=\'0\' and (zt_story.stage in (\'developed\',\'testing\',\'verfied\',\'released\') or (zt_story.status=\'closed\' and zt_story.closedReason=\'done\'))\n GROUP BY product, story) t9\n group by product) t10\n on t1.id=t10.product\nWHERE t1.deleted = \'0\' AND t1.status != \'closed\' AND t1.shadow = \'0\'AND t1.vision = \'rnd\'\nORDER BY t1.order', '{\"\\u4ea7\\u54c1\":{\"name\":\"\\u4ea7\\u54c1\",\"object\":\"story\",\"field\":\"\\u4ea7\\u54c1\",\"type\":\"string\"},\"\\u4e00\\u7ea7\\u9879\\u76ee\\u96c6\":{\"name\":\"\\u4e00\\u7ea7\\u9879\\u76ee\\u96c6\",\"object\":\"story\",\"field\":\"\\u4e00\\u7ea7\\u9879\\u76ee\\u96c6\",\"type\":\"string\"},\"\\u4ea7\\u54c1\\u7ebf\":{\"name\":\"\\u4ea7\\u54c1\\u7ebf\",\"object\":\"story\",\"field\":\"\\u4ea7\\u54c1\\u7ebf\",\"type\":\"string\"},\"\\u7814\\u53d1\\u5b8c\\u6210\\u9700\\u6c42\\u6570\":{\"name\":\"\\u7814\\u53d1\\u5b8c\\u6210\\u9700\\u6c42\\u6570\",\"object\":\"story\",\"field\":\"\\u7814\\u53d1\\u5b8c\\u6210\\u9700\\u6c42\\u6570\",\"type\":\"string\"},\"\\u7814\\u53d1\\u5b8c\\u6210\\u9700\\u6c42\\u89c4\\u6a21\\u6570\":{\"name\":\"\\u7814\\u53d1\\u5b8c\\u6210\\u9700\\u6c42\\u89c4\\u6a21\\u6570\",\"object\":\"story\",\"field\":\"\\u7814\\u53d1\\u5b8c\\u6210\\u9700\\u6c42\\u89c4\\u6a21\\u6570\",\"type\":\"number\"},\"\\u9700\\u6c42\\u7528\\u4f8b\\u6570\":{\"name\":\"\\u9700\\u6c42\\u7528\\u4f8b\\u6570\",\"object\":\"story\",\"field\":\"\\u9700\\u6c42\\u7528\\u4f8b\\u6570\",\"type\":\"string\"},\"\\u7528\\u4f8b\\u5bc6\\u5ea6\":{\"name\":\"\\u7528\\u4f8b\\u5bc6\\u5ea6\",\"object\":\"story\",\"field\":\"\\u7528\\u4f8b\\u5bc6\\u5ea6\",\"type\":\"number\"},\"\\u7528\\u4f8b\\u8986\\u76d6\\u7387\":{\"name\":\"\\u7528\\u4f8b\\u8986\\u76d6\\u7387\",\"object\":\"story\",\"field\":\"\\u7528\\u4f8b\\u8986\\u76d6\\u7387\",\"type\":\"number\"},\"Bug\\u6570\":{\"name\":\"Bug\\u6570\",\"object\":\"story\",\"field\":\"Bug\\u6570\",\"type\":\"string\"},\"\\u6709\\u6548Bug\\u6570\":{\"name\":\"\\u6709\\u6548Bug\\u6570\",\"object\":\"story\",\"field\":\"\\u6709\\u6548Bug\\u6570\",\"type\":\"number\"},\"\\u4f18\\u5148\\u7ea7\\u4e3a1\\uff0c2\\u7684Bug\\u6570\":{\"name\":\"\\u4f18\\u5148\\u7ea7\\u4e3a1\\uff0c2\\u7684Bug\\u6570\",\"object\":\"story\",\"field\":\"\\u4f18\\u5148\\u7ea7\\u4e3a1\\uff0c2\\u7684Bug\\u6570\",\"type\":\"number\"},\"Bug\\u5bc6\\u5ea6\":{\"name\":\"Bug\\u5bc6\\u5ea6\",\"object\":\"story\",\"field\":\"Bug\\u5bc6\\u5ea6\",\"type\":\"number\"},\"\\u4fee\\u590dBug\\u6570\":{\"name\":\"\\u4fee\\u590dBug\\u6570\",\"object\":\"story\",\"field\":\"\\u4fee\\u590dBug\\u6570\",\"type\":\"number\"},\"Bug\\u4fee\\u590d\\u7387\":{\"name\":\"Bug\\u4fee\\u590d\\u7387\",\"object\":\"story\",\"field\":\"Bug\\u4fee\\u590d\\u7387\",\"type\":\"number\"}}', '', '', '', '{\"columns\":[{\"field\":\"\\u7814\\u53d1\\u5b8c\\u6210\\u9700\\u6c42\\u6570\",\"stat\":\"sum\",\"slice\":\"noSlice\",\"showMode\":\"default\",\"monopolize\":\"0\",\"showTotal\":\"noShow\"},{\"field\":\"\\u7814\\u53d1\\u5b8c\\u6210\\u9700\\u6c42\\u89c4\\u6a21\\u6570\",\"stat\":\"sum\",\"slice\":\"noSlice\",\"showMode\":\"default\",\"monopolize\":\"0\",\"showTotal\":\"noShow\"},{\"field\":\"\\u9700\\u6c42\\u7528\\u4f8b\\u6570\",\"stat\":\"sum\",\"slice\":\"noSlice\",\"showMode\":\"default\",\"monopolize\":\"0\",\"showTotal\":\"noShow\"},{\"field\":\"\\u7528\\u4f8b\\u5bc6\\u5ea6\",\"stat\":\"sum\",\"slice\":\"noSlice\",\"showMode\":\"default\",\"monopolize\":\"0\",\"showTotal\":\"noShow\"},{\"field\":\"\\u7528\\u4f8b\\u8986\\u76d6\\u7387\",\"stat\":\"sum\",\"slice\":\"noSlice\",\"showMode\":\"default\",\"monopolize\":\"0\",\"showTotal\":\"noShow\"},{\"field\":\"Bug\\u6570\",\"stat\":\"sum\",\"slice\":\"noSlice\",\"showMode\":\"default\",\"monopolize\":\"0\",\"showTotal\":\"noShow\"},{\"field\":\"\\u6709\\u6548Bug\\u6570\",\"stat\":\"sum\",\"slice\":\"noSlice\",\"showMode\":\"default\",\"monopolize\":\"0\",\"showTotal\":\"noShow\"},{\"field\":\"\\u4f18\\u5148\\u7ea7\\u4e3a1\\uff0c2\\u7684Bug\\u6570\",\"stat\":\"sum\",\"slice\":\"noSlice\",\"showMode\":\"default\",\"monopolize\":\"0\",\"showTotal\":\"noShow\"},{\"field\":\"Bug\\u5bc6\\u5ea6\",\"stat\":\"sum\",\"slice\":\"noSlice\",\"showMode\":\"default\",\"monopolize\":\"0\",\"showTotal\":\"noShow\"},{\"field\":\"\\u4fee\\u590dBug\\u6570\",\"stat\":\"sum\",\"slice\":\"noSlice\",\"showMode\":\"default\",\"monopolize\":\"0\",\"showTotal\":\"noShow\"},{\"field\":\"Bug\\u4fee\\u590d\\u7387\",\"stat\":\"sum\",\"slice\":\"noSlice\",\"showMode\":\"default\",\"monopolize\":\"0\",\"showTotal\":\"noShow\"}],\"columnTotal\":\"noShow\",\"group1\":\"\\u4e00\\u7ea7\\u9879\\u76ee\\u96c6\",\"group3\":\"\\u4ea7\\u54c1\\u7ebf\",\"group2\":\"\\u4ea7\\u54c1\",\"lastStep\":\"4\"}', '[]', 0, 'published', '1', 'admin', '2023-04-06 13:16:52', 'admin', '2023-04-06 13:16:52', '0'), (1003, 1, '59', '{\"zh-cn\":\"\\u4ea7\\u54c1\\u5b8c\\u6210\\u5ea6\\u7edf\\u8ba1\\u8868\",\"zh-tw\":\"\\u7522\\u54c1\\u5b8c\\u6210\\u5ea6\\u7d71\\u8a08\\u8868\",\"en\":\"Product Progress\",\"de\":\"Product Progress\",\"fr\":\"Product Progress\"}', '{\"zh-cn\":\"\\u6309\\u7167\\u4ea7\\u54c1\\u5217\\u51fa\\u9700\\u6c42\\u603b\\u6570\\uff0c\\u5b8c\\u6210\\u7684\\u603b\\u6570(\\u72b6\\u6001\\u662f\\u5173\\u95ed\\uff0c\\u6216\\u8005\\u7814\\u53d1\\u9636\\u6bb5\\u662f\\u53d1\\u5e03)\\uff0c\\u5b8c\\u6210\\u7684\\u767e\\u5206\\u6bd4\\u3002\",\"zh-tw\":\"\\u6309\\u7167\\u7522\\u54c1\\u5217\\u51fa\\u9700\\u6c42\\u7e3d\\u6578\\uff0c\\u5b8c\\u6210\\u7684\\u7e3d\\u6578(\\u72c0\\u614b\\u662f\\u95dc\\u9589\\uff0c\\u6216\\u8005\\u7814\\u767c\\u968e\\u6bb5\\u662f\\u767c\\u5e03)\\uff0c\\u5b8c\\u6210\\u7684\\u767e\\u5206\\u6bd4\\u3002\",\"en\":\"Number of total stories,done stories(state is closed, or stage is released), percent of completion.\",\"de\":\"Number of total stories,done stories(state is closed, or stage is released), percent of completion.\",\"fr\":\"Number of total stories,done stories(state is closed, or stage is released), percent of completion.\"}', 'select t1.*,t2.name, (case when t1.status = \'closed\' or t1.stage = \'released\' then 1 else 0 end) as done, 1 as count from zt_story as t1 \r\nleft join zt_product as t2 on t1.product=t2.id \r\nleft join zt_project as t3 on t2.program=t3.id \r\nwhere t1.deleted=\'0\' and t2.deleted=\'0\'\r\norder by t3.`order` asc, t2.line desc, t2.`order` asc', '{\"id\":{\"object\":\"story\",\"field\":\"id\",\"type\":\"string\"},\"vision\":{\"object\":\"project\",\"field\":\"vision\",\"type\":\"string\"},\"parent\":{\"object\":\"story\",\"field\":\"parent\",\"type\":\"string\"},\"product\":{\"object\":\"story\",\"field\":\"product\",\"type\":\"string\"},\"branch\":{\"object\":\"story\",\"field\":\"branch\",\"type\":\"string\"},\"module\":{\"object\":\"story\",\"field\":\"module\",\"type\":\"string\"},\"plan\":{\"object\":\"story\",\"field\":\"plan\",\"type\":\"string\"},\"source\":{\"object\":\"story\",\"field\":\"source\",\"type\":\"string\"},\"sourceNote\":{\"object\":\"story\",\"field\":\"sourceNote\",\"type\":\"string\"},\"fromBug\":{\"object\":\"story\",\"field\":\"fromBug\",\"type\":\"string\"},\"feedback\":{\"object\":\"story\",\"field\":\"feedback\",\"type\":\"string\"},\"title\":{\"object\":\"story\",\"field\":\"title\",\"type\":\"string\"},\"keywords\":{\"object\":\"story\",\"field\":\"keywords\",\"type\":\"string\"},\"type\":{\"object\":\"story\",\"field\":\"type\",\"type\":\"string\"},\"category\":{\"object\":\"story\",\"field\":\"category\",\"type\":\"string\"},\"pri\":{\"object\":\"story\",\"field\":\"pri\",\"type\":\"string\"},\"estimate\":{\"object\":\"story\",\"field\":\"estimate\",\"type\":\"string\"},\"status\":{\"object\":\"story\",\"field\":\"status\",\"type\":\"string\"},\"subStatus\":{\"object\":\"story\",\"field\":\"subStatus\",\"type\":\"string\"},\"color\":{\"object\":\"story\",\"field\":\"color\",\"type\":\"string\"},\"stage\":{\"object\":\"story\",\"field\":\"stage\",\"type\":\"string\"},\"stagedBy\":{\"object\":\"story\",\"field\":\"stagedBy\",\"type\":\"string\"},\"mailto\":{\"object\":\"story\",\"field\":\"mailto\",\"type\":\"string\"},\"lib\":{\"object\":\"project\",\"field\":\"lib\",\"type\":\"string\"},\"fromStory\":{\"object\":\"project\",\"field\":\"fromStory\",\"type\":\"string\"},\"fromVersion\":{\"object\":\"project\",\"field\":\"fromVersion\",\"type\":\"string\"},\"openedBy\":{\"object\":\"story\",\"field\":\"openedBy\",\"type\":\"string\"},\"openedDate\":{\"object\":\"story\",\"field\":\"openedDate\",\"type\":\"string\"},\"assignedTo\":{\"object\":\"story\",\"field\":\"assignedTo\",\"type\":\"string\"},\"assignedDate\":{\"object\":\"story\",\"field\":\"assignedDate\",\"type\":\"string\"},\"approvedDate\":{\"object\":\"project\",\"field\":\"approvedDate\",\"type\":\"string\"},\"lastEditedBy\":{\"object\":\"story\",\"field\":\"lastEditedBy\",\"type\":\"string\"},\"lastEditedDate\":{\"object\":\"story\",\"field\":\"lastEditedDate\",\"type\":\"string\"},\"changedBy\":{\"object\":\"story\",\"field\":\"changedBy\",\"type\":\"string\"},\"changedDate\":{\"object\":\"story\",\"field\":\"changedDate\",\"type\":\"string\"},\"reviewedBy\":{\"object\":\"story\",\"field\":\"reviewedBy\",\"type\":\"string\"},\"reviewedDate\":{\"object\":\"story\",\"field\":\"reviewedDate\",\"type\":\"string\"},\"closedBy\":{\"object\":\"story\",\"field\":\"closedBy\",\"type\":\"string\"},\"closedDate\":{\"object\":\"story\",\"field\":\"closedDate\",\"type\":\"string\"},\"closedReason\":{\"object\":\"story\",\"field\":\"closedReason\",\"type\":\"string\"},\"activatedDate\":{\"object\":\"story\",\"field\":\"activatedDate\",\"type\":\"string\"},\"toBug\":{\"object\":\"story\",\"field\":\"toBug\",\"type\":\"string\"},\"childStories\":{\"object\":\"story\",\"field\":\"childStories\",\"type\":\"string\"},\"linkStories\":{\"object\":\"story\",\"field\":\"linkStories\",\"type\":\"string\"},\"linkRequirements\":{\"object\":\"story\",\"field\":\"linkRequirements\",\"type\":\"string\"},\"twins\":{\"object\":\"story\",\"field\":\"twins\",\"type\":\"string\"},\"duplicateStory\":{\"object\":\"story\",\"field\":\"duplicateStory\",\"type\":\"string\"},\"version\":{\"object\":\"story\",\"field\":\"version\",\"type\":\"string\"},\"storyChanged\":{\"object\":\"project\",\"field\":\"storyChanged\",\"type\":\"string\"},\"feedbackBy\":{\"object\":\"story\",\"field\":\"feedbackBy\",\"type\":\"string\"},\"notifyEmail\":{\"object\":\"story\",\"field\":\"notifyEmail\",\"type\":\"string\"},\"URChanged\":{\"object\":\"story\",\"field\":\"URChanged\",\"type\":\"string\"},\"deleted\":{\"object\":\"story\",\"field\":\"deleted\",\"type\":\"string\"},\"name\":{\"object\":\"product\",\"field\":\"name\",\"type\":\"string\"},\"done\":{\"object\":\"project\",\"field\":\"done\",\"type\":\"string\"},\"count\":{\"object\":\"project\",\"field\":\"count\",\"type\":\"string\"}}', '{\"count\":{\"zh-cn\":\"\\u9700\\u6c42\\u6570\",\"zh-tw\":\"\\u9700\\u6c42\\u6570\",\"en\":\"Stories\"},\"done\":{\"zh-cn\":\"\\u5b8c\\u6210\\u6570\",\"zh-tw\":\"\\u5b8c\\u6210\\u6570\",\"en\":\"Done\"}}', '', NULL, '{\"group1\":\"name\",\"group2\":\"\",\"columnTotal\":\"sum\",\"columns\":[{\"field\":\"count\",\"slice\":\"noSlice\",\"stat\":\"sum\",\"showTotal\":\"noShow\",\"showMode\":\"default\",\"monopolize\":\"0\"},{\"field\":\"done\",\"slice\":\"noSlice\",\"stat\":\"sum\",\"showTotal\":\"noShow\",\"showMode\":\"default\",\"monopolize\":\"1\"}]}', '', 4, 'published', '0', 'admin', '2015-07-21 15:07:48', '', NULL, '0'), @@ -14112,9 +14112,9 @@ INSERT INTO `zt_chart`(`id`, `name`, `dimension`, `type`, `group`, `dataset`, `d (1004, '年度总结-待办数', 1, 'card', '0', '', '', '{\"value\": {\"type\": \"agg\", \"field\": \"todo\", \"agg\": \"sum\"}, \"title\": {\"type\": \"text\", \"name\": \"\"},\r\n\"type\": \"value\"\r\n}', '[]', 0, '', NULL, 'SELECT sum(t2.todo) AS todo,sum(t2.undone) AS undone,sum(t2.done) AS done,t2.`year`, t1.account, realname, dept\r\nFROM zt_user t1\r\nLEFT JOIN (SELECT count(1) AS \'todo\', sum(if((`status` != \'done\'), 1, 0)) AS `undone`, sum(if((`status` = \'done\'), 1, 0)) AS `done`, account, YEAR(`date`) AS \'year\' FROM zt_todo WHERE deleted = \'0\' GROUP BY account, `year`) t2 on t1.account = t2.account \r\nWHERE t1.deleted = \'0\'\r\nGROUP BY t2.`year`, t1.account, realname, dept', 'published', 1, '', 'admin', '2022-12-07 14:59:41', '', '2022-12-07 14:59:41', 0), (1005, '年度总结-贡献数', 1, 'card', '0', '', '', '{\"value\": {\"type\": \"agg\", \"field\": \"num\", \"agg\": \"sum\"}, \"title\": {\"type\": \"text\", \"name\": \"\"},\r\n\"type\": \"value\"\r\n}', '[]', 0, '', NULL, 'select tt.year,tt.actor as account, count(1) as num from (\r\nSELECT YEAR(t1.date) as `year`, t1.actor, t1.objectType, t1.action\r\nfrom zt_action t1\r\nWHERE \r\n(\r\n(t1.objectType = \'bug\' AND t1.action in(\'resolved\',\'opened\',\'closed\',\'activated\') and (select deleted from zt_bug where id = t1.objectID) = \'0\')\r\nOR (t1.objectType = \'task\' AND t1.action in(\'finished\',\'opened\',\'closed\',\'activated\',\'assigned\') and (select deleted from zt_task where id = t1.objectID) = \'0\')\r\nOR (t1.objectType = \'story\' AND t1.action in(\'opened\',\'reviewed\',\'closed\') and (select deleted from zt_story where id = t1.objectID) = \'0\')\r\nOR (t1.objectType = \'execution\' AND t1.action in(\'opened\',\'edited\',\'started\',\'closed\') and (select deleted from zt_project where id = t1.objectID) = \'0\')\r\nOR (t1.objectType = \'product\' AND t1.action in(\'opened\',\'edited\',\'closed\') and (select deleted from zt_product where id = t1.objectID) = \'0\')\r\nOR (t1.objectType = \'case\' AND t1.action in(\'opened\',\'run\') and (select deleted from zt_case where id = t1.objectID) = \'0\')\r\nOR (t1.objectType = \'testtask\' AND t1.action in(\'opened\',\'edited\') and (select deleted from zt_testtask where id = t1.objectID) = \'0\')\r\nOR (t1.objectType = \'productplan\' AND t1.action in(\'opened\') and (select deleted from zt_productplan where id = t1.objectID) = \'0\')\r\nOR (t1.objectType = \'release\' AND t1.action in(\'opened\') and (select deleted from zt_release where id = t1.objectID) = \'0\')\r\nOR (t1.objectType = \'doc\' AND t1.action in(\'created\',\'edited\') and (select deleted from zt_doc where id = t1.objectID) = \'0\')\r\nOR (t1.objectType = \'build\' AND t1.action in(\'opened\') and (select deleted from zt_build where id = t1.objectID) = \'0\')\r\n)\r\nunion all\r\nSELECT YEAR(t1.date) as `year`, t1.actor, \'code\' as objectType, t1.action from zt_action t1\r\nwhere t1.action in (\'gitcommited\', \'svncommited\') and t1.objectType = \'task\'\r\n) tt group by actor', 'published', 1, '', 'admin', '2022-12-07 14:59:41', '', '2022-12-07 14:59:41', 0), (1006, '年度总结-贡献数据', 1, 'bar', '0', '', '', '{\r\n\"xaxis\":[{\"field\":\"objectType\",\"name\":\"对象类型\"}],\r\n\"yaxis\":[{\"type\":\"agg\",\"field\":\"create\",\"agg\":\"sum\",\"name\":\"创建\",\"valOrAgg\":\"sum\"},{\"type\":\"value\",\"field\":\"edit\",\"agg\":\"sum\",\"name\":\"编辑\",\"valOrAgg\":\"sum\"}]\r\n}', '[]', 0, '', NULL, 'SELECT t2.year, t1.dept, t2.account, t2.objectType, t2.create, t2.edit\r\nFROM zt_user AS t1\r\nLEFT JOIN\r\n(SELECT \r\n YEAR(t1.date) AS `year`, t1.actor AS account, \"产品\" AS objectType, \r\n SUM(IF(t1.action = \'opened\', 1, 0)) AS `create`, \r\n SUM(IF(t1.action = \'edited\', 1, 0)) AS `edit`\r\nFROM zt_action AS t1 \r\nLEFT JOIN zt_product AS t2 ON t1.objectID = t2.id\r\nWHERE t1.objectType = \'product\' AND t1.action IN (\'opened\', \'edited\') AND t2.deleted = \'0\'\r\nGROUP BY `year`, actor, objectType\r\nUNION ALL\r\nSELECT \r\n YEAR(t1.date) AS `year`, t1.actor, \"需求\" AS objectType, \r\n SUM(IF(t1.action = \'opened\', 1, 0)) AS `create`, \r\n SUM(IF(t1.action = \'edited\', 1, 0)) AS `edit`\r\nFROM zt_action AS t1 \r\nLEFT JOIN zt_story AS t2 ON t1.objectID = t2.id\r\nWHERE t1.objectType = \'story\' AND t1.action IN (\'opened\', \'edited\') AND t2.deleted = \'0\'\r\nGROUP BY `year`, actor, objectType\r\nUNION ALL\r\nSELECT \r\n YEAR(t1.date) AS `year`, t1.actor, \"计划\" AS objectType, \r\n SUM(IF(t1.action = \'opened\', 1, 0)) AS `create`, \r\n SUM(IF(t1.action = \'edited\', 1, 0)) AS `edit`\r\nFROM zt_action AS t1 \r\nLEFT JOIN zt_productplan AS t2 ON t1.objectID = t2.id\r\nWHERE t1.objectType = \'productplan\' AND t1.action IN (\'opened\', \'edited\') AND t2.deleted = \'0\'\r\nGROUP BY `year`, actor, objectType\r\nUNION ALL\r\nSELECT \r\n YEAR(t1.date) AS `year`, t1.actor, \"发布\" AS objectType, \r\n SUM(IF(t1.action = \'opened\', 1, 0)) AS `create`, \r\n SUM(IF(t1.action = \'edited\', 1, 0)) AS `edit`\r\nFROM zt_action AS t1 \r\nLEFT JOIN zt_release AS t2 ON t1.objectID = t2.id\r\nWHERE t1.objectType = \'release\' AND t1.action IN (\'opened\', \'edited\') AND t2.deleted = \'0\'\r\nGROUP BY `year`, actor, objectType\r\nUNION ALL\r\nSELECT \r\n YEAR(t1.date) AS `year`, t1.actor, \"执行\" AS objectType, \r\n SUM(IF(t1.action = \'opened\', 1, 0)) AS `create`, \r\n SUM(IF(t1.action = \'edited\', 1, 0)) AS `edit`\r\nFROM zt_action AS t1 \r\nLEFT JOIN zt_project AS t2 ON t1.objectID = t2.id\r\nWHERE t1.objectType = \'execution\' AND t1.action IN (\'opened\', \'edited\') AND t2.deleted = \'0\' AND t2.type IN (\'sprint\', \'stage\', \'kanban\')\r\nGROUP BY `year`, actor, objectType\r\nUNION ALL\r\nSELECT \r\n YEAR(t1.date) AS `year`, t1.actor, \"任务\" AS objectType, \r\n SUM(IF(t1.action = \'opened\', 1, 0)) AS `create`, \r\n SUM(IF(t1.action = \'edited\', 1, 0)) AS `edit`\r\nFROM zt_action AS t1 \r\nLEFT JOIN zt_task AS t2 ON t1.objectID = t2.id\r\nWHERE t1.objectType = \'task\' AND t1.action IN (\'opened\', \'edited\') AND t2.deleted = \'0\'\r\nGROUP BY `year`, actor, objectType\r\nUNION ALL\r\nSELECT \r\n YEAR(t1.date) AS `year`, t1.actor, \'Bug\' AS objectType, \r\n SUM(IF(t1.action = \'opened\', 1, 0)) AS `create`, \r\n SUM(IF(t1.action = \'edited\', 1, 0)) AS `edit`\r\nFROM zt_action AS t1 \r\nLEFT JOIN zt_bug AS t2 ON t1.objectID = t2.id\r\nWHERE t1.objectType = \'bug\' AND t1.action IN (\'opened\', \'edited\') AND t2.deleted = \'0\'\r\nGROUP BY `year`, actor, objectType\r\nUNION ALL\r\nSELECT \r\n YEAR(t1.date) AS `year`, t1.actor, \"版本\" AS objectType, \r\n SUM(IF(t1.action = \'opened\', 1, 0)) AS `create`, \r\n SUM(IF(t1.action = \'edited\', 1, 0)) AS `edit` \r\nFROM zt_action AS t1 \r\nLEFT JOIN zt_build AS t2 ON t1.objectID = t2.id\r\nWHERE t1.objectType = \'build\' AND t1.action IN (\'opened\', \'edited\') AND t2.deleted = \'0\'\r\nGROUP BY `year`, actor, objectType\r\nUNION ALL\r\nSELECT \r\n YEAR(t1.date) AS `year`, t1.actor, \"用例\" AS objectType, \r\n SUM(IF(t1.action = \'opened\', 1, 0)) AS `create`, \r\n SUM(IF(t1.action = \'edited\', 1, 0)) AS `edit`\r\nFROM zt_action AS t1 \r\nLEFT JOIN zt_case AS t2 ON t1.objectID = t2.id\r\nWHERE t1.objectType = \'case\' AND t1.action IN (\'opened\', \'edited\') AND t2.deleted = \'0\'\r\nGROUP BY `year`, actor, objectType\r\nUNION ALL\r\nSELECT \r\n YEAR(t1.date) AS `year`, t1.actor, \"测试单\" AS objectType, \r\n SUM(IF(t1.action = \'opened\', 1, 0)) AS `create`, \r\n SUM(IF(t1.action = \'edited\', 1, 0)) AS `edit`\r\nFROM zt_action AS t1 \r\nLEFT JOIN zt_testtask AS t2 ON t1.objectID = t2.id\r\nWHERE t1.objectType = \'testtask\' AND t1.action IN (\'opened\', \'edited\') AND t2.deleted = \'0\'\r\nGROUP BY `year`, actor, objectType\r\nUNION ALL\r\nSELECT \r\n YEAR(t1.date) AS `year`, t1.actor, \"文档\" AS objectType, \r\n SUM(IF(t1.action = \'opened\', 1, 0)) AS `create`, \r\n SUM(IF(t1.action = \'edited\', 1, 0)) AS `edit`\r\nFROM zt_action AS t1 \r\nLEFT JOIN zt_doc AS t2 ON t1.objectID = t2.id\r\nWHERE t1.objectType = \'doc\' AND t1.action IN (\'opened\', \'edited\') AND t2.deleted = \'0\'\r\nGROUP BY `year`, actor, objectType) AS t2 ON t1.account = t2.account\r\nWHERE t2.account IS NOT NULL', 'published', 1, '', 'admin', '2022-12-07 14:59:41', '', '2022-12-07 14:59:41', 0), -(1007, '年度总结-能力雷达图', 1, 'radar', '0', '', '', '{\r\n\"group\":[{\"field\":\"dimension\",\"name\":\"维度\"}],\r\n\"metric\":[\r\n {\"type\":\"value\",\"field\":\"num\",\"agg\":\"value\",\"name\": \"产品管理\", \"key\":\"product\",\"valOrAgg\":\"value\"},\r\n {\"type\":\"value\",\"field\":\"num\",\"agg\":\"value\",\"name\": \"项目管理\", \"key\":\"project\",\"valOrAgg\":\"value\"},\r\n {\"type\":\"value\",\"field\":\"num\",\"agg\":\"value\",\"name\": \"研发\", \"key\":\"dev\",\"valOrAgg\":\"value\"},\r\n {\"type\":\"value\",\"field\":\"num\",\"agg\":\"value\",\"name\": \"测试\", \"key\":\"qa\",\"valOrAgg\":\"value\"},\r\n {\"type\":\"value\",\"field\":\"num\",\"agg\":\"value\",\"name\": \"其他\", \"key\":\"other\",\"valOrAgg\":\"value\"}\r\n]}', '[]', 0, '', NULL, 'select tt.year, tt.actor AS account,tt.dimension, count(1) as num from (\r\nSELECT YEAR(t1.date) as `year`, t1.actor, \'product\' as dimension\r\nfrom zt_action t1\r\nWHERE \r\n(\r\n(t1.objectType = \'product\' AND t1.action in(\'opened\',\'edited\') and (select deleted from zt_product where id = t1.objectID) = \'0\')\r\nOR (t1.objectType = \'story\' AND t1.action in(\'opened\',\'reviewed\',\'closed\') and (select deleted from zt_story where id = t1.objectID) = \'0\')\r\nOR (t1.objectType = \'productplan\' AND t1.action in(\'opened\') and (select deleted from zt_productplan where id = t1.objectID) = \'0\')\r\nOR (t1.objectType = \'release\' AND t1.action in(\'opened\') and (select deleted from zt_release where id = t1.objectID) = \'0\')\r\n)\r\nunion all\r\nSELECT YEAR(t1.date) as `year`, t1.actor, \'execution\' as dimension\r\nfrom zt_action t1\r\nWHERE \r\n(\r\n(t1.objectType = \'execution\' AND t1.action in(\'opened\',\'edited\',\'started\',\'closed\') and (select deleted from zt_project where id = t1.objectID) = \'0\')\r\nOR (t1.objectType = \'build\' AND t1.action in(\'opened\') and (select deleted from zt_build where id = t1.objectID) = \'0\')\r\nOR (t1.objectType = \'task\' AND t1.action in(\'opened\',\'closed\',\'activated\',\'assigned\') and (select deleted from zt_task where id = t1.objectID) = \'0\')\r\n)\r\nunion all\r\nSELECT YEAR(t1.date) as `year`, t1.actor, \'devel\' as dimension\r\nfrom zt_action t1\r\nWHERE \r\n(\r\n(t1.objectType = \'execution\' AND t1.action in(\'opened\',\'edited\',\'started\',\'closed\') and (select deleted from zt_project where id = t1.objectID) = \'0\')\r\nOR (t1.objectType = \'build\' AND t1.action in(\'opened\') and (select deleted from zt_build where id = t1.objectID) = \'0\')\r\nOR (t1.objectType = \'task\' AND t1.action in(\'opened\',\'closed\',\'assigned\') and (select deleted from zt_task where id = t1.objectID) = \'0\')\r\nOR (t1.objectType = \'task\' and t1.action in (\'gitcommited\', \'svncommited\'))\r\nOR (t1.objectType = \'bug\' AND t1.action in(\'resolved\') and (select deleted from zt_bug where id = t1.objectID) = \'0\')\r\n)\r\nunion all\r\nSELECT YEAR(t1.date) as `year`, t1.actor, \'qa\' as dimension\r\nfrom zt_action t1\r\nWHERE \r\n(\r\n(t1.objectType = \'bug\' AND t1.action in(\'opened\',\'closed\',\'activated\') and (select deleted from zt_bug where id = t1.objectID) = \'0\')\r\nOR (t1.objectType = \'case\' AND t1.action in(\'opened\',\'run\') and (select deleted from zt_case where id = t1.objectID) = \'0\')\r\nOR (t1.objectType = \'testtask\' AND t1.action in(\'opened\',\'edited\') and (select deleted from zt_testtask where id = t1.objectID) = \'0\')\r\n)\r\n) tt WHERE tt.year != \'0000\'\r\nGROUP BY tt.year, tt.dimension', 'published', 1, '', 'admin', '2022-12-07 14:59:41', '', '2022-12-07 14:59:41', 0), -(1008, '年度总结-迭代数据', 1, 'table', '0', '', '', '{\"group\":[],\"column\":[\r\n{\"field\":\"name\",\"valOrAgg\":\"value\",\"name\":\"迭代名称\"},{\"field\":\"finishedStory\",\"valOrAgg\":\"value\",\"name\":\"完成需求数\"},\r\n{\"field\":\"finishedTask\",\"valOrAgg\":\"value\",\"name\":\"完成任务数\"},\r\n{\"field\":\"resolvedBug\",\"valOrAgg\":\"value\",\"name\":\"解决Bug数\"}\r\n],\"filter\":[]}', '[]', 0, '', NULL, 'SELECT \r\ntt.id, \r\ntt.name, \r\ntt.year, \r\ntt.account,\r\ntt.finishedStory,\r\ntt.finishedTask,\r\ncount(t3.id) as resolvedBug\r\nfrom (\r\nSELECT \r\ntt.id, \r\nt2.name, \r\ntt.year, \r\ntt.account,\r\nSUM(if((t1.story != 0), 1 , 0)) as finishedStory,\r\ncount(t1.id) as finishedTask\r\nfrom (\r\nSELECT \r\n*\r\nfrom (\r\nSELECT id, YEAR(begin) as year, openedBy as account from zt_project\r\nWHERE deleted = \'0\' AND type = \'sprint\' and multiple = \'1\' and YEAR(begin) != \'0000\'\r\nunion all\r\nSELECT id, YEAR(begin) as year, PO as account from zt_project\r\nWHERE deleted = \'0\' AND type = \'sprint\' and multiple = \'1\' and YEAR(begin) != \'0000\'\r\nunion all\r\nSELECT id, YEAR(begin) as year, PM as account from zt_project\r\nWHERE deleted = \'0\' AND type = \'sprint\' and multiple = \'1\' and YEAR(begin) != \'0000\'\r\nunion all\r\nSELECT id, YEAR(begin) as year, QD as account from zt_project\r\nWHERE deleted = \'0\' AND type = \'sprint\' and multiple = \'1\' and YEAR(begin) != \'0000\'\r\nunion all\r\nSELECT id, YEAR(begin) as year, RD as account from zt_project\r\nWHERE deleted = \'0\' AND type = \'sprint\' and multiple = \'1\' and YEAR(begin) != \'0000\'\r\nunion all\r\nSELECT id, YEAR(end) as year, openedBy as account from zt_project\r\nWHERE deleted = \'0\' AND type = \'sprint\' and multiple = \'1\' and YEAR(end) != \'0000\'\r\nunion all\r\nSELECT id, YEAR(end) as year, PO as account from zt_project\r\nWHERE deleted = \'0\' AND type = \'sprint\' and multiple = \'1\' and YEAR(end) != \'0000\'\r\nunion all\r\nSELECT id, YEAR(end) as year, PM as account from zt_project\r\nWHERE deleted = \'0\' AND type = \'sprint\' and multiple = \'1\' and YEAR(end) != \'0000\'\r\nunion all\r\nSELECT id, YEAR(end) as year, QD as account from zt_project\r\nWHERE deleted = \'0\' AND type = \'sprint\' and multiple = \'1\' and YEAR(end) != \'0000\'\r\nunion all\r\nSELECT id, YEAR(end) as year, RD as account from zt_project\r\nWHERE deleted = \'0\' AND type = \'sprint\' and multiple = \'1\' and YEAR(end) != \'0000\'\r\nunion all\r\nSELECT t1.root as id, YEAR(t1.`join`) as year, t1.account from zt_team t1\r\nRIGHT JOIN zt_project t2 on t2.id = t1.root and t2.deleted = \'0\' and t2.type = \'sprint\'\r\nWHERE t1.type = \'execution\' and YEAR(t1.`join`) != \'0000\'\r\nunion all\r\nSELECT t1.execution as id, YEAR(t1.finishedDate) as year, t1.finishedBy as account from zt_task t1\r\nRIGHT JOIN zt_project t2 on t2.id = t1.execution and t2.deleted = \'0\' and t2.type = \'sprint\'\r\nWHERE t1.deleted = \'0\' and YEAR(t1.finishedDate) != \'0000\'\r\n) tt \r\nwhere tt.account != \'\'\r\nGROUP BY tt.id, tt.`year`, tt.account\r\n) tt\r\nLEFT JOIN zt_task t1 on t1.execution = tt.id and YEAR(t1.finishedDate) = tt.year and t1.deleted = \'0\' and t1.finishedBy = tt.account\r\nLEFT JOIN zt_project t2 on t2.id = tt.id\r\nGROUP BY tt.id, tt.`year`, tt.account\r\n) tt\r\nLEFT JOIN zt_bug t2 on t2.resolvedBy = tt.account and YEAR(t2.resolvedDate) = tt.year\r\nleft join zt_build t3 on t2.resolvedBuild = t3.id and t3.execution = tt.id\r\nWHERE t2.deleted = \'0\'\r\nGROUP BY tt.account, tt.`year`, tt.id', 'published', 1, '', 'admin', '2022-12-07 14:59:41', '', '2022-12-07 14:59:41', 0), -(1009, '年度总结-产品数据', 1, 'table', '0', '', '', '{\"group\":[],\"column\":[\r\n{\"field\":\"name\",\"valOrAgg\":\"value\",\"name\":\"产品名称\"},{\"field\":\"plan\",\"valOrAgg\":\"value\",\"name\":\"计划数\"},\r\n{\"field\":\"requirement\",\"valOrAgg\":\"value\",\"name\":\"创建用户需求数\"},\r\n{\"field\":\"story\",\"valOrAgg\":\"value\",\"name\":\"创建需求数\"},\r\n{\"field\":\"closedStory\",\"valOrAgg\":\"value\",\"name\":\"关闭需求数\"}\r\n],\"filter\":[]}', '[]', 0, '', NULL, 'select * from (\r\nselect tt.id, t2.name, tt.year, tt.account, tt.plans, tt.requirement, tt.story, count(t1.id) as closedStory\r\nfrom(\r\n select tt.id, tt.year, tt.account, tt.plans,\r\nsum(if((type = \'requirement\'), 1, 0)) as requirement,\r\nsum(if((type = \'story\'), 1, 0)) as story\r\nfrom (\r\nselect tt.id, tt.year, tt.account,\r\ncount(t2.id) as plans\r\nfrom (\r\nselect * from (\r\nselect id, YEAR(createdDate) as `year`, createdBy as account from zt_product\r\nwhere deleted = \'0\' and shadow = \'0\'\r\nunion all\r\nselect id, YEAR(createdDate) as `year`, PO as account from zt_product\r\nwhere deleted = \'0\' and shadow = \'0\'\r\nunion all\r\nselect id, YEAR(createdDate) as `year`, QD as account from zt_product\r\nwhere deleted = \'0\' and shadow = \'0\'\r\nunion all\r\nselect id, YEAR(createdDate) as `year`, RD as account from zt_product\r\nwhere deleted = \'0\' and shadow = \'0\'\r\n) tt\r\nWHERE tt.account != \'\' and tt.year != \'0000\'\r\nGROUP BY tt.account, tt.year, tt.id\r\n) tt\r\nLEFT JOIN zt_productplan t1 on t1.product = tt.id\r\nLEFT JOIN zt_action t2 on t1.id = t2.objectID and YEAR(t2.date) = tt.year\r\nand t2.objectType = \'productplan\'\r\nand t1.deleted = \'0\'\r\nand t2.actor = tt.account\r\nand t2.action = \'opened\'\r\nGROUP BY tt.account, tt.year, tt.id) tt\r\nLEFT JOIN zt_story t1 on t1.product = tt.id and YEAR(t1.openedDate) = tt.year and t1.openedBy = tt.account and t1.deleted = \'0\'\r\nGROUP BY tt.account, tt.year, tt.id) tt\r\nLEFT JOIN zt_story t1 on t1.product = tt.id and YEAR(t1.closedDate) = tt.year and t1.closedBy = tt.account and t1.deleted = \'0\'\r\nLEFT JOIN zt_product t2 on t2.id = tt.id\r\nGROUP BY tt.account, tt.year, tt.id) tt\r\nWHERE tt.account = \'zhangpeng\'', 'published', 1, '', 'admin', '2022-12-07 14:59:41', '', '2022-12-07 14:59:41', 0), +(1007, '年度总结-能力雷达图', 1, 'radar', '0', '', '', '{\r\n\"group\":[{\"field\":\"dimension\",\"name\":\"维度\"}],\r\n\"metric\":[\r\n {\"type\":\"value\",\"field\":\"num\",\"agg\":\"value\",\"name\": \"产品管理\", \"key\":\"product\",\"valOrAgg\":\"value\"},\r\n {\"type\":\"value\",\"field\":\"num\",\"agg\":\"value\",\"name\": \"项目管理\", \"key\":\"project\",\"valOrAgg\":\"value\"},\r\n {\"type\":\"value\",\"field\":\"num\",\"agg\":\"value\",\"name\": \"研发\", \"key\":\"dev\",\"valOrAgg\":\"value\"},\r\n {\"type\":\"value\",\"field\":\"num\",\"agg\":\"value\",\"name\": \"测试\", \"key\":\"qa\",\"valOrAgg\":\"value\"},\r\n {\"type\":\"value\",\"field\":\"num\",\"agg\":\"value\",\"name\": \"其他\", \"key\":\"other\",\"valOrAgg\":\"value\"}\r\n]}', '[]', 0, '', NULL, 'select tt.year, tt.actor AS account,tt.dimension, count(1) as num from (\r\nSELECT YEAR(t1.date) as `year`, t1.actor, \'product\' as dimension\r\nfrom zt_action t1\r\nWHERE \r\n(\r\n(t1.objectType = \'product\' AND t1.action in(\'opened\',\'edited\') and (select deleted from zt_product where id = t1.objectID) = \'0\')\r\nOR (t1.objectType = \'story\' AND t1.action in(\'opened\',\'reviewed\',\'closed\') and (select deleted from zt_story where id = t1.objectID) = \'0\')\r\nOR (t1.objectType = \'productplan\' AND t1.action in(\'opened\') and (select deleted from zt_productplan where id = t1.objectID) = \'0\')\r\nOR (t1.objectType = \'release\' AND t1.action in(\'opened\') and (select deleted from zt_release where id = t1.objectID) = \'0\')\r\n)\r\nunion all\r\nSELECT YEAR(t1.date) as `year`, t1.actor, \'execution\' as dimension\r\nfrom zt_action t1\r\nWHERE \r\n(\r\n(t1.objectType = \'execution\' AND t1.action in(\'opened\',\'edited\',\'started\',\'closed\') and (select deleted from zt_project where id = t1.objectID) = \'0\')\r\nOR (t1.objectType = \'build\' AND t1.action in(\'opened\') and (select deleted from zt_build where id = t1.objectID) = \'0\')\r\nOR (t1.objectType = \'task\' AND t1.action in(\'opened\',\'closed\',\'activated\',\'assigned\') and (select deleted from zt_task where id = t1.objectID) = \'0\')\r\n)\r\nunion all\r\nSELECT YEAR(t1.date) as `year`, t1.actor, \'devel\' as dimension\r\nfrom zt_action t1\r\nWHERE \r\n(\r\n(t1.objectType = \'execution\' AND t1.action in(\'opened\',\'edited\',\'started\',\'closed\') and (select deleted from zt_project where id = t1.objectID) = \'0\')\r\nOR (t1.objectType = \'build\' AND t1.action in(\'opened\') and (select deleted from zt_build where id = t1.objectID) = \'0\')\r\nOR (t1.objectType = \'task\' AND t1.action in(\'opened\',\'closed\',\'assigned\') and (select deleted from zt_task where id = t1.objectID) = \'0\')\r\nOR (t1.objectType = \'task\' and t1.action in (\'gitcommited\', \'svncommited\'))\r\nOR (t1.objectType = \'bug\' AND t1.action in(\'resolved\') and (select deleted from zt_bug where id = t1.objectID) = \'0\')\r\n)\r\nunion all\r\nSELECT YEAR(t1.date) as `year`, t1.actor, \'qa\' as dimension\r\nfrom zt_action t1\r\nWHERE \r\n(\r\n(t1.objectType = \'bug\' AND t1.action in(\'opened\',\'closed\',\'activated\') and (select deleted from zt_bug where id = t1.objectID) = \'0\')\r\nOR (t1.objectType = \'case\' AND t1.action in(\'opened\',\'run\') and (select deleted from zt_case where id = t1.objectID) = \'0\')\r\nOR (t1.objectType = \'testtask\' AND t1.action in(\'opened\',\'edited\') and (select deleted from zt_testtask where id = t1.objectID) = \'0\')\r\n)\r\n) tt WHERE tt.year != null\r\nGROUP BY tt.year, tt.dimension', 'published', 1, '', 'admin', '2022-12-07 14:59:41', '', '2022-12-07 14:59:41', 0), +(1008, '年度总结-迭代数据', 1, 'table', '0', '', '', '{\"group\":[],\"column\":[\r\n{\"field\":\"name\",\"valOrAgg\":\"value\",\"name\":\"迭代名称\"},{\"field\":\"finishedStory\",\"valOrAgg\":\"value\",\"name\":\"完成需求数\"},\r\n{\"field\":\"finishedTask\",\"valOrAgg\":\"value\",\"name\":\"完成任务数\"},\r\n{\"field\":\"resolvedBug\",\"valOrAgg\":\"value\",\"name\":\"解决Bug数\"}\r\n],\"filter\":[]}', '[]', 0, '', NULL, 'SELECT \r\ntt.id, \r\ntt.name, \r\ntt.year, \r\ntt.account,\r\ntt.finishedStory,\r\ntt.finishedTask,\r\ncount(t3.id) as resolvedBug\r\nfrom (\r\nSELECT \r\ntt.id, \r\nt2.name, \r\ntt.year, \r\ntt.account,\r\nSUM(if((t1.story != 0), 1 , 0)) as finishedStory,\r\ncount(t1.id) as finishedTask\r\nfrom (\r\nSELECT \r\n*\r\nfrom (\r\nSELECT id, YEAR(begin) as year, openedBy as account from zt_project\r\nWHERE deleted = \'0\' AND type = \'sprint\' and multiple = \'1\' and YEAR(begin) != null\r\nunion all\r\nSELECT id, YEAR(begin) as year, PO as account from zt_project\r\nWHERE deleted = \'0\' AND type = \'sprint\' and multiple = \'1\' and YEAR(begin) != null\r\nunion all\r\nSELECT id, YEAR(begin) as year, PM as account from zt_project\r\nWHERE deleted = \'0\' AND type = \'sprint\' and multiple = \'1\' and YEAR(begin) != null\r\nunion all\r\nSELECT id, YEAR(begin) as year, QD as account from zt_project\r\nWHERE deleted = \'0\' AND type = \'sprint\' and multiple = \'1\' and YEAR(begin) != null\r\nunion all\r\nSELECT id, YEAR(begin) as year, RD as account from zt_project\r\nWHERE deleted = \'0\' AND type = \'sprint\' and multiple = \'1\' and YEAR(begin) != null\r\nunion all\r\nSELECT id, YEAR(end) as year, openedBy as account from zt_project\r\nWHERE deleted = \'0\' AND type = \'sprint\' and multiple = \'1\' and YEAR(end) != null\r\nunion all\r\nSELECT id, YEAR(end) as year, PO as account from zt_project\r\nWHERE deleted = \'0\' AND type = \'sprint\' and multiple = \'1\' and YEAR(end) != null\r\nunion all\r\nSELECT id, YEAR(end) as year, PM as account from zt_project\r\nWHERE deleted = \'0\' AND type = \'sprint\' and multiple = \'1\' and YEAR(end) != null\r\nunion all\r\nSELECT id, YEAR(end) as year, QD as account from zt_project\r\nWHERE deleted = \'0\' AND type = \'sprint\' and multiple = \'1\' and YEAR(end) != null\r\nunion all\r\nSELECT id, YEAR(end) as year, RD as account from zt_project\r\nWHERE deleted = \'0\' AND type = \'sprint\' and multiple = \'1\' and YEAR(end) != null\r\nunion all\r\nSELECT t1.root as id, YEAR(t1.`join`) as year, t1.account from zt_team t1\r\nRIGHT JOIN zt_project t2 on t2.id = t1.root and t2.deleted = \'0\' and t2.type = \'sprint\'\r\nWHERE t1.type = \'execution\' and YEAR(t1.`join`) != null\r\nunion all\r\nSELECT t1.execution as id, YEAR(t1.finishedDate) as year, t1.finishedBy as account from zt_task t1\r\nRIGHT JOIN zt_project t2 on t2.id = t1.execution and t2.deleted = \'0\' and t2.type = \'sprint\'\r\nWHERE t1.deleted = \'0\' and YEAR(t1.finishedDate) != null\r\n) tt \r\nwhere tt.account != \'\'\r\nGROUP BY tt.id, tt.`year`, tt.account\r\n) tt\r\nLEFT JOIN zt_task t1 on t1.execution = tt.id and YEAR(t1.finishedDate) = tt.year and t1.deleted = \'0\' and t1.finishedBy = tt.account\r\nLEFT JOIN zt_project t2 on t2.id = tt.id\r\nGROUP BY tt.id, tt.`year`, tt.account\r\n) tt\r\nLEFT JOIN zt_bug t2 on t2.resolvedBy = tt.account and YEAR(t2.resolvedDate) = tt.year\r\nleft join zt_build t3 on t2.resolvedBuild = t3.id and t3.execution = tt.id\r\nWHERE t2.deleted = \'0\'\r\nGROUP BY tt.account, tt.`year`, tt.id', 'published', 1, '', 'admin', '2022-12-07 14:59:41', '', '2022-12-07 14:59:41', 0), +(1009, '年度总结-产品数据', 1, 'table', '0', '', '', '{\"group\":[],\"column\":[\r\n{\"field\":\"name\",\"valOrAgg\":\"value\",\"name\":\"产品名称\"},{\"field\":\"plan\",\"valOrAgg\":\"value\",\"name\":\"计划数\"},\r\n{\"field\":\"requirement\",\"valOrAgg\":\"value\",\"name\":\"创建用户需求数\"},\r\n{\"field\":\"story\",\"valOrAgg\":\"value\",\"name\":\"创建需求数\"},\r\n{\"field\":\"closedStory\",\"valOrAgg\":\"value\",\"name\":\"关闭需求数\"}\r\n],\"filter\":[]}', '[]', 0, '', NULL, 'select * from (\r\nselect tt.id, t2.name, tt.year, tt.account, tt.plans, tt.requirement, tt.story, count(t1.id) as closedStory\r\nfrom(\r\n select tt.id, tt.year, tt.account, tt.plans,\r\nsum(if((type = \'requirement\'), 1, 0)) as requirement,\r\nsum(if((type = \'story\'), 1, 0)) as story\r\nfrom (\r\nselect tt.id, tt.year, tt.account,\r\ncount(t2.id) as plans\r\nfrom (\r\nselect * from (\r\nselect id, YEAR(createdDate) as `year`, createdBy as account from zt_product\r\nwhere deleted = \'0\' and shadow = \'0\'\r\nunion all\r\nselect id, YEAR(createdDate) as `year`, PO as account from zt_product\r\nwhere deleted = \'0\' and shadow = \'0\'\r\nunion all\r\nselect id, YEAR(createdDate) as `year`, QD as account from zt_product\r\nwhere deleted = \'0\' and shadow = \'0\'\r\nunion all\r\nselect id, YEAR(createdDate) as `year`, RD as account from zt_product\r\nwhere deleted = \'0\' and shadow = \'0\'\r\n) tt\r\nWHERE tt.account != \'\' and tt.year != null\r\nGROUP BY tt.account, tt.year, tt.id\r\n) tt\r\nLEFT JOIN zt_productplan t1 on t1.product = tt.id\r\nLEFT JOIN zt_action t2 on t1.id = t2.objectID and YEAR(t2.date) = tt.year\r\nand t2.objectType = \'productplan\'\r\nand t1.deleted = \'0\'\r\nand t2.actor = tt.account\r\nand t2.action = \'opened\'\r\nGROUP BY tt.account, tt.year, tt.id) tt\r\nLEFT JOIN zt_story t1 on t1.product = tt.id and YEAR(t1.openedDate) = tt.year and t1.openedBy = tt.account and t1.deleted = \'0\'\r\nGROUP BY tt.account, tt.year, tt.id) tt\r\nLEFT JOIN zt_story t1 on t1.product = tt.id and YEAR(t1.closedDate) = tt.year and t1.closedBy = tt.account and t1.deleted = \'0\'\r\nLEFT JOIN zt_product t2 on t2.id = tt.id\r\nGROUP BY tt.account, tt.year, tt.id) tt\r\nWHERE tt.account = \'zhangpeng\'', 'published', 1, '', 'admin', '2022-12-07 14:59:41', '', '2022-12-07 14:59:41', 0), (1010, '年度总结-任务状态分布', 1, 'pie', '0', '', '', '{\"group\":[{\"field\":\"status\",\"name\":\"状态\"}],\"metric\":[{\"type\":\"agg\",\"field\":\"id\",\"agg\":\"count\",\"name\":\"任务数\",\"valOrAgg\":\"count\"}]}', '[]', 0, '', NULL, 'SELECT\r\nYEAR(t1.date) AS `year`,\r\nt3.account,\r\nt3.realname,\r\nCASE t2.status\r\nWHEN \'wait\' THEN \"未开始\"\r\nWHEN \'doing\' THEN \"进行中\"\r\nWHEN \'done\' THEN \"已完成\"\r\nWHEN \'closed\' THEN \"已关闭\"\r\nELSE \"未设置\" END status,\r\nt1.id\r\nFROM zt_action t1\r\nLEFT JOIN zt_task t2 on t1.objectID=t2.id RIGHT JOIN zt_user t3 on t1.actor=t3.account\r\nWHERE t1.objectType = \'task\'\r\nand t2.deleted = \'0\'', 'published', 1, '', 'admin', '2022-12-07 14:59:41', '', '2022-12-07 14:59:41', 0), (1011, '年度总结-每月任务操作情况', 1, 'bar', '0', '', '', '{\n \"xaxis\":[{\"field\":\"actionDate\",\"name\":\"日期\",\"group\":\"value\"}],\n \"yaxis\":[{\"type\":\"agg\",\"field\":\"opened\",\"agg\":\"sum\",\"name\":\"创建\",\"valOrAgg\":\"sum\"},\n{\"type\":\"agg\",\"field\":\"started\",\"agg\":\"sum\",\"name\":\"开始\",\"valOrAgg\":\"sum\"},\n{\"type\":\"agg\",\"field\":\"finished\",\"agg\":\"sum\",\"name\":\"完成\",\"valOrAgg\":\"sum\"},\n{\"type\":\"agg\",\"field\":\"paused\",\"agg\":\"sum\",\"name\":\"暂停\",\"valOrAgg\":\"sum\"},\n{\"type\":\"agg\",\"field\":\"activated\",\"agg\":\"sum\",\"name\":\"激活\",\"valOrAgg\":\"sum\"},\n{\"type\":\"agg\",\"field\":\"canceled\",\"agg\":\"sum\",\"name\":\"取消\",\"valOrAgg\":\"sum\"},\n{\"type\":\"agg\",\"field\":\"closed\",\"agg\":\"sum\",\"name\":\"关闭\",\"valOrAgg\":\"sum\"}\n]}', '[]', 0, '', NULL, 'SELECT t2.opened,t2.started,t2.finished,t2.paused,t2.activated,t2.canceled,t2.closed,t1.account,t2.actionDate,YEAR(CONCAT(t2.actionDate, \'-01\')) AS `year`,realname,t3.`name` AS deptName FROM zt_user AS t1\nLEFT JOIN (\n SELECT t21.actor,LEFT(t21.`date`,7) AS actionDate,\n SUM(if(t21.action = \'opened\', 1, 0)) as opened,\n SUM(if(t21.action = \'started\', 1, 0)) as started,\n SUM(if(t21.action = \'finished\', 1, 0)) as finished,\n SUM(if(t21.action = \'paused\', 1, 0)) as paused,\n SUM(if(t21.action = \'activated\', 1, 0)) as activated,\n SUM(if(t21.action = \'canceled\', 1, 0)) as canceled,\n SUM(if(t21.action = \'closed\', 1, 0)) as closed FROM zt_action AS t21\n LEFT JOIN zt_story AS t22 ON t21.objectID=t22.id\n WHERE t21.objectType=\'bug\'\n AND t22.deleted=\'0\'\n GROUP BY t21.actor,actionDate\n) AS t2 ON t1.account=t2.actor\nLEFT JOIN zt_dept AS t3 ON t1.dept=t3.id\nWHERE t1.deleted=\'0\'\nAND t2.actor IS NOT NULL\nGROUP BY t2.actionDate,deptName,t1.account,realname\n', 'published', 1, '', 'admin', '2022-12-07 14:59:41', '', '2022-12-07 14:59:41', 0), (1012, '年度总结-需求状态分布', 1, 'pie', '0', '', '', '{\"group\":[{\"field\":\"status\",\"name\":\"状态\"}],\"metric\":[{\"type\":\"agg\",\"field\":\"id\",\"agg\":\"count\",\"name\":\"需求数\",\"valOrAgg\":\"count\"}]}', '[]', 0, '', NULL, 'SELECT\r\nYEAR(t1.date) AS `year`,\r\nt3.account,\r\nt3.realname,\r\nCASE t2.status\r\nWHEN \'wait\' THEN \"未开始\"\r\nWHEN \'doing\' THEN \"进行中\"\r\nWHEN \'done\' THEN \"已完成\"\r\nWHEN \'colsed\' THEN \"已关闭\"\r\nELSE \"未设置\"\r\nEND status,\r\nt1.id\r\nFROM zt_action t1\r\nLEFT JOIN zt_task t2 on t1.objectID=t2.id RIGHT JOIN zt_user t3 on t1.actor=t3.account\r\nWHERE t1.objectType = \'story\'\r\nand t2.deleted = \'0\'', 'published', 1, '', 'admin', '2022-12-07 14:59:41', '', '2022-12-07 14:59:41', 0), @@ -14155,7 +14155,7 @@ INSERT INTO `zt_chart`(`id`, `name`, `dimension`, `type`, `group`, `dataset`, `d (1047, '宏观数据-产品Bug修复率', 1, 'bar', '44', '', '', '{\r\n\"xaxis\":[{\"field\":\"product\",\"name\":\"产品\"}],\r\n\"yaxis\":[\r\n {\"type\":\"value\",\"field\":\"fixedRate\",\"agg\":\"value\",\"name\":\"Bug修复率\",\"valOrAgg\":\"value\"}\r\n]}', '[]', 0, '', NULL, 'SELECT \r\n t1.name AS product,\r\n IFNULL(t2.name, \'/\') AS program,\r\n IFNULL(t3.name, \'/\') AS productLine,\r\n IFNULL(t4.bug, 0) AS fixedBug,\r\n t5.bug AS totalBug,\r\n ROUND(IFNULL(t4.bug, 0) / t5.bug * 100, 2) AS fixedRate\r\nFROM zt_product AS t1\r\nLEFT JOIN zt_project AS t2 ON t1.program = t2.id AND t2.type = \'program\' AND t2.grade = 1\r\nLEFT JOIN zt_module AS t3 ON t1.line = t3.id AND t3.type = \'line\'\r\nLEFT JOIN (SELECT product, COUNT(1) AS bug FROM zt_bug WHERE deleted = \'0\' AND resolution = \'fixed\' AND status = \'closed\' GROUP BY product) AS t4 ON t1.id = t4.product\r\nLEFT JOIN (SELECT product, COUNT(1) AS bug FROM zt_bug WHERE deleted = \'0\' AND (resolution = \'fixed\' OR resolution = \'postponed\' OR status = \'active\') GROUP BY product) AS t5 ON t1.id = t5.product\r\nWHERE t1.deleted = \'0\' AND t1.status != \'closed\' AND t1.shadow = \'0\' AND t1.vision = \'rnd\' AND t5.bug IS NOT NULL\r\nORDER BY t1.order DESC', 'published', 1, '', 'admin', '2022-12-07 14:59:41', '', '2022-12-07 14:59:41', 0), (1049, '宏观数据-部门人员分布图', 1, 'bar', '56', '', '', '{\r\n\"xaxis\":[{\"field\":\"deptName\",\"name\":\"部门\"}],\r\n\"yaxis\":[\r\n {\"type\":\"value\",\"field\":\"count\",\"agg\":\"value\",\"name\":\"部门人数\",\"valOrAgg\":\"value\"}\r\n]}', '[]', 0, '', NULL, 'SELECT IF(t3.id IS NOT NULL, t3.`name`, \"空\") AS deptName,count(1) as count, \r\nIF(t3.id IS NOT NULL, t3.`order`, 9999) AS deptOrder \r\nFROM `zt_user` AS t1 \r\nLEFT JOIN `zt_dept` AS t2 ON t1.dept = t2.id\r\nLEFT JOIN `zt_dept` AS t3 ON FIND_IN_SET(TRIM(\',\' FROM t3.path), TRIM(\',\' FROM t2.path)) AND t3.grade = \'1\'\r\nWHERE t1.deleted = \'0\'\r\nGROUP BY deptName, deptOrder \r\nORDER BY deptOrder ASC', 'published', 1, '', 'admin', '2022-12-07 14:59:41', '', '2022-12-07 14:59:41', 0), (1050, '宏观数据-公司角色分布图', 1, 'pie', '56', '', '', '{\"group\":[{\"field\":\"role\",\"name\":\"类型\"}],\"metric\":[{\"type\":\"agg\",\"field\":\"account\",\"agg\":\"count\",\"name\":\"人数\",\"valOrAgg\":\"count\"}]}', '[]', 0, '', NULL, 'SELECT\n account,\nCASE\n ROLE \n WHEN \'dev\' THEN\n \"研发\" \n WHEN \'qa\' THEN\r\n \"测试\"\r\n WHEN \'pm\' THEN\r\n \"项目经理\"\r\n WHEN \'others\' THEN\r\n \"其他\"\r\n WHEN \'td\' THEN\r\n \"研发主管\"\r\n WHEN \'pd\' THEN\r\n \"产品主管\"\r\n WHEN \'po\' THEN\r\n \"产品经理\"\r\n WHEN \'qd\' THEN\r\n \"测试主管\"\r\n WHEN \'top\' THEN\r\n \"高层管理\"\r\n ELSE\r\n \"未知\"\r\n END\r\n role\n FROM\n `zt_user` \n WHERE\n deleted = \'0\' ', 'published', 1, '', 'admin', '2022-12-07 14:59:41', '', '2022-12-07 14:59:41', 0), -(1051, '宏观数据-人员工龄分布图', 1, 'bar', '56', '', '', '{\r\n\"xaxis\":[{\"field\":\"joinDate\",\"name\":\"工龄\"}],\r\n\"yaxis\":[\r\n {\"type\":\"value\",\"field\":\"count\",\"agg\":\"value\",\"name\":\"人数\",\"valOrAgg\":\"value\"}\r\n]}', '[]', 0, '', NULL, 'SELECT count(1) as count, \"0-1年\" as joinDate FROM `zt_user` WHERE deleted = \'0\' AND `join` > DATE_SUB(NOW(), INTERVAL 1 YEAR)\r\nunion\r\nSELECT count(1) as count, \"1-3年\" as joinDate FROM `zt_user` WHERE deleted = \'0\' AND `join` > DATE_SUB(NOW(), INTERVAL 3 YEAR) AND `join` <= DATE_SUB(NOW(), INTERVAL 1 YEAR)\r\nunion\r\nSELECT count(1) as count, \"3-5年\" as joinDate FROM `zt_user` WHERE deleted = \'0\' AND `join` > DATE_SUB(NOW(), INTERVAL 5 YEAR) AND `join` <= DATE_SUB(NOW(), INTERVAL 3 YEAR)\r\nunion\r\nSELECT count(1) as count, \"5-10年\" as joinDate FROM `zt_user` WHERE deleted = \'0\' AND `join` > DATE_SUB(NOW(), INTERVAL 10 YEAR) AND `join` <= DATE_SUB(NOW(), INTERVAL 5 YEAR)\r\nunion\r\nSELECT count(1) as count, \"10年以上\" as joinDate FROM `zt_user` WHERE deleted = \'0\' AND `join` < DATE_SUB(NOW(), INTERVAL 10 YEAR) AND LEFT(`join`, 4) != \'0000\'\r\nunion \r\nSELECT count(1) as count, \"未知\" as joinDate FROM `zt_user` WHERE deleted = \'0\' AND LEFT(`join`, 4) = \'0000\'', 'published', 1, '', 'admin', '2022-12-07 14:59:41', '', '2022-12-07 14:59:41', 0), +(1051, '宏观数据-人员工龄分布图', 1, 'bar', '56', '', '', '{\r\n\"xaxis\":[{\"field\":\"joinDate\",\"name\":\"工龄\"}],\r\n\"yaxis\":[\r\n {\"type\":\"value\",\"field\":\"count\",\"agg\":\"value\",\"name\":\"人数\",\"valOrAgg\":\"value\"}\r\n]}', '[]', 0, '', NULL, 'SELECT count(1) as count, \"0-1年\" as joinDate FROM `zt_user` WHERE deleted = \'0\' AND `join` > DATE_SUB(NOW(), INTERVAL 1 YEAR)\r\nunion\r\nSELECT count(1) as count, \"1-3年\" as joinDate FROM `zt_user` WHERE deleted = \'0\' AND `join` > DATE_SUB(NOW(), INTERVAL 3 YEAR) AND `join` <= DATE_SUB(NOW(), INTERVAL 1 YEAR)\r\nunion\r\nSELECT count(1) as count, \"3-5年\" as joinDate FROM `zt_user` WHERE deleted = \'0\' AND `join` > DATE_SUB(NOW(), INTERVAL 5 YEAR) AND `join` <= DATE_SUB(NOW(), INTERVAL 3 YEAR)\r\nunion\r\nSELECT count(1) as count, \"5-10年\" as joinDate FROM `zt_user` WHERE deleted = \'0\' AND `join` > DATE_SUB(NOW(), INTERVAL 10 YEAR) AND `join` <= DATE_SUB(NOW(), INTERVAL 5 YEAR)\r\nunion\r\nSELECT count(1) as count, \"10年以上\" as joinDate FROM `zt_user` WHERE deleted = \'0\' AND `join` < DATE_SUB(NOW(), INTERVAL 10 YEAR) AND `join` != null\r\nunion \r\nSELECT count(1) as count, \"未知\" as joinDate FROM `zt_user` WHERE deleted = \'0\' AND `join` = null', 'published', 1, '', 'admin', '2022-12-07 14:59:41', '', '2022-12-07 14:59:41', 0), (1055, '年度新增-一级项目集个数', 1, 'card', '45', '', '', '{\"value\": {\"type\": \"agg\", \"field\": \"id\", \"agg\": \"count\"}, \"title\": {\"type\": \"text\", \"name\": \"\"},\n\"type\": \"value\"\n}', '', 0, NULL, NULL, 'SELECT\r\n t1.`year`,\r\n t2.id,\r\n t2.name\r\nFROM\r\n ( SELECT DISTINCT YEAR ( `date` ) AS \'year\' FROM zt_action ) AS t1\r\n LEFT JOIN (\r\n SELECT\r\n id, name,\r\n YEAR ( openedDate ) AS `year` \r\n FROM\r\n zt_project \r\n WHERE\r\n `type` = \'program\' \r\n AND deleted = \'0\' \r\n AND grade = \'1\' \r\n ) t2 ON t1.`year` = t2.`year` \r\n WHERE t2.id IS NOT NULL', 'published', 1, '', '', NULL, '', NULL, 0), (1056, '年度新增-产品个数', 1, 'card', '47', '', '', '{\"value\": {\"type\": \"agg\", \"field\": \"id\", \"agg\": \"count\"}, \"title\": {\"type\": \"text\", \"name\": \"\"},\n\"type\": \"value\"\n}', '', 0, NULL, NULL, 'SELECT\r\n t1.`year`,\r\n t2.id,\r\n t2.name\r\nFROM\r\n ( SELECT DISTINCT YEAR ( `date` ) AS \'year\' FROM zt_action ) AS t1\r\n LEFT JOIN (\r\n SELECT\r\n id, name,\r\n YEAR ( createdDate ) AS `year` \r\n FROM\r\n zt_product \r\n WHERE\r\n deleted = \'0\' \r\n AND shadow = \'0\' \r\n ) t2 ON t1.`year` = t2.`year` \r\n WHERE t2.id IS NOT NULL', 'published', 1, '', '', NULL, '', NULL, 0), (1057, '年度新增-需求个数', 1, 'card', '51', '', '', '{\"value\": {\"type\": \"agg\", \"field\": \"id\", \"agg\": \"count\"}, \"title\": {\"type\": \"text\", \"name\": \"\"},\n\"type\": \"value\"\n}', '', 0, NULL, NULL, 'SELECT\n t1.`year`,\n t2.id,\r\n t2.title\nFROM\n ( SELECT DISTINCT YEAR ( `date` ) AS \'year\' FROM zt_action ) AS t1\n LEFT JOIN ( SELECT id, title, YEAR ( openedDate ) AS `year` FROM zt_story WHERE deleted = \'0\' ) AS t2 ON t1.`year` = t2.`year` \r\n WHERE t2.id IS NOT NULL', 'published', 1, '', '', NULL, '', NULL, 0), @@ -14194,8 +14194,8 @@ INSERT INTO `zt_chart`(`id`, `name`, `dimension`, `type`, `group`, `dataset`, `d (1091, '年度排行-项目集-完成需求条目榜', 1, 'bar', '43', '', '', '{\"xaxis\":[{\"field\":\"program\",\"name\":\"项目集\"}],\"yaxis\":[{\"type\":\"value\",\"field\":\"story\",\"agg\":\"value\",\"name\":\"完成需求条目\",\"valOrAgg\":\"value\"}]}', '', 0, NULL, NULL, 'SELECT \r\n YEAR(t3.closedDate) AS `year`, \r\n t1.id,\r\n t1.name AS program, \r\n COUNT(1) AS story \r\nFROM \r\n zt_project AS t1 \r\n LEFT JOIN zt_product AS t2 ON t1.id = t2.program \r\n AND t2.deleted = \'0\' \r\n LEFT JOIN zt_story AS t3 ON t2.id = t3.product \r\n AND t3.deleted = \'0\' \r\n AND t3.closedReason = \'done\' \r\nWHERE \r\n t1.deleted = \'0\' \r\n AND t1.type = \'program\' \r\n AND t1.grade = 1 \r\n AND t3.id IS NOT NULL \r\nGROUP BY \r\n `year`,\r\n id, \r\n program \r\nORDER BY \r\n `year`, \r\n story DESC', 'published', 1, '', '', NULL, '', NULL, 0), (1092, '年度排行-项目集-完成需求规模榜', 1, 'bar', '36', '', '', '{\"xaxis\":[{\"field\":\"program\",\"name\":\"项目集\"}],\"yaxis\":[{\"type\":\"value\",\"field\":\"story\",\"agg\":\"value\",\"name\":\"完成需求规模\",\"valOrAgg\":\"value\"}]}', '', 0, NULL, NULL, 'SELECT \r\n YEAR(t3.closedDate) AS `year`, \r\n t1.id,\r\n t1.name AS program, \r\n ROUND(\r\n SUM(t3.estimate), \r\n 2\r\n ) AS story \r\nFROM \r\n zt_project AS t1 \r\n LEFT JOIN zt_product AS t2 ON t1.id = t2.program \r\n AND t2.deleted = \'0\' \r\n LEFT JOIN zt_story AS t3 ON t2.id = t3.product \r\n AND t3.deleted = \'0\' \r\n AND t3.closedReason = \'done\' \r\nWHERE \r\n t1.deleted = \'0\' \r\n AND t1.type = \'program\' \r\n AND t1.grade = 1 \r\n AND t3.id IS NOT NULL \r\nGROUP BY \r\n `year`, \r\n id,\r\n program \r\nORDER BY \r\n `year`, \r\n story DESC', 'published', 1, '', '', NULL, '', NULL, 0), (1093, '年度排行-项目集-修复Bug条目榜', 1, 'bar', '44', '', '', '{\"xaxis\":[{\"field\":\"program\",\"name\":\"项目集\"}],\"yaxis\":[{\"type\":\"value\",\"field\":\"bug\",\"agg\":\"value\",\"name\":\"修复Bug条目\",\"valOrAgg\":\"value\"}]}', '', 0, '', NULL, 'SELECT \r\n YEAR(t3.closedDate) AS `year`,\r\n t1.id, \r\n t1.name AS program, \r\n COUNT(1) AS bug \r\nFROM \r\n zt_project AS t1 \r\n LEFT JOIN zt_product AS t2 ON t1.id = t2.program \r\n AND t2.deleted = \'0\' \r\n LEFT JOIN zt_bug AS t3 ON t2.id = t3.product \r\n AND t3.deleted = \'0\' \r\n AND t3.resolution = \'fixed\' \r\n AND t3.status = \'closed\' \r\nWHERE \r\n t1.deleted = \'0\' \r\n AND t1.type = \'program\' \r\n AND t1.grade = 1 \r\n AND t3.id IS NOT NULL \r\nGROUP BY \r\n `year`, \r\n id,\r\n program \r\nORDER BY \r\n `year`, \r\n bug DESC', 'published', 1, '', '', NULL, '', NULL, 0), -(1094, '年度排行-项目-工期榜', 1, 'bar', '42', '', '', '{\"xaxis\":[{\"field\":\"name\",\"name\":\"项目\"}],\"yaxis\":[{\"type\":\"value\",\"field\":\"duration\",\"agg\":\"value\",\"name\":\"工期\",\"valOrAgg\":\"value\"}]}', '', 0, NULL, NULL, 'SELECT `year`, id,name,status,realBegan,realEnd,IF(status = \'closed\', DATEDIFF(realEnd, realBegan), DATEDIFF(NOW(),realBegan)) as duration\r\nFROM (SELECT DISTINCT YEAR(`date`) as \'year\' FROM zt_action) AS t1\r\nLEFT JOIN zt_project AS t2 ON 1 = 1 WHERE deleted = \'0\' AND type = \'project\' AND YEAR(realBegan) <= `year` AND LEFT(realBegan, 4) != \'0000\' AND (status =\'doing\' OR (status = \'suspended\' AND YEAR(suspendedDate) >= `year`) OR (status = \'closed\' AND YEAR(realEnd) >= `year`)) HAVING 1=1 ORDER BY `year`, duration desc', 'published', 1, '', '', NULL, '', NULL, 0), -(1096, '年度排行-项目-工期偏差榜', 1, 'bar', '42', '', '', '{\"xaxis\":[{\"field\":\"name\",\"name\":\"项目\"}],\"yaxis\":[{\"type\":\"value\",\"field\":\"duration\",\"agg\":\"value\",\"name\":\"工期\",\"valOrAgg\":\"value\"}]}', '', 0, NULL, NULL, 'SELECT `year`, id,name,status,`begin`,`end`,realBegan,realEnd,\nROUND((IF(LEFT(realEnd,4) != \'0000\', DATEDIFF(realEnd, realBegan), DATEDIFF(NOW(),realBegan)) - DATEDIFF(`end`, `begin`)) / DATEDIFF(`end`,`begin`) * 100) as duration\nFROM (SELECT DISTINCT YEAR(`date`) as \'year\' FROM zt_action) AS t1\nLEFT JOIN zt_project AS t2 ON 1 = 1 \nWHERE deleted = \'0\' AND type = \'project\'\nAND YEAR(realBegan) <= `year` AND LEFT(realBegan, 4) != \'0000\'\nAND (YEAR(realEnd) >= `year` OR LEFT(realEnd, 4) = \'0000\') AND YEAR(`end`) != \'2059\'\nHAVING 1=1\nORDER BY duration ASC', 'published', 1, '', '', NULL, '', NULL, 0), +(1094, '年度排行-项目-工期榜', 1, 'bar', '42', '', '', '{\"xaxis\":[{\"field\":\"name\",\"name\":\"项目\"}],\"yaxis\":[{\"type\":\"value\",\"field\":\"duration\",\"agg\":\"value\",\"name\":\"工期\",\"valOrAgg\":\"value\"}]}', '', 0, NULL, NULL, 'SELECT `year`, id,name,status,realBegan,realEnd,IF(status = \'closed\', DATEDIFF(realEnd, realBegan), DATEDIFF(NOW(),realBegan)) as duration\r\nFROM (SELECT DISTINCT YEAR(`date`) as \'year\' FROM zt_action) AS t1\r\nLEFT JOIN zt_project AS t2 ON 1 = 1 WHERE deleted = \'0\' AND type = \'project\' AND YEAR(realBegan) <= `year` AND realBegan != null AND (status =\'doing\' OR (status = \'suspended\' AND YEAR(suspendedDate) >= `year`) OR (status = \'closed\' AND YEAR(realEnd) >= `year`)) HAVING 1=1 ORDER BY `year`, duration desc', 'published', 1, '', '', NULL, '', NULL, 0), +(1096, '年度排行-项目-工期偏差榜', 1, 'bar', '42', '', '', '{\"xaxis\":[{\"field\":\"name\",\"name\":\"项目\"}],\"yaxis\":[{\"type\":\"value\",\"field\":\"duration\",\"agg\":\"value\",\"name\":\"工期\",\"valOrAgg\":\"value\"}]}', '', 0, NULL, NULL, 'SELECT `year`, id,name,status,`begin`,`end`,realBegan,realEnd,\nROUND((IF(realEnd != null, DATEDIFF(realEnd, realBegan), DATEDIFF(NOW(),realBegan)) - DATEDIFF(`end`, `begin`)) / DATEDIFF(`end`,`begin`) * 100) as duration\nFROM (SELECT DISTINCT YEAR(`date`) as \'year\' FROM zt_action) AS t1\nLEFT JOIN zt_project AS t2 ON 1 = 1 \nWHERE deleted = \'0\' AND type = \'project\'\nAND YEAR(realBegan) <= `year` AND realBegan != null\nAND (YEAR(realEnd) >= `year` OR realEnd = null) AND YEAR(`end`) != \'2059\'\nHAVING 1=1\nORDER BY duration ASC', 'published', 1, '', '', NULL, '', NULL, 0), (1097, '年度排行-项目-人员投入榜', 1, 'bar', '41', '', '', '{\"xaxis\":[{\"field\":\"name\",\"name\":\"项目\"}],\"yaxis\":[{\"type\":\"value\",\"field\":\"number\",\"agg\":\"value\",\"name\":\"人数\",\"valOrAgg\":\"value\"}]}', '', 0, '', NULL, 'SELECT tt.join as `year`, count(1) as number, tt.name from (\r\nselect \r\nt2.name, YEAR(t1.join) as `join`\r\nfrom zt_team t1 \r\nRIGHT JOIN zt_project t2 on t2.id = t1.root\r\nRIGHT JOIN zt_user t3 on t3.account = t1.account\r\nWHERE t1.type = \'project\'\r\nAND t2.deleted = \'0\'\r\n) tt\r\nGROUP BY tt.`name`, tt.join\r\nORDER BY tt.join, number desc, tt.name', 'published', 1, '', '', NULL, '', NULL, 0), (1098, '年度排行-项目-工时消耗榜', 1, 'bar', '41', '', '', '{\"xaxis\":[{\"field\":\"project\",\"name\":\"项目\"}],\"yaxis\":[{\"type\":\"value\",\"field\":\"consumed\",\"agg\":\"value\",\"name\":\"消耗工时\",\"valOrAgg\":\"value\"}]}', '', 0, NULL, NULL, 'SELECT \r\n YEAR(t4.date) AS `year`,\r\n t1.id, \r\n t1.name AS project, \r\n ROUND(\r\n SUM(t4.consumed), \r\n 2\r\n ) AS consumed \r\nFROM \r\n zt_project AS t1 \r\n LEFT JOIN zt_project AS t2 ON t1.id = t2.parent \r\n AND t2.deleted = \'0\' \r\n AND t2.type IN (\'sprint\', \'stage\', \'kanban\') \r\n LEFT JOIN zt_task AS t3 ON t2.id = t3.execution \r\n AND t3.deleted = \'0\' \r\n AND t3.status != \'cancel\' \r\n LEFT JOIN zt_effort AS t4 ON t3.id = t4.objectID \r\n AND t4.deleted = \'0\' \r\n AND t4.objectType = \'task\' \r\nWHERE \r\n t1.deleted = \'0\' \r\n AND t1.type = \'project\' \r\n AND t4.id IS NOT NULL \r\nGROUP BY \r\n `year`, \r\n id,\r\n project \r\nORDER BY \r\n `year`, \r\n consumed DESC', 'published', 1, '', '', NULL, '', NULL, 0), (1099, '年度排行-项目-完成需求条目榜', 1, 'bar', '36', '', '', '{\"xaxis\":[{\"field\":\"project\",\"name\":\"项目\"}],\"yaxis\":[{\"type\":\"value\",\"field\":\"story\",\"agg\":\"value\",\"name\":\"完成需求条目\",\"valOrAgg\":\"value\"}]}', '', 0, NULL, NULL, 'SELECT \r\n YEAR(t1.closedDate) AS `year`, \r\n t1.id, \r\n t1.project, \r\n COUNT(1) AS story \r\nFROM \r\n (\r\n SELECT \r\n DISTINCT t1.id, \r\n t1.name AS project, \r\n t4.id AS story, \r\n t4.closedDate \r\n FROM \r\n zt_project AS t1 \r\n LEFT JOIN zt_project AS t2 ON t1.id = t2.parent \r\n AND t2.deleted = \'0\' \r\n AND t2.type IN (\'sprint\', \'stage\', \'kanban\') \r\n LEFT JOIN zt_projectstory AS t3 ON t2.id = t3.project \r\n LEFT JOIN zt_story AS t4 ON t3.story = t4.id \r\n AND t4.deleted = \'0\' \r\n AND t4.closedReason = \'done\' \r\n WHERE \r\n t1.deleted = \'0\' \r\n AND t1.type = \'project\' \r\n AND t4.id IS NOT NULL\r\n ) AS t1 \r\nGROUP BY \r\n `year`, \r\n id, \r\n project \r\nORDER BY \r\n `year`, \r\n story DESC', 'published', 1, '', '', NULL, '', NULL, 0), @@ -14211,27 +14211,27 @@ INSERT INTO `zt_chart`(`id`, `name`, `dimension`, `type`, `group`, `dataset`, `d (1109, '年度排行-个人-工时消耗榜', 1, 'bar', '56', '', '', '{\"xaxis\":[{\"field\":\"realname\",\"name\":\"用户\"}],\"yaxis\":[{\"type\":\"value\",\"field\":\"consumed\",\"agg\":\"value\",\"name\":\"消耗工时\",\"valOrAgg\":\"value\"}]}', '', 0, NULL, NULL, 'SELECT YEAR(t1.date) AS `year`, t2.realname, ROUND(SUM(t1.consumed),1) AS consumed\nFROM zt_effort AS t1 LEFT JOIN zt_user AS t2 ON t1.account = t2.account\nWHERE t1.deleted = \'0\' AND t2.deleted = \'0\'\nGROUP BY `year`, realname\nORDER BY `year`, consumed DESC', 'published', 1, '', '', NULL, '', NULL, 0), (1110, '年度排行-个人-禅道操作次数榜', 1, 'bar', '56', '', '', '{\"xaxis\":[{\"field\":\"realname\",\"name\":\"用户\"}],\"yaxis\":[{\"type\":\"value\",\"field\":\"count\",\"agg\":\"value\",\"name\":\"操作次数\",\"valOrAgg\":\"value\"}]}', '', 0, NULL, NULL, 'SELECT YEAR(t1.date) AS `year`,IFNULL(t2.realname,t1.actor) AS realname,count(1) AS count\r\nFROM zt_action t1 LEFT JOIN zt_user AS t2 ON t1.actor=t2.account\r\nGROUP BY `year`,t1.actor\r\nORDER BY `year`, `count` DESC', 'published', 1, '', '', NULL, '', NULL, 0), (10000, '年度完成项目-完成项目数', 2, 'card', '72', '0', '', '{\"value\": {\"type\": \"agg\", \"field\": \"number\", \"agg\": \"sum\"}, \"title\": {\"type\": \"text\", \"name\": \"\"},\r\n\"type\": \"value\"\r\n}', '[]', 0, '', '', 'SELECT COUNT(1) AS number,YEAR(`closedDate`) AS \'year\' FROM zt_project WHERE type=\'project\' AND status=\'closed\' AND deleted=\'0\' GROUP BY `year`', 'published', 1, '', 'admin', '2022-12-07 14:59:41', '', '2022-12-07 14:59:41', 0), -(10001, '年度完成项目-按时完成项目数', 2, 'card', '72', '0', '', '{\"value\": {\"type\": \"agg\", \"field\": \"number\", \"agg\": \"sum\"}, \"title\": {\"type\": \"text\", \"name\": \"\"},\r\n\"type\": \"value\"\r\n}', '[]', 0, '', '', 'SELECT COUNT(1) AS number,YEAR(`closedDate`) as \'year\' FROM (SELECT id, begin, end, IF(left(realEnd, 4) = \'0000\', LEFT(closedDate,10), realEnd) AS realEnd,closedDate FROM zt_project WHERE deleted=\'0\' AND type=\'project\' AND status=\'closed\') t1 WHERE t1.realEnd<=end GROUP BY `year`', 'published', 1, '', 'admin', '2022-12-07 14:59:41', '', '2022-12-07 14:59:41', 0), -(10002, '年度完成项目-延期完成项目数', 2, 'card', '72', '0', '', '{\"value\": {\"type\": \"agg\", \"field\": \"number\", \"agg\": \"sum\"}, \"title\": {\"type\": \"text\", \"name\": \"\"},\r\n\"type\": \"value\"\r\n}', '[]', 0, '', '', 'SELECT COUNT(1) AS number,YEAR(`closedDate`) AS \'year\' FROM (SELECT id, begin, end, IF(left(realEnd, 4) = \'0000\', LEFT(closedDate,10), realEnd) AS realEnd,closedDate FROM zt_project WHERE deleted=\'0\' AND type=\'project\' AND status=\'closed\') t1 WHERE t1.realEnd>end GROUP BY `year`', 'published', 1, '', 'admin', '2022-12-07 14:59:41', '', '2022-12-07 14:59:41', 0), +(10001, '年度完成项目-按时完成项目数', 2, 'card', '72', '0', '', '{\"value\": {\"type\": \"agg\", \"field\": \"number\", \"agg\": \"sum\"}, \"title\": {\"type\": \"text\", \"name\": \"\"},\r\n\"type\": \"value\"\r\n}', '[]', 0, '', '', 'SELECT COUNT(1) AS number,YEAR(`closedDate`) as \'year\' FROM (SELECT id, begin, end, IF(realEnd = null, LEFT(closedDate,10), realEnd) AS realEnd,closedDate FROM zt_project WHERE deleted=\'0\' AND type=\'project\' AND status=\'closed\') t1 WHERE t1.realEnd<=end GROUP BY `year`', 'published', 1, '', 'admin', '2022-12-07 14:59:41', '', '2022-12-07 14:59:41', 0), +(10002, '年度完成项目-延期完成项目数', 2, 'card', '72', '0', '', '{\"value\": {\"type\": \"agg\", \"field\": \"number\", \"agg\": \"sum\"}, \"title\": {\"type\": \"text\", \"name\": \"\"},\r\n\"type\": \"value\"\r\n}', '[]', 0, '', '', 'SELECT COUNT(1) AS number,YEAR(`closedDate`) AS \'year\' FROM (SELECT id, begin, end, IF(realEnd = null, LEFT(closedDate,10), realEnd) AS realEnd,closedDate FROM zt_project WHERE deleted=\'0\' AND type=\'project\' AND status=\'closed\') t1 WHERE t1.realEnd>end GROUP BY `year`', 'published', 1, '', 'admin', '2022-12-07 14:59:41', '', '2022-12-07 14:59:41', 0), (10003, '年度完成项目-完成需求条目数', 2, 'card', '75', '0', '', '{\"value\": {\"type\": \"agg\", \"field\": \"number\", \"agg\": \"sum\"}, \"title\": {\"type\": \"text\", \"name\": \"\"},\r\n\"type\": \"value\"\r\n}', '[]', 0, '', '', 'SELECT COUNT(1) AS number,YEAR(`closedDate`) AS \'year\' FROM zt_story WHERE deleted=\'0\' AND status=\'closed\' AND closedReason=\'done\' GROUP BY `year`', 'published', 1, '', 'admin', '2022-12-07 14:59:41', '', '2022-12-07 14:59:41', 0), (10004, '年度完成项目-完成需求规模数', 2, 'card', '75', '0', '', '{\"value\": {\"type\": \"agg\", \"field\": \"number\", \"agg\": \"sum\"}, \"title\": {\"type\": \"text\", \"name\": \"\"},\r\n\"type\": \"value\"\r\n}', '[]', 0, '', '', 'SELECT ROUND(SUM(estimate),2) AS number,YEAR(`closedDate`) AS \'year\' FROM zt_story WHERE deleted=\'0\' AND status=\'closed\' AND closedReason=\'done\' GROUP BY `year`', 'published', 1, '', 'admin', '2022-12-07 14:59:41', '', '2022-12-07 14:59:41', 0), (10005, '年度完成项目-完成发布数', 2, 'card', '74', '0', '', '{\"value\": {\"type\": \"agg\", \"field\": \"number\", \"agg\": \"sum\"}, \"title\": {\"type\": \"text\", \"name\": \"\"},\r\n\"type\": \"value\"\r\n}', '[]', 0, '', '', 'SELECT COUNT(1) AS number,YEAR(`date`) AS \'year\' FROM zt_release WHERE deleted=\'0\' GROUP BY `year`', 'published', 1, '', 'admin', '2022-12-07 14:59:41', '', '2022-12-07 14:59:41', 0), (10006, '年度完成项目-解决bug数', 2, 'card', '77', '0', '', '{\"value\": {\"type\": \"agg\", \"field\": \"number\", \"agg\": \"sum\"}, \"title\": {\"type\": \"text\", \"name\": \"\"},\r\n\"type\": \"value\"\r\n}', '[]', 0, '', '', 'SELECT SUM(CASE WHEN resolution=\'fixed\' THEN 1 ELSE 0 END) AS number,YEAR(`resolvedDate`) AS \'year\' FROM zt_bug WHERE deleted=\'0\' GROUP BY `year`', 'published', 1, '', 'admin', '2022-12-07 14:59:41', '', '2022-12-07 14:59:41', 0), (10007, '年度完成项目-完成执行数', 2, 'card', '73', '0', '', '{\"value\": {\"type\": \"agg\", \"field\": \"number\", \"agg\": \"sum\"}, \"title\": {\"type\": \"text\", \"name\": \"\"},\r\n\"type\": \"value\"\r\n}', '[]', 0, '', '', 'SELECT COUNT(1) AS number,YEAR(`closedDate`) AS \'year\' FROM zt_project WHERE type=\'sprint\' AND status=\'closed\' AND deleted=\'0\' GROUP BY `year`', 'published', 1, '', 'admin', '2022-12-07 14:59:41', '', '2022-12-07 14:59:41', 0), -(10008, '年度完成项目-按时完成执行数', 2, 'card', '73', '0', '', '{\"value\": {\"type\": \"agg\", \"field\": \"number\", \"agg\": \"sum\"}, \"title\": {\"type\": \"text\", \"name\": \"\"},\r\n\"type\": \"value\"\r\n}', '[]', 0, '', '', 'SELECT COUNT(1) AS number,YEAR(`closedDate`) AS \'year\' FROM (SELECT id, begin, end, IF(LEFT(realEnd,4) = \'0000\', LEFT(closedDate,10), realEnd) AS realEnd,closedDate FROM zt_project WHERE deleted=\'0\' AND type=\'sprint\' AND status=\'closed\') t1 WHERE t1.realEnd<=end GROUP BY `year`', 'published', 1, '', 'admin', '2022-12-07 14:59:41', '', '2022-12-07 14:59:41', 0), -(10009, '年度完成项目-延期完成执行数', 2, 'card', '73', '0', '', '{\"value\": {\"type\": \"agg\", \"field\": \"number\", \"agg\": \"sum\"}, \"title\": {\"type\": \"text\", \"name\": \"\"},\r\n\"type\": \"value\"\r\n}', '[]', 0, '', '', 'SELECT COUNT(1) AS number,YEAR(`closedDate`) AS \'year\' FROM (SELECT id, begin, end, IF(LEFT(realEnd, 4) = \'0000\', LEFT(closedDate,10), realEnd) AS realEnd, closedDate FROM zt_project WHERE deleted=\'0\' AND type=\'sprint\' AND status=\'closed\') t1 WHERE t1.realEnd>end GROUP BY `year`', 'published', 1, '', 'admin', '2022-12-07 14:59:41', '', '2022-12-07 14:59:41', 0), +(10008, '年度完成项目-按时完成执行数', 2, 'card', '73', '0', '', '{\"value\": {\"type\": \"agg\", \"field\": \"number\", \"agg\": \"sum\"}, \"title\": {\"type\": \"text\", \"name\": \"\"},\r\n\"type\": \"value\"\r\n}', '[]', 0, '', '', 'SELECT COUNT(1) AS number,YEAR(`closedDate`) AS \'year\' FROM (SELECT id, begin, end, IF(realEnd = null, LEFT(closedDate,10), realEnd) AS realEnd,closedDate FROM zt_project WHERE deleted=\'0\' AND type=\'sprint\' AND status=\'closed\') t1 WHERE t1.realEnd<=end GROUP BY `year`', 'published', 1, '', 'admin', '2022-12-07 14:59:41', '', '2022-12-07 14:59:41', 0), +(10009, '年度完成项目-延期完成执行数', 2, 'card', '73', '0', '', '{\"value\": {\"type\": \"agg\", \"field\": \"number\", \"agg\": \"sum\"}, \"title\": {\"type\": \"text\", \"name\": \"\"},\r\n\"type\": \"value\"\r\n}', '[]', 0, '', '', 'SELECT COUNT(1) AS number,YEAR(`closedDate`) AS \'year\' FROM (SELECT id, begin, end, IF(realEnd = null, LEFT(closedDate,10), realEnd) AS realEnd, closedDate FROM zt_project WHERE deleted=\'0\' AND type=\'sprint\' AND status=\'closed\') t1 WHERE t1.realEnd>end GROUP BY `year`', 'published', 1, '', 'admin', '2022-12-07 14:59:41', '', '2022-12-07 14:59:41', 0), (10010, '年度完成项目-完成任务条目数', 2, 'card', '76', '0', '', '{\"value\": {\"type\": \"agg\", \"field\": \"number\", \"agg\": \"sum\"}, \"title\": {\"type\": \"text\", \"name\": \"\"},\r\n\"type\": \"value\"\r\n}', '[]', 0, '', '', 'SELECT COUNT(1) AS number,YEAR(`closedDate`) AS \'year\' FROM zt_task WHERE deleted=\'0\' AND status=\'closed\' AND closedReason=\'done\' GROUP BY `year`', 'published', 1, '', 'admin', '2022-12-07 14:59:41', '', '2022-12-07 14:59:41', 0), (10011, '年度完成项目-完成任务预计工时数', 2, 'card', '78', '0', '', '{\"value\": {\"type\": \"agg\", \"field\": \"number\", \"agg\": \"sum\"}, \"title\": {\"type\": \"text\", \"name\": \"\"},\r\n\"type\": \"value\"\r\n}', '[]', 0, '', '', 'SELECT ROUND(SUM(estimate),2) AS number,YEAR(`closedDate`) AS \'year\' FROM zt_task WHERE deleted=\'0\' AND status=\'closed\' AND closedReason=\'done\' GROUP BY `year`', 'published', 1, '', 'admin', '2022-12-07 14:59:41', '', '2022-12-07 14:59:41', 0), (10012, '年度完成项目-完成任务消耗工时数', 2, 'card', '78', '0', '', '{\"value\": {\"type\": \"agg\", \"field\": \"number\", \"agg\": \"sum\"}, \"title\": {\"type\": \"text\", \"name\": \"\"},\r\n\"type\": \"value\"\r\n}', '[]', 0, '', '', 'SELECT ROUND(SUM(consumed),2) AS number,YEAR(`closedDate`) AS \'year\' FROM zt_task WHERE deleted=\'0\' AND status=\'closed\' AND closedReason=\'done\' GROUP BY `year`', 'published', 1, '', 'admin', '2022-12-07 14:59:41', '', '2022-12-07 14:59:41', 0), -(10013, '年度完成项目-投入的总人天', 2, 'card', '78', '0', '', '{\"value\": {\"type\": \"agg\", \"field\": \"number\", \"agg\": \"sum\"}, \"title\": {\"type\": \"text\", \"name\": \"\"},\r\n\"type\": \"value\"\r\n}', '[]', 0, '', '', 'SELECT SUM(t2.people*DATEDIFF(t1.realEnd,t1.realBegan)) AS number,YEAR(`closedDate`) AS \'year\' FROM (SELECT id, realBegan, IF(LEFT(realEnd, 4) = \'0000\', closedDate, realEnd) AS realEnd, closedDate FROM zt_project WHERE deleted=\'0\' AND status=\'closed\' AND type=\'project\' AND realBegan != null) t1 LEFT JOIN (SELECT root, COUNT(id) people FROM zt_team WHERE type=\'project\' GROUP BY `root`) t2 ON t1.id=t2.root GROUP BY `year`', 'published', 1, '', 'admin', '2022-12-07 14:59:41', '', '2022-12-07 14:59:41', 0), -(10014, '年度完成项目-项目按期完成率', 2, 'piecircle', '71', '0', '', '{\"group\":[{\"field\":\"status\",\"name\":\"状态\"}],\"metric\":[{\"type\":\"agg\",\"field\":\"id\",\"agg\":\"count\",\"name\":\"需求数\",\"valOrAgg\":\"count\"}]}', '[]', 0, '', '', 'SELECT t1.id,IF(t1.realEnd<=t1.end,\'done\',\'undone\') AS \'status\', YEAR(`closedDate`) AS \'year\' FROM(SELECT id, begin, end, IF(LEFT(realEnd, 4) = \'0000\', LEFT(closedDate,10), realEnd) AS realEnd, closedDate FROM zt_project WHERE deleted=\'0\' AND type=\'project\' AND status=\'closed\') t1', 'published', 1, '', 'admin', '2022-12-07 14:59:41', '', '2022-12-07 14:59:41', 0), -(10015, '年度完成项目-执行按期完成率', 2, 'piecircle', '71', '0', '', '{\"group\":[{\"field\":\"status\",\"name\":\"状态\"}],\"metric\":[{\"type\":\"agg\",\"field\":\"id\",\"agg\":\"count\",\"name\":\"需求数\",\"valOrAgg\":\"count\"}]}', '[]', 0, '', '', 'SELECT IF(t1.realEnd<=t1.end,\'done\',\'undone\') AS \'status\', YEAR(`closedDate`) AS \'year\' FROM (SELECT id, begin, end, IF(LEFT(realEnd,4)=\'0000\',LEFT(closedDate,10), realEnd) AS realEnd, closedDate FROM zt_project WHERE deleted=\'0\' and type=\'sprint\' and status=\'closed\') t1', 'published', 1, '', 'admin', '2022-12-07 14:59:41', '', '2022-12-07 14:59:41', 0), -(10016, '年度完成项目-项目延期率', 2, 'piecircle', '71', '0', '', '{\"group\":[{\"field\":\"status\",\"name\":\"状态\"}],\"metric\":[{\"type\":\"agg\",\"field\":\"id\",\"agg\":\"count\",\"name\":\"需求数\",\"valOrAgg\":\"count\"}]}', '[]', 0, '', '', 'SELECT IF(t1.realEnd>t1.end ,\'done\',\'undone\') AS \'status\', YEAR(`closedDate`) AS \'year\' FROM (SELECT id, begin, end, IF(LEFT(realEnd, 4) = \'0000\', LEFT(closedDate,10), realEnd) AS realEnd, closedDate FROM zt_project WHERE deleted=\'0\' AND type=\'project\' AND status=\'closed\') t1', 'published', 1, '', 'admin', '2022-12-07 14:59:41', '', '2022-12-07 14:59:41', 0), -(10017, '年度完成项目-执行延期率', 2, 'piecircle', '71', '0', '', '{\"group\":[{\"field\":\"status\",\"name\":\"状态\"}],\"metric\":[{\"type\":\"agg\",\"field\":\"id\",\"agg\":\"count\",\"name\":\"需求数\",\"valOrAgg\":\"count\"}]}', '[]', 0, '', '', 'SELECT IF(t1.realEnd>t1.end,\'done\',\'undone\') AS \'status\', YEAR(`closedDate`) AS \'year\' FROM(SELECT id, begin, end, IF(LEFT(realEnd, 4) = \'0000\', LEFT(closedDate,10), realEnd) AS realEnd, closedDate FROM zt_project WHERE deleted=\'0\' and type=\'sprint\' and status=\'closed\') t1', 'published', 1, '', 'admin', '2022-12-07 14:59:41', '', '2022-12-07 14:59:41', 0), -(10018, '年度完成项目-完成项目工期偏差条形图', 2, 'pie', '71', '0', '', '[{\"type\":\"cluBarY\",\"xaxis\":[{\"field\":\"name\",\"name\":\"\\u9879\\u76ee\\u540d\\u79f0\",\"group\":\"\"}],\"yaxis\":[{\"field\":\"daterate\",\"name\":\"daterate\",\"valOrAgg\":\"sum\"}]}]', '[{\"field\":\"closedDate\",\"type\":\"date\",\"name\":\"\\u5173\\u95ed\\u65e5\\u671f\",\"default\":{\"begin\":\"\",\"end\":\"\"}}]', 0, '{\"name\":{\"name\":\"\\u9879\\u76ee\\u540d\\u79f0\",\"object\":\"project\",\"field\":\"name\",\"type\":\"string\"},\"closedDate\":{\"name\":\"\\u5173\\u95ed\\u65e5\\u671f\",\"object\":\"project\",\"field\":\"closedDate\",\"type\":\"date\"},\"daterate\":{\"name\":\"daterate\",\"object\":\"project\",\"field\":\"daterate\",\"type\":\"number\"}}', '{\"name\":{\"zh-cn\":\"\\u9879\\u76ee\\u540d\\u79f0\",\"zh-tw\":\"\",\"en\":\"\",\"de\":\"\",\"fr\":\"\"},\"closedDate\":{\"zh-cn\":\"\\u5173\\u95ed\\u65e5\\u671f\",\"zh-tw\":\"\",\"en\":\"\",\"de\":\"\",\"fr\":\"\"},\"daterate\":{\"zh-cn\":\"\\u5de5\\u671f\\u504f\\u5dee\\u7387\",\"zh-tw\":\"\",\"en\":\"\",\"de\":\"\",\"fr\":\"\"}}', 'select\nt1.name,\nt1.closedDate,\nround(t1.realduration-t1.planduration)/t1.planduration as daterate\nfrom(\nselect\nname,\nid,\nclosedDate,\nbegin,\nend,\ndatediff(`end`,`begin`) planduration,\nrealBegan,\nrealEnd,\nifnull(if(left(realEnd,4) != \'0000\',datediff(`realEnd`,`realBegan`),datediff(`closedDate`,`realBegan`)),0) realduration\nfrom\nzt_project\nwhere deleted=\'0\'\nand status=\'closed\'\nand type=\'project\'\n) t1', 'published', 1, '', 'admin', '2023-04-06 12:18:07', 'admin', '2023-04-06 12:18:07', 0), +(10013, '年度完成项目-投入的总人天', 2, 'card', '78', '0', '', '{\"value\": {\"type\": \"agg\", \"field\": \"number\", \"agg\": \"sum\"}, \"title\": {\"type\": \"text\", \"name\": \"\"},\r\n\"type\": \"value\"\r\n}', '[]', 0, '', '', 'SELECT SUM(t2.people*DATEDIFF(t1.realEnd,t1.realBegan)) AS number,YEAR(`closedDate`) AS \'year\' FROM (SELECT id, realBegan, IF(realEnd = null, closedDate, realEnd) AS realEnd, closedDate FROM zt_project WHERE deleted=\'0\' AND status=\'closed\' AND type=\'project\' AND realBegan != null) t1 LEFT JOIN (SELECT root, COUNT(id) people FROM zt_team WHERE type=\'project\' GROUP BY `root`) t2 ON t1.id=t2.root GROUP BY `year`', 'published', 1, '', 'admin', '2022-12-07 14:59:41', '', '2022-12-07 14:59:41', 0), +(10014, '年度完成项目-项目按期完成率', 2, 'piecircle', '71', '0', '', '{\"group\":[{\"field\":\"status\",\"name\":\"状态\"}],\"metric\":[{\"type\":\"agg\",\"field\":\"id\",\"agg\":\"count\",\"name\":\"需求数\",\"valOrAgg\":\"count\"}]}', '[]', 0, '', '', 'SELECT t1.id,IF(t1.realEnd<=t1.end,\'done\',\'undone\') AS \'status\', YEAR(`closedDate`) AS \'year\' FROM(SELECT id, begin, end, IF(realEnd = null, LEFT(closedDate,10), realEnd) AS realEnd, closedDate FROM zt_project WHERE deleted=\'0\' AND type=\'project\' AND status=\'closed\') t1', 'published', 1, '', 'admin', '2022-12-07 14:59:41', '', '2022-12-07 14:59:41', 0), +(10015, '年度完成项目-执行按期完成率', 2, 'piecircle', '71', '0', '', '{\"group\":[{\"field\":\"status\",\"name\":\"状态\"}],\"metric\":[{\"type\":\"agg\",\"field\":\"id\",\"agg\":\"count\",\"name\":\"需求数\",\"valOrAgg\":\"count\"}]}', '[]', 0, '', '', 'SELECT IF(t1.realEnd<=t1.end,\'done\',\'undone\') AS \'status\', YEAR(`closedDate`) AS \'year\' FROM (SELECT id, begin, end, IF(realEnd= null,LEFT(closedDate,10), realEnd) AS realEnd, closedDate FROM zt_project WHERE deleted=\'0\' and type=\'sprint\' and status=\'closed\') t1', 'published', 1, '', 'admin', '2022-12-07 14:59:41', '', '2022-12-07 14:59:41', 0), +(10016, '年度完成项目-项目延期率', 2, 'piecircle', '71', '0', '', '{\"group\":[{\"field\":\"status\",\"name\":\"状态\"}],\"metric\":[{\"type\":\"agg\",\"field\":\"id\",\"agg\":\"count\",\"name\":\"需求数\",\"valOrAgg\":\"count\"}]}', '[]', 0, '', '', 'SELECT IF(t1.realEnd>t1.end ,\'done\',\'undone\') AS \'status\', YEAR(`closedDate`) AS \'year\' FROM (SELECT id, begin, end, IF(realEnd = null, LEFT(closedDate,10), realEnd) AS realEnd, closedDate FROM zt_project WHERE deleted=\'0\' AND type=\'project\' AND status=\'closed\') t1', 'published', 1, '', 'admin', '2022-12-07 14:59:41', '', '2022-12-07 14:59:41', 0), +(10017, '年度完成项目-执行延期率', 2, 'piecircle', '71', '0', '', '{\"group\":[{\"field\":\"status\",\"name\":\"状态\"}],\"metric\":[{\"type\":\"agg\",\"field\":\"id\",\"agg\":\"count\",\"name\":\"需求数\",\"valOrAgg\":\"count\"}]}', '[]', 0, '', '', 'SELECT IF(t1.realEnd>t1.end,\'done\',\'undone\') AS \'status\', YEAR(`closedDate`) AS \'year\' FROM(SELECT id, begin, end, IF(realEnd = null, LEFT(closedDate,10), realEnd) AS realEnd, closedDate FROM zt_project WHERE deleted=\'0\' and type=\'sprint\' and status=\'closed\') t1', 'published', 1, '', 'admin', '2022-12-07 14:59:41', '', '2022-12-07 14:59:41', 0), +(10018, '年度完成项目-完成项目工期偏差条形图', 2, 'pie', '71', '0', '', '[{\"type\":\"cluBarY\",\"xaxis\":[{\"field\":\"name\",\"name\":\"\\u9879\\u76ee\\u540d\\u79f0\",\"group\":\"\"}],\"yaxis\":[{\"field\":\"daterate\",\"name\":\"daterate\",\"valOrAgg\":\"sum\"}]}]', '[{\"field\":\"closedDate\",\"type\":\"date\",\"name\":\"\\u5173\\u95ed\\u65e5\\u671f\",\"default\":{\"begin\":\"\",\"end\":\"\"}}]', 0, '{\"name\":{\"name\":\"\\u9879\\u76ee\\u540d\\u79f0\",\"object\":\"project\",\"field\":\"name\",\"type\":\"string\"},\"closedDate\":{\"name\":\"\\u5173\\u95ed\\u65e5\\u671f\",\"object\":\"project\",\"field\":\"closedDate\",\"type\":\"date\"},\"daterate\":{\"name\":\"daterate\",\"object\":\"project\",\"field\":\"daterate\",\"type\":\"number\"}}', '{\"name\":{\"zh-cn\":\"\\u9879\\u76ee\\u540d\\u79f0\",\"zh-tw\":\"\",\"en\":\"\",\"de\":\"\",\"fr\":\"\"},\"closedDate\":{\"zh-cn\":\"\\u5173\\u95ed\\u65e5\\u671f\",\"zh-tw\":\"\",\"en\":\"\",\"de\":\"\",\"fr\":\"\"},\"daterate\":{\"zh-cn\":\"\\u5de5\\u671f\\u504f\\u5dee\\u7387\",\"zh-tw\":\"\",\"en\":\"\",\"de\":\"\",\"fr\":\"\"}}', 'select\nt1.name,\nt1.closedDate,\nround(t1.realduration-t1.planduration)/t1.planduration as daterate\nfrom(\nselect\nname,\nid,\nclosedDate,\nbegin,\nend,\ndatediff(`end`,`begin`) planduration,\nrealBegan,\nrealEnd,\nifnull(if(realEnd != null,datediff(`realEnd`,`realBegan`),datediff(`closedDate`,`realBegan`)),0) realduration\nfrom\nzt_project\nwhere deleted=\'0\'\nand status=\'closed\'\nand type=\'project\'\n) t1', 'published', 1, '', 'admin', '2023-04-06 12:18:07', 'admin', '2023-04-06 12:18:07', 0), (10019, '年度完成项目-单位工时交付需求规模数对比图', 2, 'pie', '71', '0', '', '[{\"type\":\"cluBarX\",\"xaxis\":[{\"field\":\"project\",\"name\":\"\\u6240\\u5c5e\\u9879\\u76ee\",\"group\":\"\"}],\"yaxis\":[{\"field\":\"\\u5355\\u4f4d\\u65f6\\u95f4\\u4ea4\\u4ed8\\u9700\\u6c42\\u89c4\\u6a21\\u6570\",\"name\":\"\\u5355\\u4f4d\\u65f6\\u95f4\\u4ea4\\u4ed8\\u9700\\u6c42\\u89c4\\u6a21\\u6570\",\"valOrAgg\":\"sum\"}]}]', '[{\"field\":\"project\",\"type\":\"input\",\"name\":\"\\u6240\\u5c5e\\u9879\\u76ee\",\"default\":\"\"}]', 0, '{\"project\":{\"name\":\"\\u6240\\u5c5e\\u9879\\u76ee\",\"object\":\"project\",\"field\":\"project\",\"type\":\"string\"},\"\\u6545\\u4e8b\\u70b9\":{\"name\":\"\\u6545\\u4e8b\\u70b9\",\"object\":\"project\",\"field\":\"\\u6545\\u4e8b\\u70b9\",\"type\":\"number\"},\"\\u5de5\\u65f6\":{\"name\":\"\\u5de5\\u65f6\",\"object\":\"project\",\"field\":\"\\u5de5\\u65f6\",\"type\":\"number\"},\"\\u5355\\u4f4d\\u65f6\\u95f4\\u4ea4\\u4ed8\\u9700\\u6c42\\u89c4\\u6a21\\u6570\":{\"name\":\"\\u5355\\u4f4d\\u65f6\\u95f4\\u4ea4\\u4ed8\\u9700\\u6c42\\u89c4\\u6a21\\u6570\",\"object\":\"project\",\"field\":\"\\u5355\\u4f4d\\u65f6\\u95f4\\u4ea4\\u4ed8\\u9700\\u6c42\\u89c4\\u6a21\\u6570\",\"type\":\"number\"}}', '', 'select tt.*,\ntt.`故事点` / tt.`工时` as \"单位时间交付需求规模数\"\nfrom (\nselect\nt1.name as project, \n(\n select round(sum(t3.estimate), 1) from zt_projectstory t2\n left join zt_story t3 on t3.id= t2.story and t3.status=\'closed\' and t3.closedReason = \'done\'\n where t2.project = t1.id\n) as \"故事点\",\n(\n select round(sum(t5.consumed), 1) from zt_project t4\n left join zt_task t5 on t5.execution = t4.id and t5.deleted = \'0\' and t5.parent in (0, -1)\n where t4.project = t1.id and t4.type = \'sprint\'\n) as \"工时\"\nfrom zt_project t1\nwhere t1.status = \'closed\'\nand t1.deleted = \'0\'\nand t1.type = \'project\'\ngroup by t1.id) tt', 'published', 1, '', 'admin', '2023-04-06 13:41:05', 'admin', '2023-04-06 13:41:05', 0), -(10020, '年度完成项目-项目完成分布图', 2, 'pie', '71', '0', '', '[{\"type\":\"pie\",\"group\":[{\"field\":\"\\u9879\\u76ee\\u5b8c\\u6210\\u60c5\\u51b5\",\"name\":\"\\u9879\\u76ee\\u5b8c\\u6210\\u60c5\\u51b5\",\"group\":\"\"}],\"metric\":[{\"field\":\"id\",\"name\":\"\\u9879\\u76eeID\",\"valOrAgg\":\"count\"}]}]', '[{\"field\":\"closedDate\",\"type\":\"date\",\"name\":\"\\u5173\\u95ed\\u65e5\\u671f\",\"default\":{\"begin\":\"\",\"end\":\"\"}}]', 0, '{\"id\":{\"name\":\"\\u9879\\u76eeID\",\"object\":\"project\",\"field\":\"id\",\"type\":\"number\"},\"\\u9879\\u76ee\\u5b8c\\u6210\\u60c5\\u51b5\":{\"name\":\"\\u9879\\u76ee\\u5b8c\\u6210\\u60c5\\u51b5\",\"object\":\"project\",\"field\":\"\\u9879\\u76ee\\u5b8c\\u6210\\u60c5\\u51b5\",\"type\":\"string\"},\"closedDate\":{\"name\":\"\\u5173\\u95ed\\u65e5\\u671f\",\"object\":\"project\",\"field\":\"closedDate\",\"type\":\"date\"}}', '', 'select\nt1.id,\n(case when t1.realEnd= (DATEDIFF(NOW(), t1.`begin`) / DATEDIFF(t1.`end`, t1.`begin`) * 100) AND LEFT(t1.`end`, 4) != \'2059\') \r\n OR LEFT(t1.`end`, 4) = \'2059\' ,\r\n \"顺利\",\r\n \"滞后\"\r\n ))) AS \'status\',\r\nIFNULL(prograss, 0) AS prograss, ROUND(DATEDIFF(NOW(), t1.`begin`) / DATEDIFF(t1.`end`, t1.`begin`) * 100, 2) AS planPrograss,LEFT(t1.`end`, 4) AS endYear\r\nFROM zt_project AS t1\r\nLEFT JOIN (\r\n SELECT t22.project,\r\n ROUND(IF(SUM(t22.consumed) + SUM(IF(t22.status != \'closed\' && t22.status != \'cancel\', t22.`left`, 0)) > 0, SUM(t22.consumed) / (SUM(t22.consumed) + SUM(IF(t22.status != \'closed\' && t22.status != \'cancel\', t22.`left`, 0))), 0) * 100, 2) AS prograss\r\n FROM zt_project AS t21\r\n LEFT JOIN zt_task AS t22 ON t21.id = t22.execution\r\n WHERE t21.deleted = \'0\' AND t21.type IN (\'sprint\', \'kanban\')\r\n AND t22.deleted = \'0\' AND t22.parent < 1\r\n GROUP BY t22.project\r\n UNION\r\n SELECT t.project, ROUND(SUM(t.prograss * (t.percent / 100)), 2) as prograss\r\n FROM (\r\n SELECT t21.id,t21.percent, t22.project,\r\n IF(SUM(t22.consumed) + SUM(IF(t22.status != \'closed\' && t22.status != \'cancel\', t22.`left`, 0)) > 0, ROUND(SUM(t22.consumed) / (SUM(t22.consumed) + SUM(IF(t22.status != \'closed\' && t22.status != \'cancel\', t22.`left`, 0))) * 1000 / 1000 * 100, 2), 0) AS prograss\r\n FROM zt_project AS t21\r\n LEFT JOIN zt_task AS t22 ON t21.id = t22.execution\r\n WHERE t21.deleted = \'0\' AND t21.type = \'stage\'\r\n AND t22.deleted = \'0\' AND t22.parent < 1\r\n AND t22.id IS NOT NULL\r\n GROUP BY t21.id, t21.percent, t22.project\r\n ) t\r\n GROUP BY t.project\r\n) AS t2 ON t1.id = t2.project \r\nWHERE t1.deleted = \'0\'\r\nAND t1.status = \'doing\' \r\nAND t1.type = \'project\'', 'published', 1, '', 'admin', '2022-12-07 14:59:41', 'admin', '2022-12-07 14:59:41', 0), (10115, '年度进行中项目-迭代进度分布图', 2, 'pie', '69', '0', '', '{\"group\":[{\"field\":\"status\",\"name\":\"进度\"}],\"metric\":[{\"type\":\"agg\",\"field\":\"id\",\"agg\":\"count\",\"name\":\"迭代数\",\"valOrAgg\":\"count\"}]}', '[]', 0, '', '', 'SELECT id, name,IF(\r\n DATEDIFF(`end`, NOW()) < 0,\r\n \"延期\",\r\n (IF(\r\n prograss >= planPrograss,\r\n \"顺利\",\r\n \"滞后\"\r\n ))\r\n) AS status,\r\nprograss, planPrograss, `end`\r\nFROM (\r\nSELECT t1.id,t1.name,ROUND(DATEDIFF(NOW(), t1.`begin`) / DATEDIFF(t1.`end`, t1.`begin`) * 100, 2) AS planPrograss,t1.`end`,\r\nROUND(IF(SUM(t2.consumed) + SUM(IF(t2.status != \'closed\' && t2.status != \'cancel\', t2.`left`, 0)) > 0, SUM(t2.consumed) / (SUM(t2.consumed) + SUM(IF(t2.status != \'closed\' && t2.status != \'cancel\', t2.`left`, 0))), 0) * 100, 2) AS prograss\r\nFROM zt_project AS t1\r\nLEFT JOIN zt_task AS t2 ON t1.id = t2.execution\r\nWHERE t1.deleted = \'0\' AND t1.type IN (\'sprint\', \'stage\', \'kanban\') AND t1.status = \'doing\' AND t1.multiple = \'1\'\r\nAND ((t2.deleted = \'0\' AND t2.parent < 1) OR t2.id IS NULL)\r\nGROUP BY t1.id\r\n) AS t', 'published', 1, '', 'admin', '2022-12-07 14:59:41', 'admin', '2022-12-07 14:59:41', 0), -(10116, '年度进行中项目-项目进度透视表', 2, 'table', '84', '0', '', '{\"group\":[],\"column\":[{\"field\":\"program\",\"valOrAgg\":\"value\",\"name\":\"一级项目集\"},{\"field\":\"name\",\"valOrAgg\":\"value\",\"name\":\"项目\"},{\"field\":\"begin\",\"valOrAgg\":\"value\",\"name\":\"计划开始日期\"},{\"field\":\"end\",\"valOrAgg\":\"value\",\"name\":\"计划完成日期\"},{\"field\":\"planDuration\",\"valOrAgg\":\"value\",\"name\":\"计划工期\"},{\"field\":\"realBegan\",\"valOrAgg\":\"value\",\"name\":\"实际开始日期\"},{\"field\":\"realDuration\",\"valOrAgg\":\"value\",\"name\":\"剩余工期天数\"},{\"field\":\"prograss\",\"valOrAgg\":\"value\",\"name\":\"工期进度\"},{\"field\":\"status\",\"valOrAgg\":\"value\",\"name\":\"进度状态\"}],\"filter\":[]}', '[]', 0, '', '', 'SELECT t1.id, t1.name, IFNULL(t3.name, \'/\') AS program,t1.`begin`, IF(YEAR(t1.`end`) = \'2059\', \"长期\", t1.`end`) AS `end`, IF(YEAR(t1.`end`) = \'2059\', \"长期\", DATEDIFF(t1.`end`, t1.`begin`) + 1) AS planDuration,\r\nIF(LEFT(t1.realBegan, 4) = \'0000\', \'/\', t1.realBegan) AS realBegan, IF(YEAR(t1.`end`) = \'2059\', \"长期\", IF(DATEDIFF(t1.`end`, NOW()) >= 0, DATEDIFF(t1.`end`, NOW()) + 1, 0)) AS realDuration,\r\nIF(\r\n DATEDIFF(t1.`end`, NOW()) < 0, \r\n \"延期\", \r\n (IF(\r\n (IFNULL(prograss, 0) >= (DATEDIFF(NOW(), t1.`begin`) / DATEDIFF(t1.`end`, t1.`begin`) * 100) AND LEFT(t1.`end`, 4) != \'2059\') \r\n OR LEFT(t1.`end`, 4) = \'2059\' ,\r\n \"顺利\",\r\n \"滞后\"\r\n ))) AS \'status\',\r\nCONCAT(IFNULL(prograss, 0), \'%\') AS prograss\r\nFROM zt_project AS t1\r\nLEFT JOIN (\r\n SELECT t22.project,\r\n ROUND(IF(SUM(t22.consumed) + SUM(IF(t22.status != \'closed\' && t22.status != \'cancel\', t22.`left`, 0)) > 0, SUM(t22.consumed) / (SUM(t22.consumed) + SUM(IF(t22.status != \'closed\' && t22.status != \'cancel\', t22.`left`, 0))), 0) * 100, 2) AS prograss\r\n FROM zt_project AS t21\r\n LEFT JOIN zt_task AS t22 ON t21.id = t22.execution\r\n WHERE t21.deleted = \'0\' AND t21.type IN (\'sprint\', \'kanban\')\r\n AND t22.deleted = \'0\' AND t22.parent < 1\r\n GROUP BY t22.project\r\n UNION\r\n SELECT t.project, ROUND(SUM(t.prograss * (t.percent / 100)), 2) as prograss\r\n FROM (\r\n SELECT t21.id,t21.percent, t22.project,\r\n IF(SUM(t22.consumed) + SUM(IF(t22.status != \'closed\' && t22.status != \'cancel\', t22.`left`, 0)) > 0, ROUND(SUM(t22.consumed) / (SUM(t22.consumed) + SUM(IF(t22.status != \'closed\' && t22.status != \'cancel\', t22.`left`, 0))) * 1000 / 1000 * 100, 2), 0) AS prograss\r\n FROM zt_project AS t21\r\n LEFT JOIN zt_task AS t22 ON t21.id = t22.execution\r\n WHERE t21.deleted = \'0\' AND t21.type = \'stage\'\r\n AND t22.deleted = \'0\' AND t22.parent < 1\r\n AND t22.id IS NOT NULL\r\n GROUP BY t21.id, t21.percent, t22.project\r\n ) t\r\n GROUP BY t.project\r\n) AS t2 ON t1.id = t2.project \r\nLEFT JOIN zt_project AS t3 ON SUBSTR(t1.path, 2, POSITION(\',\' IN SUBSTR(t1.path, 2)) -1) = t3.id AND t3.type = \'program\' AND t3.deleted = \'0\'\r\nWHERE t1.deleted = \'0\'\r\nAND t1.status = \'doing\' \r\nAND t1.type = \'project\'', 'published', 1, '', 'admin', '2022-12-07 14:59:41', 'admin', '2022-12-07 14:59:41', 0), -(10117, '年度进行中项目-迭代进度透视表', 2, 'table', '84', '0', '', '{\"group\":[],\"column\":[{\"field\":\"project\",\"valOrAgg\":\"value\",\"name\":\"项目\"},{\"field\":\"name\",\"valOrAgg\":\"value\",\"name\":\"迭代\"},{\"field\":\"begin\",\"valOrAgg\":\"value\",\"name\":\"计划开始日期\"},{\"field\":\"end\",\"valOrAgg\":\"value\",\"name\":\"计划完成日期\"},{\"field\":\"planDuration\",\"valOrAgg\":\"value\",\"name\":\"计划工期\"},{\"field\":\"realBegan\",\"valOrAgg\":\"value\",\"name\":\"实际开始日期\"},{\"field\":\"realDuration\",\"valOrAgg\":\"value\",\"name\":\"剩余工期天数\"},{\"field\":\"prograss\",\"valOrAgg\":\"value\",\"name\":\"工期进度\"},{\"field\":\"status\",\"valOrAgg\":\"value\",\"name\":\"进度状态\"}],\"filter\":[]}', '[]', 0, '', '', 'SELECT id, name,project,`begin`, `end`, planDuration, IF(LEFT(realBegan, 4) = \'0000\', \'/\', realBegan) as realBegan, realDuration, CONCAT(prograss, \'%\') as prograss,\r\nIF(\r\n DATEDIFF(`end`, NOW()) < 0,\r\n \"延期\",\r\n (IF(\r\n prograss >= planPrograss,\r\n \"顺利\",\r\n \"滞后\"\r\n ))\r\n) AS status\r\nFROM (\r\nSELECT t1.id,t1.name,t1.`begin`,t1.`end`,t1.`realBegan`,IFNULL(t3.name, \'/\') AS project,t3.id AS projectID,\r\nDATEDIFF(t1.`end`, t1.`begin`) + 1 AS planDuration, IF(DATEDIFF(t1.`end`, NOW()) >= 0, DATEDIFF(t1.`end`, NOW()) + 1, 0) AS realDuration,\r\nROUND(DATEDIFF(NOW(), t1.`begin`) / DATEDIFF(t1.`end`, t1.`begin`) * 100, 2) AS planPrograss,\r\nROUND(IF(SUM(t2.consumed) + SUM(IF(t2.status != \'closed\' && t2.status != \'cancel\', t2.`left`, 0)) > 0, SUM(t2.consumed) / (SUM(t2.consumed) + SUM(IF(t2.status != \'closed\' && t2.status != \'cancel\', t2.`left`, 0))), 0) * 100, 2) AS prograss\r\nFROM zt_project AS t1\r\nLEFT JOIN zt_task AS t2 ON t1.id = t2.execution\r\nLEFT JOIN zt_project AS t3 on t1.project = t3.id AND t3.type = \'project\' AND t3.deleted = \'0\'\r\nWHERE t1.deleted = \'0\' AND t1.type IN (\'sprint\', \'stage\', \'kanban\') AND t1.status = \'doing\' AND t1.multiple = \'1\'\r\nAND t2.deleted = \'0\' AND t2.parent < 1\r\nGROUP BY t1.id\r\n) AS t\r\nORDER BY projectID ASC, id ASC', 'published', 1, '', 'admin', '2022-12-07 14:59:41', 'admin', '2022-12-07 14:59:41', 0), +(10116, '年度进行中项目-项目进度透视表', 2, 'table', '84', '0', '', '{\"group\":[],\"column\":[{\"field\":\"program\",\"valOrAgg\":\"value\",\"name\":\"一级项目集\"},{\"field\":\"name\",\"valOrAgg\":\"value\",\"name\":\"项目\"},{\"field\":\"begin\",\"valOrAgg\":\"value\",\"name\":\"计划开始日期\"},{\"field\":\"end\",\"valOrAgg\":\"value\",\"name\":\"计划完成日期\"},{\"field\":\"planDuration\",\"valOrAgg\":\"value\",\"name\":\"计划工期\"},{\"field\":\"realBegan\",\"valOrAgg\":\"value\",\"name\":\"实际开始日期\"},{\"field\":\"realDuration\",\"valOrAgg\":\"value\",\"name\":\"剩余工期天数\"},{\"field\":\"prograss\",\"valOrAgg\":\"value\",\"name\":\"工期进度\"},{\"field\":\"status\",\"valOrAgg\":\"value\",\"name\":\"进度状态\"}],\"filter\":[]}', '[]', 0, '', '', 'SELECT t1.id, t1.name, IFNULL(t3.name, \'/\') AS program,t1.`begin`, IF(YEAR(t1.`end`) = \'2059\', \"长期\", t1.`end`) AS `end`, IF(YEAR(t1.`end`) = \'2059\', \"长期\", DATEDIFF(t1.`end`, t1.`begin`) + 1) AS planDuration,\r\nIF(t1.realBegan = null, \'/\', t1.realBegan) AS realBegan, IF(YEAR(t1.`end`) = \'2059\', \"长期\", IF(DATEDIFF(t1.`end`, NOW()) >= 0, DATEDIFF(t1.`end`, NOW()) + 1, 0)) AS realDuration,\r\nIF(\r\n DATEDIFF(t1.`end`, NOW()) < 0, \r\n \"延期\", \r\n (IF(\r\n (IFNULL(prograss, 0) >= (DATEDIFF(NOW(), t1.`begin`) / DATEDIFF(t1.`end`, t1.`begin`) * 100) AND LEFT(t1.`end`, 4) != \'2059\') \r\n OR LEFT(t1.`end`, 4) = \'2059\' ,\r\n \"顺利\",\r\n \"滞后\"\r\n ))) AS \'status\',\r\nCONCAT(IFNULL(prograss, 0), \'%\') AS prograss\r\nFROM zt_project AS t1\r\nLEFT JOIN (\r\n SELECT t22.project,\r\n ROUND(IF(SUM(t22.consumed) + SUM(IF(t22.status != \'closed\' && t22.status != \'cancel\', t22.`left`, 0)) > 0, SUM(t22.consumed) / (SUM(t22.consumed) + SUM(IF(t22.status != \'closed\' && t22.status != \'cancel\', t22.`left`, 0))), 0) * 100, 2) AS prograss\r\n FROM zt_project AS t21\r\n LEFT JOIN zt_task AS t22 ON t21.id = t22.execution\r\n WHERE t21.deleted = \'0\' AND t21.type IN (\'sprint\', \'kanban\')\r\n AND t22.deleted = \'0\' AND t22.parent < 1\r\n GROUP BY t22.project\r\n UNION\r\n SELECT t.project, ROUND(SUM(t.prograss * (t.percent / 100)), 2) as prograss\r\n FROM (\r\n SELECT t21.id,t21.percent, t22.project,\r\n IF(SUM(t22.consumed) + SUM(IF(t22.status != \'closed\' && t22.status != \'cancel\', t22.`left`, 0)) > 0, ROUND(SUM(t22.consumed) / (SUM(t22.consumed) + SUM(IF(t22.status != \'closed\' && t22.status != \'cancel\', t22.`left`, 0))) * 1000 / 1000 * 100, 2), 0) AS prograss\r\n FROM zt_project AS t21\r\n LEFT JOIN zt_task AS t22 ON t21.id = t22.execution\r\n WHERE t21.deleted = \'0\' AND t21.type = \'stage\'\r\n AND t22.deleted = \'0\' AND t22.parent < 1\r\n AND t22.id IS NOT NULL\r\n GROUP BY t21.id, t21.percent, t22.project\r\n ) t\r\n GROUP BY t.project\r\n) AS t2 ON t1.id = t2.project \r\nLEFT JOIN zt_project AS t3 ON SUBSTR(t1.path, 2, POSITION(\',\' IN SUBSTR(t1.path, 2)) -1) = t3.id AND t3.type = \'program\' AND t3.deleted = \'0\'\r\nWHERE t1.deleted = \'0\'\r\nAND t1.status = \'doing\' \r\nAND t1.type = \'project\'', 'published', 1, '', 'admin', '2022-12-07 14:59:41', 'admin', '2022-12-07 14:59:41', 0), +(10117, '年度进行中项目-迭代进度透视表', 2, 'table', '84', '0', '', '{\"group\":[],\"column\":[{\"field\":\"project\",\"valOrAgg\":\"value\",\"name\":\"项目\"},{\"field\":\"name\",\"valOrAgg\":\"value\",\"name\":\"迭代\"},{\"field\":\"begin\",\"valOrAgg\":\"value\",\"name\":\"计划开始日期\"},{\"field\":\"end\",\"valOrAgg\":\"value\",\"name\":\"计划完成日期\"},{\"field\":\"planDuration\",\"valOrAgg\":\"value\",\"name\":\"计划工期\"},{\"field\":\"realBegan\",\"valOrAgg\":\"value\",\"name\":\"实际开始日期\"},{\"field\":\"realDuration\",\"valOrAgg\":\"value\",\"name\":\"剩余工期天数\"},{\"field\":\"prograss\",\"valOrAgg\":\"value\",\"name\":\"工期进度\"},{\"field\":\"status\",\"valOrAgg\":\"value\",\"name\":\"进度状态\"}],\"filter\":[]}', '[]', 0, '', '', 'SELECT id, name,project,`begin`, `end`, planDuration, IF(realBegan = null, \'/\', realBegan) as realBegan, realDuration, CONCAT(prograss, \'%\') as prograss,\r\nIF(\r\n DATEDIFF(`end`, NOW()) < 0,\r\n \"延期\",\r\n (IF(\r\n prograss >= planPrograss,\r\n \"顺利\",\r\n \"滞后\"\r\n ))\r\n) AS status\r\nFROM (\r\nSELECT t1.id,t1.name,t1.`begin`,t1.`end`,t1.`realBegan`,IFNULL(t3.name, \'/\') AS project,t3.id AS projectID,\r\nDATEDIFF(t1.`end`, t1.`begin`) + 1 AS planDuration, IF(DATEDIFF(t1.`end`, NOW()) >= 0, DATEDIFF(t1.`end`, NOW()) + 1, 0) AS realDuration,\r\nROUND(DATEDIFF(NOW(), t1.`begin`) / DATEDIFF(t1.`end`, t1.`begin`) * 100, 2) AS planPrograss,\r\nROUND(IF(SUM(t2.consumed) + SUM(IF(t2.status != \'closed\' && t2.status != \'cancel\', t2.`left`, 0)) > 0, SUM(t2.consumed) / (SUM(t2.consumed) + SUM(IF(t2.status != \'closed\' && t2.status != \'cancel\', t2.`left`, 0))), 0) * 100, 2) AS prograss\r\nFROM zt_project AS t1\r\nLEFT JOIN zt_task AS t2 ON t1.id = t2.execution\r\nLEFT JOIN zt_project AS t3 on t1.project = t3.id AND t3.type = \'project\' AND t3.deleted = \'0\'\r\nWHERE t1.deleted = \'0\' AND t1.type IN (\'sprint\', \'stage\', \'kanban\') AND t1.status = \'doing\' AND t1.multiple = \'1\'\r\nAND t2.deleted = \'0\' AND t2.parent < 1\r\nGROUP BY t1.id\r\n) AS t\r\nORDER BY projectID ASC, id ASC', 'published', 1, '', 'admin', '2022-12-07 14:59:41', 'admin', '2022-12-07 14:59:41', 0), (10118, '年度进行中项目-项目剩余工作量透视表', 2, 'table', '83', '0', '', '{\"group\":[],\"column\":[{\"field\":\"program\",\"valOrAgg\":\"value\",\"name\":\"一级项目集\"},{\"field\":\"project\",\"valOrAgg\":\"value\",\"name\":\"项目\"},{\"field\":\"story\",\"valOrAgg\":\"value\",\"name\":\"剩余需求数\"},{\"field\":\"estimate\",\"valOrAgg\":\"value\",\"name\":\"剩余需求规模数\"},{\"field\":\"execution\",\"valOrAgg\":\"value\",\"name\":\"剩余执行数\"},{\"field\":\"workhour\",\"valOrAgg\":\"value\",\"name\":\"剩余工时\"}],\"filter\":[]}', '[]', 0, '', '', 'SELECT\r\n t1.id,\r\n t1.name AS project,\r\n IFNULL(t2.name, \'/\') AS program,\r\n IFNULL(t3.story, 0) AS story,\r\n IFNULL(t3.estimate, 0) AS estimate,\r\n IFNULL(t4.execution, 0) AS execution, \r\n IFNULL(t5.workhour, 0) AS workhour\r\nFROM zt_project AS t1\r\nLEFT JOIN zt_project AS t2 ON FIND_IN_SET(t2.id, t1.path) AND t2.deleted = \'0\' AND t2.type = \'program\' AND t2.grade = 1\r\nLEFT JOIN (\r\n SELECT t1.parent AS project, COUNT(1) AS story, ROUND(SUM(t1.estimate), 1) AS estimate\r\n FROM (\r\n SELECT DISTINCT t1.parent, t3.id, t3.estimate\r\n FROM zt_project AS t1\r\n LEFT JOIN zt_projectstory AS t2 ON t1.id = t2.project\r\n LEFT JOIN zt_story AS t3 ON t2.story = t3.id AND t3.deleted = \'0\' AND t3.stage NOT IN (\'verified\', \'released\', \'closed\')\r\n WHERE t1.deleted = \'0\' AND t1.type IN (\'sprint\', \'stage\', \'kanban\') AND t3.id IS NOT NULL\r\n ) AS t1 GROUP BY project\r\n) AS t3 ON t1.id = t3.project\r\nLEFT JOIN (SELECT parent AS project, COUNT(1) AS execution FROM zt_project WHERE deleted = \'0\' AND type IN (\'sprint\', \'stage\', \'kanban\') AND status NOT IN (\'done\', \'closed\') GROUP BY project) AS t4 ON t1.id = t4.project\r\nLEFT JOIN (\r\n SELECT t1.parent AS project, ROUND(SUM(t2.left), 1) AS workhour\r\n FROM zt_project AS t1\r\n LEFT JOIN zt_task AS t2 ON t1.id = t2.execution AND t2.deleted = \'0\' AND t2.parent < 1\r\n WHERE t1.deleted = \'0\' AND t1.type IN (\'sprint\', \'stage\', \'kanban\') AND t1.status NOT IN (\'done\', \'closed\') AND t2.id IS NOT NULL\r\n GROUP BY project\r\n) AS t5 ON t1.id = t5.project\r\nWHERE t1.deleted = \'0\' AND t1.type = \'project\' AND t1.status = \'doing\'', 'published', 1, '', 'admin', '2022-12-07 14:59:41', 'admin', '2022-12-07 14:59:41', 0), (10119, '年度进行中项目-迭代剩余工作量透视表', 2, 'table', '83', '0', '', '{\"group\":[],\"column\":[{\"field\":\"project\",\"valOrAgg\":\"value\",\"name\":\"项目\"},{\"field\":\"execution\",\"valOrAgg\":\"value\",\"name\":\"迭代\"},{\"field\":\"story\",\"valOrAgg\":\"value\",\"name\":\"剩余需求数\"},{\"field\":\"estimate\",\"valOrAgg\":\"value\",\"name\":\"剩余需求规模数\"},{\"field\":\"task\",\"valOrAgg\":\"value\",\"name\":\"剩余任务数\"},{\"field\":\"workhour\",\"valOrAgg\":\"value\",\"name\":\"剩余工时\"}],\"filter\":[]}', '[]', 0, '', '', 'SELECT\r\n t1.id,\r\n t1.name AS execution,\r\n IFNULL(t2.name, \'/\') AS project,\r\n IFNULL(t3.story, 0) AS story,\r\n IFNULL(t3.estimate, 0) AS estimate,\r\n IFNULL(t4.task, 0) AS task, \r\n IFNULL(t4.workhour, 0) AS workhour\r\nFROM zt_project AS t1\r\nLEFT JOIN zt_project AS t2 ON t1.project = t2.id AND t2.type = \'project\'\r\nLEFT JOIN (\r\n SELECT t1.id AS execution, COUNT(1) AS story, ROUND(SUM(t3.estimate), 1) AS estimate\r\n FROM zt_project AS t1\r\n LEFT JOIN zt_projectstory AS t2 ON t1.id = t2.project\r\n LEFT JOIN zt_story AS t3 ON t2.story = t3.id AND t3.deleted = \'0\' AND t3.stage NOT IN (\'verified\', \'released\', \'closed\')\r\n WHERE t1.deleted = \'0\' AND t1.type IN (\'sprint\', \'stage\', \'kanban\') AND t1.status = \'doing\' AND t1.multiple = \'1\'\r\n GROUP BY execution\r\n) AS t3 ON t1.id = t3.execution\r\nLEFT JOIN (\r\n SELECT t1.id AS execution, SUM(IF(t2.status IN (\'wait\', \'doing\'), 1, 0)) AS task, ROUND(SUM(IF(t2.status IN (\'wait\', \'doing\', \'pause\'), t2.left, 0)), 1) AS workhour\r\n FROM zt_project AS t1\r\n LEFT JOIN zt_task AS t2 ON t1.id = t2.execution AND t2.deleted = \'0\' AND t2.parent < 1\r\n WHERE t1.deleted = \'0\' AND t1.type IN (\'sprint\', \'stage\', \'kanban\') AND t1.status = \'doing\' AND t1.multiple = \'1\'\r\n GROUP BY execution\r\n) AS t4 ON t1.id = t4.execution\r\nWHERE t1.deleted = \'0\' AND t1.type IN (\'sprint\', \'stage\', \'kanban\') AND t1.status = \'doing\' AND t1.multiple = \'1\'\r\nORDER BY t2.id ASC, t1.id ASC', 'published', 1, '', 'admin', '2022-12-07 14:59:41', 'admin', '2022-12-07 14:59:41', 0), (10201, '质量数据-研发完成需求数', 3, 'card', '93', '0', '', '{\"value\": {\"type\": \"agg\", \"field\": \"number\", \"agg\": \"sum\"}, \"title\": {\"type\": \"text\", \"name\": \"\"}, \"type\": \"value\"}', '[]', 0, '', '', 'SELECT COUNT(id) AS number FROM zt_story WHERE deleted=\'0\' AND (stage IN (\'developed\',\'testing\',\'verfied\',\'released\') OR (status=\'closed\' AND closedReason=\'done\'))', 'published', 1, '', 'admin', '2022-12-07 14:59:41', '', '2022-12-07 14:59:41', 0),