* Add field for zt_pivot and zt_chart.
This commit is contained in:
@@ -0,0 +1,2 @@
|
||||
ALTER TABLE `zt_pivot` ADD `driver` enum('mysql', 'duckdb') not NULL default 'mysql' AFTER `code`;
|
||||
ALTER TABLE `zt_chart` ADD `driver` enum('mysql', 'duckdb') not NULL default 'mysql' AFTER `code`;
|
||||
@@ -491,6 +491,7 @@ CREATE TABLE IF NOT EXISTS `zt_chart` (
|
||||
`id` mediumint(8) unsigned NOT NULL AUTO_INCREMENT,
|
||||
`name` varchar(255) NOT NULL DEFAULT '',
|
||||
`code` varchar(255) NOT NULL DEFAULT '',
|
||||
`driver` enum('mysql', 'duckdb') not NULL default 'duckdb';
|
||||
`dimension` mediumint(8) unsigned NOT NULL DEFAULT '0',
|
||||
`type` varchar(30) NOT NULL DEFAULT '',
|
||||
`group` varchar(255) NOT NULL DEFAULT '',
|
||||
@@ -15076,6 +15077,7 @@ CREATE TABLE IF NOT EXISTS `zt_pivot` (
|
||||
`dimension` mediumint(8) unsigned NOT NULL DEFAULT 0,
|
||||
`group` varchar(255) NOT NULL DEFAULT '',
|
||||
`code` varchar(255) NOT NULL DEFAULT '',
|
||||
`driver` enum('mysql', 'duckdb') not NULL default 'duckdb';
|
||||
`name` text NULL,
|
||||
`desc` text NULL,
|
||||
`sql` mediumtext NULL,
|
||||
|
||||
@@ -203,6 +203,7 @@ class duckdb
|
||||
$exec = "$this->binPath :memory: \"$this->sql\" -json 2>&1";
|
||||
$output = shell_exec($exec);
|
||||
|
||||
if(empty($output)) $output = '';
|
||||
$rows = json_decode($output);
|
||||
/* 有内容但是 json 解析失败,说明是报错。*/
|
||||
if($output and !$rows)
|
||||
|
||||
@@ -8,7 +8,7 @@ USE mysqldb;
|
||||
{COPYSQL}
|
||||
EOT;
|
||||
|
||||
$config->bi->driverNames = array('mysql', 'duckdb');
|
||||
$config->bi->drivers = array('mysql', 'duckdb');
|
||||
|
||||
$config->bi->columnTypes = new stdclass();
|
||||
$config->bi->columnTypes->mysql['TINY'] = 'number';
|
||||
|
||||
@@ -6,6 +6,7 @@ $config->bi->builtin->pivots[] = array
|
||||
'id' => 1000,
|
||||
'name' => array('zh-cn' => '完成项目工期透视表', 'zh-tw' => '', 'en' => '', 'de' => '', 'fr' => ''),
|
||||
'code' => 'finishedProjectDuration',
|
||||
'driver' => 'duckdb',
|
||||
'dimension' => '2',
|
||||
'group' => '86',
|
||||
'sql' => <<<EOT
|
||||
@@ -95,6 +96,7 @@ $config->bi->builtin->pivots[] = array
|
||||
'id' => 1001,
|
||||
'name' => array('zh-cn' => '完成项目工时透视表', 'zh-tw' => '', 'en' => '', 'de' => '', 'fr' => ''),
|
||||
'code' => 'finishedProjectHour',
|
||||
'driver' => 'duckdb',
|
||||
'dimension' => '2',
|
||||
'group' => '85',
|
||||
'sql' => <<<EOT
|
||||
@@ -222,6 +224,7 @@ $config->bi->builtin->pivots[] = array
|
||||
'id' => 1002,
|
||||
'name' => array('zh-cn' => '产品缺陷数据汇总表', 'zh-tw' => '', 'en' => '', 'de' => '', 'fr' => ''),
|
||||
'code' => 'productBugSummary',
|
||||
'driver' => 'duckdb',
|
||||
'dimension' => '3',
|
||||
'group' => '100',
|
||||
'sql' => <<<EOT
|
||||
@@ -358,6 +361,7 @@ $config->bi->builtin->pivots[] = array
|
||||
'id' => 1003,
|
||||
'name' => array('zh-cn' => '产品完成度统计表', 'zh-tw' => '產品完成度統計表', 'en' => 'Product Progress', 'de' => 'Product Progress', 'fr' => 'Product Progress'),
|
||||
'code' => 'productProgress',
|
||||
'driver' => 'duckdb',
|
||||
'desc' => array('zh-cn' => '按照产品列出需求总数,完成的总数(状态是关闭,或者研发阶段是发布),完成的百分比。', 'zh-tw' => '按照產品列出需求總數,完成的總數(狀態是關閉,或者研發階段是發布),完成的百分比。', '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.'),
|
||||
'dimension' => '1',
|
||||
'group' => '59',
|
||||
@@ -457,6 +461,7 @@ $config->bi->builtin->pivots[] = array
|
||||
'id' => 1004,
|
||||
'name' => array('zh-cn' => '产品需求状态分布表', 'zh-tw' => '產品需求狀態分布表', 'en' => 'Story Status', 'de' => 'Story Status', 'fr' => 'Story Status'),
|
||||
'code' => 'productStoryStatus',
|
||||
'driver' => 'duckdb',
|
||||
'desc' => array('zh-cn' => '按照产品列出需求总数,状态的分布情况。', 'zh-tw' => '按照產品列出需求總數,狀態的分布情況。', 'en' => 'Total number and status distribution of stories.', 'de' => 'Total number and status distribution of stories.', 'fr' => 'Total number and status distribution of stories.'),
|
||||
'dimension' => '1',
|
||||
'group' => '59',
|
||||
@@ -547,6 +552,7 @@ $config->bi->builtin->pivots[] = array
|
||||
'id' => 1005,
|
||||
'name' => array('zh-cn' => '产品需求阶段分布表', 'zh-tw' => '產品需求階段分布表', 'en' => 'Story Stage', 'de' => 'Story Stage', 'fr' => 'Story Stage'),
|
||||
'code' => 'productStoryStage',
|
||||
'driver' => 'duckdb',
|
||||
'desc' => array('zh-cn' => '按照产品列出需求总数,研发阶段的分布情况。', 'zh-tw' => '按照產品列出需求總數,研發階段的分布情況。', 'en' => 'Total number and stage distribution of stories ', 'de' => 'Total number and stage distribution of stories ', 'fr' => 'Total number and stage distribution of stories '),
|
||||
'dimension' => '1',
|
||||
'group' => '59',
|
||||
@@ -637,6 +643,7 @@ $config->bi->builtin->pivots[] = array
|
||||
'id' => 1006,
|
||||
'name' => array('zh-cn' => '产品发布数量统计表', 'zh-tw' => '產品發布數量統計表', 'en' => 'Product Release', 'de' => 'Product Release', 'fr' => 'Product Release'),
|
||||
'code' => 'productRelease',
|
||||
'driver' => 'duckdb',
|
||||
'desc' => array('zh-cn' => '按照产品列出发布的数量。', 'zh-tw' => '按照產品列出發布的數量。', 'en' => 'Product Release.', 'de' => 'Product Release.', 'fr' => 'Product Release.'),
|
||||
'dimension' => '1',
|
||||
'group' => '59',
|
||||
@@ -680,6 +687,7 @@ $config->bi->builtin->pivots[] = array
|
||||
'id' => 1007,
|
||||
'name' => array('zh-cn' => '任务状态统计表', 'zh-tw' => '任務狀態統計表', 'en' => 'Task Status Report', 'de' => 'Task Status Report', 'fr' => 'Task Status Report', 'vi' => 'Task Status Report', 'ja' => 'Task Status Report'),
|
||||
'code' => 'taskStatus',
|
||||
'driver' => 'duckdb',
|
||||
'desc' => array('zh-cn' => '按照执行统计任务的状态分布情况。', 'zh-tw' => '按照執行統計任務的狀態分布情況。', 'en' => '', 'de' => '', 'fr' => '', 'vi' => '', 'ja' => ''),
|
||||
'dimension' => '1',
|
||||
'group' => '60',
|
||||
@@ -759,6 +767,7 @@ $config->bi->builtin->pivots[] = array
|
||||
'id' => 1008,
|
||||
'name' => array('zh-cn' => '任务类型统计表', 'zh-tw' => '任務類型統計表', 'en' => 'Task Type Report', 'de' => 'Task Type Report', 'fr' => 'Task Type Report', 'vi' => 'Task Type Report', 'ja' => 'Task Type Report'),
|
||||
'code' => 'taskType',
|
||||
'driver' => 'duckdb',
|
||||
'desc' => array('zh-cn' => '按照项目统计任务的类型分布情况。', 'zh-tw' => '按照項目統計任務的類型分布情況。', 'en' => '', 'de' => '', 'fr' => '', 'vi' => '', 'ja' => ''),
|
||||
'dimension' => '1',
|
||||
'group' => '60',
|
||||
@@ -833,6 +842,7 @@ $config->bi->builtin->pivots[] = array
|
||||
'id' => 1009,
|
||||
'name' => array('zh-cn' => '项目任务指派统计表', 'zh-tw' => '項目任務指派統計表', 'en' => 'Task Assign Report', 'de' => 'Task Assign Report', 'fr' => 'Task Assign Report', 'vi' => 'Task Assign Report', 'ja' => 'Task Assign Report'),
|
||||
'code' => 'projectTaskAssign',
|
||||
'driver' => 'duckdb',
|
||||
'desc' => array('zh-cn' => '按照项目统计任务的指派给分布情况。', 'zh-tw' => '按照項目統計任務的指派給分布情況。', 'en' => '', 'de' => '', 'fr' => '', 'vi' => '', 'ja' => ''),
|
||||
'dimension' => '1',
|
||||
'group' => '60',
|
||||
@@ -904,6 +914,7 @@ $config->bi->builtin->pivots[] = array
|
||||
'id' => 1010,
|
||||
'name' => array('zh-cn' => '项目任务完成者统计表', 'zh-tw' => '項目任務完成者統計表', 'en' => 'Task Finish Report', 'de' => 'Task Finish Report', 'fr' => 'Task Finish Report', 'vi' => 'Task Finish Report', 'ja' => 'Task Finish Report'),
|
||||
'code' => 'projectTaskFinished',
|
||||
'driver' => 'duckdb',
|
||||
'desc' => array('zh-cn' => '按照项目统计任务的完成者分布情况。', 'zh-tw' => '按照項目統計任務的完成者分布情況。', 'en' => '', 'de' => '', 'fr' => '', 'vi' => '', 'ja' => ''),
|
||||
'dimension' => '1',
|
||||
'group' => '60',
|
||||
@@ -975,6 +986,7 @@ $config->bi->builtin->pivots[] = array
|
||||
'id' => 1011,
|
||||
'name' => array('zh-cn' => '项目投入统计表', 'zh-tw' => '項目投入統計表', 'en' => 'Project Invest Report', 'de' => 'Project Invest Report', 'fr' => 'Project Invest Report', 'vi' => 'Project Invest Report', 'ja' => 'Project Invest Report'),
|
||||
'code' => 'projectInvested',
|
||||
'driver' => 'duckdb',
|
||||
'desc' => array('zh-cn' => '按照项目列出:任务数,需求数,人数,总消耗工时。', 'zh-tw' => '按照項目列出:任務數,需求數,人數,總消耗工時。', 'en' => '', 'de' => '', 'fr' => '', 'vi' => '', 'ja' => ''),
|
||||
'dimension' => '1',
|
||||
'group' => '60',
|
||||
@@ -1060,6 +1072,7 @@ $config->bi->builtin->pivots[] = array
|
||||
'id' => 1012,
|
||||
'name' => array('zh-cn' => '项目需求状态分布表', 'zh-tw' => '項目需求狀態分布表', 'en' => 'Project Story Status', 'de' => 'Project Story Status', 'fr' => 'Project Story Status', 'vi' => 'Project Story Status', 'ja' => 'Project Story Status'),
|
||||
'code' => 'projectStoryStatus',
|
||||
'driver' => 'duckdb',
|
||||
'desc' => array('zh-cn' => '按照项目统计需求的状态分布情况。', 'zh-tw' => '按照項目統計需求的狀態分布情況。', 'en' => '', 'de' => '', 'fr' => '', 'vi' => '', 'ja' => ''),
|
||||
'dimension' => '1',
|
||||
'group' => '60',
|
||||
@@ -1124,6 +1137,7 @@ $config->bi->builtin->pivots[] = array
|
||||
'id' => 1013,
|
||||
'name' => array('zh-cn' => '项目需求阶段分布表', 'zh-tw' => '項目需求階段分布表', 'en' => 'Project Stage Report', 'de' => 'Project Stage Report', 'fr' => 'Project Stage Report', 'vi' => 'Project Stage Report', 'ja' => 'Project Stage Report'),
|
||||
'code' => 'projectStoryStage',
|
||||
'driver' => 'duckdb',
|
||||
'desc' => array('zh-cn' => '按照项目统计需求阶段分布情况。', 'zh-tw' => '按照項目統計需求階段分布情況。', 'en' => '', 'de' => '', 'fr' => '', 'vi' => '', 'ja' => ''),
|
||||
'dimension' => '1',
|
||||
'group' => '60',
|
||||
@@ -1190,6 +1204,7 @@ $config->bi->builtin->pivots[] = array
|
||||
'id' => 1014,
|
||||
'name' => array('zh-cn' => '项目Bug解决方案分布表', 'zh-tw' => '項目Bug解決方案分布表', 'en' => 'Project Bug Resolution', 'de' => 'Project Bug Resolution', 'fr' => 'Project Bug Resolution', 'vi' => 'Project Bug Resolution', 'ja' => 'Project Bug Resolution'),
|
||||
'code' => 'projectBugResolution',
|
||||
'driver' => 'duckdb',
|
||||
'desc' => array('zh-cn' => '按照项目统计Bug的解决方案分布情况。', 'zh-tw' => '按照項目統計Bug的解決方案分布情況。', 'en' => '', 'de' => '', 'fr' => '', 'vi' => '', 'ja' => ''),
|
||||
'dimension' => '1',
|
||||
'group' => '60,61',
|
||||
@@ -1256,6 +1271,7 @@ $config->bi->builtin->pivots[] = array
|
||||
'id' => 1015,
|
||||
'name' => array('zh-cn' => '项目Bug状态分布表', 'zh-tw' => '項目Bug狀態分布表', 'en' => 'Project Bug Status', 'de' => 'Project Bug Status', 'fr' => 'Project Bug Status', 'vi' => 'Project Bug Status', 'ja' => 'Project Bug Status'),
|
||||
'code' => 'projectBugStatus',
|
||||
'driver' => 'duckdb',
|
||||
'desc' => array('zh-cn' => '按照项目统计Bug的状态分布情况。', 'zh-tw' => '按照項目統計Bug的狀態分布情況。', 'en' => '', 'de' => '', 'fr' => '', 'vi' => '', 'ja' => ''),
|
||||
'dimension' => '1',
|
||||
'group' => '60,61',
|
||||
@@ -1321,6 +1337,7 @@ $config->bi->builtin->pivots[] = array
|
||||
'id' => 1016,
|
||||
'name' => array('zh-cn' => '项目Bug创建者分布表', 'zh-tw' => '項目Bug創建者分布表', 'en' => 'Project Bug Opened', 'de' => 'Project Bug Opened', 'fr' => 'Project Bug Opened', 'vi' => 'Project Bug Opened', 'ja' => 'Project Bug Opened'),
|
||||
'code' => 'projectBugOpenedBy',
|
||||
'driver' => 'duckdb',
|
||||
'desc' => array('zh-cn' => '按照项目统计Bug的创建者分布情况。', 'zh-tw' => '按照項目統計Bug的創建者分布情況。', 'en' => '', 'de' => '', 'fr' => '', 'vi' => '', 'ja' => ''),
|
||||
'dimension' => '1',
|
||||
'group' => '60,61',
|
||||
@@ -1386,6 +1403,7 @@ $config->bi->builtin->pivots[] = array
|
||||
'id' => 1017,
|
||||
'name' => array('zh-cn' => '项目Bug解决者分布表', 'zh-tw' => '項目Bug解決者分布表', 'en' => 'Project Bug Resolve', 'de' => 'Project Bug Resolve', 'fr' => 'Project Bug Resolve', 'vi' => 'Project Bug Resolve', 'ja' => 'Project Bug Resolve'),
|
||||
'code' => 'projectBugResolvedBy',
|
||||
'driver' => 'duckdb',
|
||||
'desc' => array('zh-cn' => '按照项目统计Bug的解决者分布情况。', 'zh-tw' => '按照項目統計Bug的解決者分布情況。', 'en' => '', 'de' => '', 'fr' => '', 'vi' => '', 'ja' => ''),
|
||||
'dimension' => '1',
|
||||
'group' => '60,61',
|
||||
@@ -1453,6 +1471,7 @@ $config->bi->builtin->pivots[] = array
|
||||
'id' => 1018,
|
||||
'name' => array('zh-cn' => '项目Bug指派给分布表', 'zh-tw' => '項目Bug指派給分布表', 'en' => 'Project Bug Assign', 'de' => 'Project Bug Assign', 'fr' => 'Project Bug Assign', 'vi' => 'Project Bug Assign', 'ja' => 'Project Bug Assign'),
|
||||
'code' => 'projectBugAssignedBy',
|
||||
'driver' => 'duckdb',
|
||||
'desc' => array('zh-cn' => '按照项目统计Bug的指派给分布情况。', 'zh-tw' => '按照項目統計Bug的指派給分布情況。', 'en' => '', 'de' => '', 'fr' => '', 'vi' => '', 'ja' => ''),
|
||||
'dimension' => '1',
|
||||
'group' => '60,61',
|
||||
@@ -1518,6 +1537,7 @@ $config->bi->builtin->pivots[] = array
|
||||
'id' => 1019,
|
||||
'name' => array('zh-cn' => '项目质量表', 'zh-tw' => '項目質量表', 'en' => 'Project Quality Report', 'de' => 'Project Quality Report', 'fr' => 'Project Quality Report', 'vi' => 'Project Quality Report', 'ja' => 'Project Quality Report'),
|
||||
'code' => 'projectQuality',
|
||||
'driver' => 'duckdb',
|
||||
'desc' => array('zh-cn' => '列出项目的需求总数,完成需求数,任务总数,完成的任务数,Bug数,解决的Bug数,Bug/需求,Bug/任务,重要Bug数量(严重程度不大于3)。', 'zh-tw' => '列出項目的需求總數,完成需求數,任務總數,完成的任務數,Bug數,解決的Bug數,Bug/需求,Bug/任務,重要Bug數量(嚴重程度不大於3)。', 'en' => '', 'de' => '', 'fr' => '', 'vi' => '', 'ja' => ''),
|
||||
'dimension' => '1',
|
||||
'group' => '60',
|
||||
@@ -1617,6 +1637,7 @@ $config->bi->builtin->pivots[] = array
|
||||
'id' => 1020,
|
||||
'name' => array('zh-cn' => '产品Bug类型统计表', 'zh-tw' => '產品Bug類型統計表', 'en' => 'Bug Type of Product', 'de' => 'Bug Type of Product', 'fr' => 'Bug Type of Product'),
|
||||
'code' => 'productBugType',
|
||||
'driver' => 'duckdb',
|
||||
'desc' => array('zh-cn' => '按照产品统计Bug的类型分布情况。', 'zh-tw' => '按照產品統計Bug的類型分布情況。', 'en' => 'Type distribution of Bugs.', 'de' => 'Type distribution of Bugs.', 'fr' => 'Type distribution of Bugs.'),
|
||||
'dimension' => '1',
|
||||
'group' => '59,61',
|
||||
@@ -1668,6 +1689,7 @@ $config->bi->builtin->pivots[] = array
|
||||
'id' => 1021,
|
||||
'name' => array('zh-cn' => '产品质量表', 'zh-tw' => '產品質量表', 'en' => 'Product Quality', 'de' => 'Product Quality', 'fr' => 'Product Quality'),
|
||||
'code' => 'productQuality',
|
||||
'driver' => 'duckdb',
|
||||
'desc' => array('zh-cn' => '列出产品的需求数,完成的需求总数,Bug数,解决的Bug总数,Bug/需求,重要Bug数量(严重程度小于3)。', 'zh-tw' => '列出產品的需求數,完成的需求總數,Bug數,解決的Bug總數,Bug/需求,重要Bug數量(嚴重程度小於3)。', 'en' => 'Serious Bug (severity is less than 3).', 'de' => 'Serious Bug (severity is less than 3).', 'fr' => 'Serious Bug (severity is less than 3).'),
|
||||
'dimension' => '1',
|
||||
'group' => '59',
|
||||
@@ -1733,6 +1755,7 @@ $config->bi->builtin->pivots[] = array
|
||||
'id' => 1022,
|
||||
'name' => array('zh-cn' => '员工登录次数统计表', 'zh-tw' => '員工登錄次數統計表', 'en' => 'Login Times', 'de' => 'Login Times', 'fr' => 'Login Times'),
|
||||
'code' => 'loginTimes',
|
||||
'driver' => 'duckdb',
|
||||
'desc' => array('zh-cn' => '实现员工登录次数统计报表,按照天统计每天每个人的登录次数,以及总数。', 'zh-tw' => '實現員工登錄次數統計報表,按照天統計每天每個人的登錄次數,以及總數。', 'en' => 'The summary of user login times.', 'de' => 'The summary of user login times.', 'fr' => 'The summary of user login times.'),
|
||||
'dimension' => '1',
|
||||
'group' => '62',
|
||||
@@ -1790,6 +1813,7 @@ $config->bi->builtin->pivots[] = array
|
||||
'id' => 1023,
|
||||
'name' => array('zh-cn' => '日志汇总表', 'zh-tw' => '日誌匯總表', 'en' => 'Effort Summary', 'de' => 'Effort Summary', 'fr' => 'Effort Summary'),
|
||||
'code' => 'effortSummary',
|
||||
'driver' => 'duckdb',
|
||||
'desc' => array('zh-cn' => '查看某个时间段内的日志情况,可以按照部门选择。', 'zh-tw' => '查看某個時間段內的日誌情況,可以按照部門選擇。', 'en' => 'Effort summary of users.', 'de' => 'Effort summary of users', 'fr' => 'Effort summary of users'),
|
||||
'dimension' => '1',
|
||||
'group' => '62',
|
||||
@@ -1858,6 +1882,7 @@ $config->bi->builtin->pivots[] = array
|
||||
'id' => 1024,
|
||||
'name' => array('zh-cn' => '公司动态汇总表', 'zh-tw' => '公司動態匯總表', 'en' => 'Company Dynamics', 'de' => 'Company Dynamics', 'fr' => 'Company Dynamics'),
|
||||
'code' => 'companyDynamics',
|
||||
'driver' => 'duckdb',
|
||||
'desc' => array('zh-cn' => '可以指定一个时期,列出相应的数据:1. 每天的登录次数。2. 每天的日志工时量。3. 每天新增的需求数。4. 每天关闭的需求数。5. 每天新增的任务数。6. 每天完成的任务数。7. 每天新增的Bug数。8. 每天解决的Bug数。9. 每天的动态数。', 'zh-tw' => '可以指定一個時期,列出相應的數據:1. 每天的登錄次數。2. 每天的日誌工時量。3. 每天新增的需求數。4. 每天關閉的需求數。5. 每天新增的任務數。6. 每天完成的任務數。7. 每天新增的Bug數。8. 每天解決的Bug數。9. 每天的動態數。', 'en' => 'The summary of company dynamics', 'de' => 'The summary of company dynamics', 'fr' => 'The summary of company dynamics'),
|
||||
'dimension' => '1',
|
||||
'group' => '62',
|
||||
@@ -1961,6 +1986,7 @@ $config->bi->builtin->pivots[] = array
|
||||
'id' => 1025,
|
||||
'name' => array('zh-cn' => 'Bug解决表', 'zh-tw' => 'Bug解決表', 'en' => 'Solved Bugs', 'de' => 'Solved Bugs', 'fr' => 'Solved Bugs'),
|
||||
'code' => 'slovedBugs',
|
||||
'driver' => 'duckdb',
|
||||
'desc' => array('zh-cn' => '列出解决的Bug总数,解决方案的分布,占的比例(该用户解决的Bug的数量占所有的解决的Bug的数量)。', 'zh-tw' => '列出解決的Bug總數,解決方案的分布,占的比例(該用戶解決的Bug的數量占所有的解決的Bug的數量)。', 'en' => 'percentage:self resolved / all resolved', 'de' => 'percentage:self resolved / all resolved', 'fr' => 'percentage:self resolved / all resolved'),
|
||||
'dimension' => '1',
|
||||
'group' => '61',
|
||||
@@ -2082,6 +2108,7 @@ $config->bi->builtin->pivots[] = array
|
||||
'id' => 1026,
|
||||
'name' => array('zh-cn' => '项目进展表', 'zh-tw' => '項目進展表', 'en' => 'Project Progress Report', 'de' => 'Project Progress Report', 'fr' => 'Project Progress Report', 'vi' => 'Project Progress Report', 'ja' => 'Project Progress Report'),
|
||||
'code' => 'projectProgress',
|
||||
'driver' => 'duckdb',
|
||||
'desc' => array('zh-cn' => '项目的需求数,任务数,已消耗工时,剩余工时,剩余需求数,剩余任务数,进度。', 'zh-tw' => '項目的需求數,任務數,已消耗工時,剩餘工時,剩餘需求數,剩餘任務數,進度。', 'en' => '', 'de' => '', 'fr' => '', 'vi' => '', 'ja' => ''),
|
||||
'dimension' => '1',
|
||||
'group' => '60',
|
||||
@@ -2171,6 +2198,7 @@ $config->bi->builtin->pivots[] = array
|
||||
'id' => 1027,
|
||||
'name' => array('zh-cn' => '项目Bug类型统计表', 'zh-tw' => '項目Bug類型統計表', 'en' => 'Project Bug Type', 'de' => 'Project Bug Type', 'fr' => 'Project Bug Type', 'vi' => 'Project Bug Type', 'ja' => 'Project Bug Type'),
|
||||
'code' => 'projectBugType',
|
||||
'driver' => 'duckdb',
|
||||
'desc' => array('zh-cn' => '按照项目统计Bug的类型分布情况。', 'zh-tw' => '按照項目統計Bug的類型分布情況。', 'en' => '', 'de' => '', 'fr' => '', 'vi' => '', 'ja' => ''),
|
||||
'dimension' => '1',
|
||||
'group' => '60,61',
|
||||
|
||||
+19
-17
@@ -51,15 +51,15 @@ class biModel extends model
|
||||
* Try to explain sql.
|
||||
*
|
||||
* @param string $sql
|
||||
* @param string $driverName mysql|duckdb
|
||||
* @param string $driver mysql|duckdb
|
||||
* @access public
|
||||
* @return array
|
||||
*/
|
||||
public function explainSQL($sql, $driverName = 'mysql')
|
||||
public function explainSQL($sql, $driver = 'mysql')
|
||||
{
|
||||
$dbh = $this->app->loadDriver($driverName);
|
||||
$dbh = $this->app->loadDriver($driver);
|
||||
|
||||
$prefixSQL = $driverName == 'mysql' ? 'EXPLAIN' : 'PRAGMA enable_profiling=json; EXPLAIN ANALYZE';
|
||||
$prefixSQL = $driver == 'mysql' ? 'EXPLAIN' : 'PRAGMA enable_profiling=json; EXPLAIN ANALYZE';
|
||||
try
|
||||
{
|
||||
$rows = $dbh->query("$prefixSQL $sql")->fetchAll();
|
||||
@@ -79,23 +79,23 @@ class biModel extends model
|
||||
*
|
||||
* @param string $sql
|
||||
* @param string $limitSql
|
||||
* @param string $driverName mysql|duckdb
|
||||
* @param string $driver mysql|duckdb
|
||||
* @access public
|
||||
* @return array
|
||||
*/
|
||||
public function querySQL($sql, $limitSql, $driverName = 'mysql')
|
||||
public function querySQL($sql, $limitSql, $driver = 'mysql')
|
||||
{
|
||||
$dbh = $this->app->loadDriver($driverName);
|
||||
$dbh = $this->app->loadDriver($driver);
|
||||
|
||||
try
|
||||
{
|
||||
if($driverName == 'mysql')
|
||||
if($driver == 'mysql')
|
||||
{
|
||||
$rows = $dbh->query($limitSql)->fetchAll();
|
||||
$count = $dbh->query("SELECT FOUND_ROWS() as count")->fetch();
|
||||
$rowsCount = $count->count;
|
||||
}
|
||||
elseif($driverName == 'duckdb')
|
||||
elseif($driver == 'duckdb')
|
||||
{
|
||||
$rows = $dbh->query($limitSql)->fetchAll();
|
||||
$allRows = $dbh->query("SELECT COUNT(1) as count FROM ( $sql )")->fetch();
|
||||
@@ -116,15 +116,15 @@ class biModel extends model
|
||||
* Get sql result columns.
|
||||
*
|
||||
* @param string $sql
|
||||
* @param string $driverName mysql|duckdb
|
||||
* @param string $driver mysql|duckdb
|
||||
* @access public
|
||||
* @return array|false
|
||||
*/
|
||||
public function getColumns(string $sql, $driverName = 'mysql'): array|false
|
||||
public function getColumns(string $sql, $driver = 'mysql'): array|false
|
||||
{
|
||||
if(!in_array($driverName, $this->config->bi->driverNames)) return false;
|
||||
if(!in_array($driver, $this->config->bi->drivers)) return false;
|
||||
|
||||
if($driverName == 'mysql')
|
||||
if($driver == 'mysql')
|
||||
{
|
||||
$columns = $this->dao->getColumns($sql);
|
||||
}
|
||||
@@ -139,8 +139,8 @@ class biModel extends model
|
||||
{
|
||||
$column = (array)$column;
|
||||
|
||||
$name = $driverName == 'mysql' ? $column['name'] : $column['column_name'];
|
||||
$nativeType = $driverName == 'mysql' ? $column['native_type'] : $column['column_type'];
|
||||
$name = $driver == 'mysql' ? $column['name'] : $column['column_name'];
|
||||
$nativeType = $driver == 'mysql' ? $column['native_type'] : $column['column_type'];
|
||||
|
||||
$result[$name] = array('name' => $name, 'native_type' => $nativeType);
|
||||
}
|
||||
@@ -278,13 +278,15 @@ class biModel extends model
|
||||
* @param string $sql
|
||||
* @param string $keyField
|
||||
* @param string $valueField
|
||||
* @param string $driver
|
||||
* @access public
|
||||
* @return array
|
||||
*/
|
||||
public function getOptionsFromSql(string $sql, string $keyField, string $valueField): array
|
||||
public function getOptionsFromSql(string $sql, string $keyField, string $valueField, string $driver): array
|
||||
{
|
||||
$options = array();
|
||||
$cols = $this->dbh->query($sql)->fetchAll();
|
||||
$dbh = $this->app->loadDriver($driver);
|
||||
$cols = $dbh->query($sql)->fetchAll();
|
||||
$sample = current($cols);
|
||||
|
||||
if(!isset($sample->$keyField) or !isset($sample->$valueField)) return $options;
|
||||
|
||||
@@ -607,7 +607,7 @@ class chartModel extends model
|
||||
* @access public
|
||||
* @return array
|
||||
*/
|
||||
public function getSysOptions(string $type, string $object = '', string $field = '', string $sql = '', string $saveAs = ''): array
|
||||
public function getSysOptions(string $type, string $object = '', string $field = '', string $sql = '', string $saveAs = '', $driver = 'mysql'): array
|
||||
{
|
||||
if(in_array($type, array('user', 'product', 'project', 'execution', 'dept'))) return $this->bi->getScopeOptions($type);
|
||||
if(!$field) return array();
|
||||
@@ -627,14 +627,14 @@ class chartModel extends model
|
||||
{
|
||||
$keyField = $field;
|
||||
$valueField = $saveAs ? $saveAs : $field;
|
||||
$options = $this->bi->getOptionsFromSql($sql, $keyField, $valueField);
|
||||
$options = $this->bi->getOptionsFromSql($sql, $driver, $keyField, $valueField);
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
if($sql and $saveAs and in_array($type, array('user', 'product', 'project', 'execution', 'dept', 'option', 'object')))
|
||||
{
|
||||
$options = $this->bi->getOptionsFromSql($sql, $field, $saveAs);
|
||||
$options = $this->bi->getOptionsFromSql($sql, $driver, $field, $saveAs);
|
||||
}
|
||||
|
||||
return array_filter($options);
|
||||
|
||||
@@ -33,10 +33,9 @@ function query(callback) {
|
||||
|
||||
$('.query').addClass('disabled');
|
||||
$('#querying').removeClass('hidden');
|
||||
$.post(createLink('dataview', 'ajaxQuery'), {sql: $('#sql').val(), filters: filters, recPerPage: DataStorage.recPerPage, pageID: DataStorage.pageID}, function(resp)
|
||||
$.post(createLink('dataview', 'ajaxQuery'), {sql: $('#sql').val(), driver: DataStorage.driver, filters: filters, recPerPage: DataStorage.recPerPage, pageID: DataStorage.pageID}, function(resp)
|
||||
{
|
||||
resp = JSON.parse(resp);
|
||||
console.log(resp);
|
||||
$('.query').removeClass('disabled');
|
||||
$('#querying').addClass('hidden');
|
||||
if(resp.result !== 'success')
|
||||
|
||||
@@ -388,6 +388,7 @@ class installModel extends model
|
||||
/* Prepare built-in sqls of bi. */
|
||||
$chartSQLs = $this->bi->prepareBuiltinChartSQL();
|
||||
$pivotSQLs = $this->bi->prepareBuiltinPivotSQL();
|
||||
$chartSQLs = array();
|
||||
|
||||
$insertTables = array_merge($chartSQLs, $pivotSQLs);
|
||||
|
||||
|
||||
@@ -110,16 +110,17 @@ class pivot extends control
|
||||
$settings['filterType'] = $filterType;
|
||||
|
||||
$sql = str_replace(';', '', "$post->sql");
|
||||
$driver = $pivot->driver;
|
||||
$fields = $post->fieldSettings;
|
||||
$langs = isset($post->langs) ? (is_array($post->langs) ? $post->langs : json_decode($post->langs, true)) : array();
|
||||
|
||||
if(isset($settings['summary']) and $settings['summary'] == 'notuse')
|
||||
{
|
||||
list($data, $configs) = $this->pivot->genOriginSheet($fields, $settings, $sql, $filterFormat, $langs);
|
||||
list($data, $configs) = $this->pivot->genOriginSheet($fields, $settings, $sql, $filterFormat, $langs, $driver);
|
||||
}
|
||||
else
|
||||
{
|
||||
list($data, $configs) = $this->pivot->genSheet($fields, $settings, $sql, $filterFormat, $langs);
|
||||
list($data, $configs) = $this->pivot->genSheet($fields, $settings, $sql, $filterFormat, $langs, $driver);
|
||||
}
|
||||
|
||||
$this->pivot->buildPivotTable($data, $configs, $page);
|
||||
|
||||
+18
-20
@@ -802,11 +802,11 @@ class pivotModel extends model
|
||||
* @access public
|
||||
* @return array
|
||||
*/
|
||||
public function mapRecordValueWithFieldOptions(array $records, array $fields, string $sql): array
|
||||
public function mapRecordValueWithFieldOptions(array $records, array $fields, string $sql, string $driver): array
|
||||
{
|
||||
$this->app->loadConfig('dataview');
|
||||
$records = json_decode(json_encode($records), true);
|
||||
$fieldOptions = $this->getFieldsOptions($fields, $sql);
|
||||
$fieldOptions = $this->getFieldsOptions($fields, $sql, $driver);
|
||||
foreach($records as $index => $record)
|
||||
{
|
||||
foreach($record as $field => $value)
|
||||
@@ -1311,7 +1311,7 @@ class pivotModel extends model
|
||||
* @access public
|
||||
* @return array
|
||||
*/
|
||||
public function genSheet(array $fields, array $settings, string $sql, array $filters, array $langs = array()): array
|
||||
public function genSheet(array $fields, array $settings, string $sql, array $filters, array $langs = array(), string $driver = 'mysql'): array
|
||||
{
|
||||
$groups = $this->getGroupsFromSettings($settings);
|
||||
$cols = $this->generateTableCols($fields, $groups, $langs);
|
||||
@@ -1321,11 +1321,9 @@ class pivotModel extends model
|
||||
$sql = $this->trimSemicolon($sql);
|
||||
$sql = $this->appendWhereFilterToSql($sql, $filters);
|
||||
|
||||
$driverName = 'duckdb';
|
||||
$driverName = 'mysql';
|
||||
$dbh = $this->app->loadDriver($driverName);
|
||||
$dbh = $this->app->loadDriver($driver);
|
||||
$records = $dbh->query($sql)->fetchAll();
|
||||
$records = $this->mapRecordValueWithFieldOptions($records, $fields, $sql);
|
||||
$records = $this->mapRecordValueWithFieldOptions($records, $fields, $sql, $driver);
|
||||
|
||||
$showColTotal = zget($settings, 'columnTotal', 'noShow');
|
||||
|
||||
@@ -1341,7 +1339,7 @@ class pivotModel extends model
|
||||
$columnField = $columnSetting['field'];
|
||||
$columnSlice = zget($columnSetting, 'slice', 'noSlice');
|
||||
|
||||
$cols = $this->getTableHeader($records, $columnSetting, $fields, $cols, $sql, $langs, $columnShowOrigin);
|
||||
$cols = $this->getTableHeader($records, $columnSetting, $fields, $cols, $sql, $langs, $columnShowOrigin, $driver);
|
||||
|
||||
if($columnShowOrigin)
|
||||
{
|
||||
@@ -1461,7 +1459,7 @@ class pivotModel extends model
|
||||
* @access public
|
||||
* @return string
|
||||
*/
|
||||
public function genOriginSheet($fields, $settings, $sql, $filters, $langs = array())
|
||||
public function genOriginSheet($fields, $settings, $sql, $filters, $langs = array(), $driver = 'mysql')
|
||||
{
|
||||
$sql = $this->initVarFilter($filters, $sql);
|
||||
|
||||
@@ -1491,7 +1489,9 @@ class pivotModel extends model
|
||||
$sql = $statement->build();
|
||||
|
||||
$columnSQL = "select * from ($sql) tt" . $connectSQL;
|
||||
$rows = $this->dao->query($columnSQL)->fetchAll();
|
||||
|
||||
$dbh = $this->app->loadDriver($driver);
|
||||
$rows = $dbh->query($columnSQL)->fetchAll();
|
||||
$rows = json_decode(json_encode($rows), true);
|
||||
|
||||
$cols = array();
|
||||
@@ -1838,7 +1838,7 @@ class pivotModel extends model
|
||||
* @access public
|
||||
* @return array
|
||||
*/
|
||||
public function getTableHeader($columnRows, $column, $fields, $cols, $sql, $langs = array(), $showOrigin = false)
|
||||
public function getTableHeader($columnRows, $column, $fields, $cols, $sql, $langs = array(), $showOrigin = false, $driver = 'mysql')
|
||||
{
|
||||
$stat = zget($column, 'stat', '');
|
||||
$showMode = zget($column, 'showMode', 'default');
|
||||
@@ -1881,7 +1881,7 @@ class pivotModel extends model
|
||||
$sliceList = array();
|
||||
foreach($columnRows as $rows) $sliceList[$rows->{$slice}] = $rows->{$slice};
|
||||
|
||||
$optionList = $this->getSysOptions($fields[$slice]['type'], $fields[$slice]['object'], $fields[$slice]['field'], $sql);
|
||||
$optionList = $this->getSysOptions($fields[$slice]['type'], $fields[$slice]['object'], $fields[$slice]['field'], $sql, '', $driver);
|
||||
foreach($sliceList as $field)
|
||||
{
|
||||
$childCol = new stdclass();
|
||||
@@ -2191,7 +2191,7 @@ class pivotModel extends model
|
||||
* @access public
|
||||
* @return array
|
||||
*/
|
||||
public function getSysOptions($type, $object = '', $field = '', $source = '', $saveAs = '')
|
||||
public function getSysOptions($type, $object = '', $field = '', $source = '', $saveAs = '', $driver = 'mysql')
|
||||
{
|
||||
if(in_array($type, array('user', 'product', 'project', 'execution', 'dept', 'project.status'))) return $this->bi->getScopeOptions($type);
|
||||
if(!$field) return array();
|
||||
@@ -2226,7 +2226,7 @@ class pivotModel extends model
|
||||
{
|
||||
$keyField = $field;
|
||||
$valueField = $saveAs ? $saveAs : $field;
|
||||
$options = $this->bi->getOptionsFromSql($source, $keyField, $valueField);
|
||||
$options = $this->bi->getOptionsFromSql($source, $driver, $keyField, $valueField);
|
||||
}
|
||||
}
|
||||
break;
|
||||
@@ -2234,7 +2234,7 @@ class pivotModel extends model
|
||||
|
||||
if(is_string($source) and $source and $saveAs and in_array($type, array('user', 'product', 'project', 'execution', 'dept', 'option', 'object')))
|
||||
{
|
||||
$options = $this->bi->getOptionsFromSql($source, $field, $saveAs);
|
||||
$options = $this->bi->getOptionsFromSql($source, $driver, $field, $saveAs);
|
||||
}
|
||||
|
||||
return array_filter($options);
|
||||
@@ -2308,13 +2308,11 @@ class pivotModel extends model
|
||||
* @return array
|
||||
*
|
||||
*/
|
||||
public function getFieldsOptions(array $fieldSettings, string $sql, string $driverName = 'mysql'): array
|
||||
public function getFieldsOptions(array $fieldSettings, string $sql, string $driver = 'mysql'): array
|
||||
{
|
||||
$options = array();
|
||||
|
||||
$driverName = 'duckdb';
|
||||
$driverName = 'mysql';
|
||||
$dbh = $this->app->loadDriver($driverName);
|
||||
$dbh = $this->app->loadDriver($driver);
|
||||
$sqlRecords = $dbh->query($sql)->fetchAll();
|
||||
|
||||
foreach($fieldSettings as $key => $fieldSetting)
|
||||
@@ -2326,7 +2324,7 @@ class pivotModel extends model
|
||||
$source = $sql;
|
||||
if(in_array($type, array('string', 'number', 'date'))) $source = $sqlRecords;
|
||||
|
||||
$options[$key] = $this->getSysOptions($type, $object, $field, $source);
|
||||
$options[$key] = $this->getSysOptions($type, $object, $field, $source, '', $driver);
|
||||
}
|
||||
|
||||
return $options;
|
||||
|
||||
@@ -133,7 +133,8 @@ class pivotZen extends pivot
|
||||
*/
|
||||
public function show(int $groupID, int $pivotID): void
|
||||
{
|
||||
$pivot = $this->pivot->getByID($pivotID);
|
||||
$pivot = $this->pivot->getByID($pivotID);
|
||||
$driver = $pivot->driver;
|
||||
if(isset($_POST['filterValues']) and $_POST['filterValues'])
|
||||
{
|
||||
foreach($this->post->filterValues as $key => $value) $pivot->filters[$key]['default'] = $value;
|
||||
@@ -147,11 +148,11 @@ class pivotZen extends pivot
|
||||
|
||||
if(isset($pivot->settings['summary']) and $pivot->settings['summary'] == 'notuse')
|
||||
{
|
||||
list($data, $configs) = $this->pivot->genOriginSheet($fields, $pivot->settings, $sql, $filterFormat, $langs);
|
||||
list($data, $configs) = $this->pivot->genOriginSheet($fields, $pivot->settings, $sql, $filterFormat, $langs, $driver);
|
||||
}
|
||||
else
|
||||
{
|
||||
list($data, $configs) = $this->pivot->genSheet($fields, $pivot->settings, $sql, $filterFormat, $langs);
|
||||
list($data, $configs) = $this->pivot->genSheet($fields, $pivot->settings, $sql, $filterFormat, $langs, $driver);
|
||||
}
|
||||
|
||||
$this->view->pivotName = $pivot->name;
|
||||
|
||||
@@ -28,6 +28,11 @@ class upgrade extends control
|
||||
$this->locate(inlink('backup'));
|
||||
}
|
||||
|
||||
public function importBIData()
|
||||
{
|
||||
$this->loadModel('install')->importBIData();
|
||||
}
|
||||
|
||||
/**
|
||||
* 授权协议页面。
|
||||
* Check agree license.
|
||||
|
||||
Reference in New Issue
Block a user