Commit 454b896e authored by 吴文龙's avatar 吴文龙

增加能源报表接口

parent 020bb565
......@@ -114,6 +114,18 @@ INSERT INTO `api_config` (`id`, `path`, `name`, `note`, `params`, `status`, `dat
INSERT INTO `api_config` (`id`, `path`, `name`, `note`, `params`, `status`, `datasource_id`, `previlege`, `group_id`, `cache_plugin`, `cache_plugin_params`, `create_time`, `update_time`, `type`, `open_trans`, `content_type`, `json_param`) VALUES ('yBjFp1tx', 'f_pub_trep_group_detail', '公共班组能耗报表', NULL, '[{\"name\":\"tid\",\"type\":\"string\",\"note\":\"租户ID\"},{\"name\":\"date\",\"type\":\"string\",\"note\":\"日期\"},{\"name\":\"deviceName\",\"type\":\"string\",\"note\":\"设备名称\"},{\"name\":\"propName\",\"type\":\"string\",\"note\":\"属性名称\"},{\"name\":\"grpcode\",\"type\":\"string\",\"note\":\"班组\"},{\"name\":\"grptype\",\"type\":\"string\",\"note\":\"分组\"}]', 1, 'kSC2Qziy', 1, '1RNi0tix', NULL, NULL, '2023-07-11 09:27:02', '2023-07-11 09:42:35', 0, 0, 'application/x-www-form-urlencoded', NULL);
INSERT INTO `api_config` (`id`, `path`, `name`, `note`, `params`, `status`, `datasource_id`, `previlege`, `group_id`, `cache_plugin`, `cache_plugin_params`, `create_time`, `update_time`, `type`, `open_trans`, `content_type`, `json_param`) VALUES ('YM5183P7', 'junlin_auto_energy', '君霖数据重算', NULL, '[]', 1, 'kSC2Qziy', 1, 'GvwgzOrx', NULL, NULL, '2022-11-29 21:00:52', '2023-05-08 11:11:54', 0, 0, 'application/x-www-form-urlencoded', NULL);
INSERT INTO `api_config` (`id`, `path`, `name`, `note`, `params`, `status`, `datasource_id`, `previlege`, `group_id`, `cache_plugin`, `cache_plugin_params`, `create_time`, `update_time`, `type`, `open_trans`, `content_type`, `json_param`) VALUES ('ZwOIf9HG', 'getWorkshopListTest', 'getWorkshopListTest', 'getWorkshopListTest测试', '[{\"name\":\"workshop_id\",\"type\":\"Array<string>\",\"note\":\"车间id集合\"}]', 1, 'kSC2Qziy', 1, 'rihofAYb', NULL, NULL, '2023-02-28 10:33:26', '2023-02-28 11:02:09', 0, 0, 'application/x-www-form-urlencoded', NULL);
INSERT INTO `api_config` (`id`, `path`, `name`, `note`, `params`, `status`, `datasource_id`, `previlege`, `group_id`, `cache_plugin`, `cache_plugin_params`, `create_time`, `update_time`, `type`, `json_param`, `open_trans`, `content_type`) VALUES ('5yT39rTw', 'f_pub_trep_energy_detail', '能源仪表用量查询', NULL, '[{\"name\":\"start_time\",\"type\":\"string\",\"note\":\"d\"},{\"name\":\"end_time\",\"type\":\"string\",\"note\":\"d\"},{\"name\":\"dname\",\"type\":\"string\",\"note\":\"d\"},{\"name\":\"type_name\",\"type\":\"string\",\"note\":\"d\"},{\"name\":\"tid\",\"type\":\"string\",\"note\":\"d\"},{\"name\":\"wname\",\"type\":\"string\"}]', 1, 'kSC2Qziy', 1, 'eh0n3eUm', NULL, NULL, '2023-08-23 13:57:07', '2023-08-30 10:21:37', 0, NULL, 0, 'application/x-www-form-urlencoded');
INSERT INTO `api_config` (`id`, `path`, `name`, `note`, `params`, `status`, `datasource_id`, `previlege`, `group_id`, `cache_plugin`, `cache_plugin_params`, `create_time`, `update_time`, `type`, `json_param`, `open_trans`, `content_type`) VALUES ('8SzuiAbE', 'tmp_denergy_month', '设备能源分析(月)', '设备能源分析(月)', '[{\"name\":\"year_int\",\"type\":\"bigint\",\"note\":\"\"},{\"name\":\"tid\",\"type\":\"string\",\"note\":\"租户id\"}]', 1, 'kSC2Qziy', 1, 'eh0n3eUm', NULL, NULL, '2023-08-28 14:49:01', '2023-08-30 10:20:15', 0, NULL, 0, 'application/x-www-form-urlencoded');
INSERT INTO `api_config` (`id`, `path`, `name`, `note`, `params`, `status`, `datasource_id`, `previlege`, `group_id`, `cache_plugin`, `cache_plugin_params`, `create_time`, `update_time`, `type`, `json_param`, `open_trans`, `content_type`) VALUES ('evthM2bc', 'iot/deviceDailyEnergyanalysis', '报表-机台能源分析(日)', '报表-机台能源分析(日)', '[]', 1, 'kSC2Qziy', 1, 'eh0n3eUm', NULL, NULL, '2023-08-29 14:04:56', '2023-08-30 10:20:05', 0, NULL, 0, 'application/json');
INSERT INTO `api_config` (`id`, `path`, `name`, `note`, `params`, `status`, `datasource_id`, `previlege`, `group_id`, `cache_plugin`, `cache_plugin_params`, `create_time`, `update_time`, `type`, `json_param`, `open_trans`, `content_type`) VALUES ('HMDaRCo8', 'factoryEnergyAnalysis', '工厂能源分析', NULL, '[{\"name\":\"date\",\"type\":\"bigint\"},{\"name\":\"dep\",\"type\":\"bigint\"},{\"name\":\"tid\",\"type\":\"string\"}]', 1, 'kSC2Qziy', 1, 'eh0n3eUm', NULL, NULL, '2023-08-24 15:47:52', '2023-08-30 10:21:15', 0, NULL, 0, 'application/x-www-form-urlencoded');
INSERT INTO `api_config` (`id`, `path`, `name`, `note`, `params`, `status`, `datasource_id`, `previlege`, `group_id`, `cache_plugin`, `cache_plugin_params`, `create_time`, `update_time`, `type`, `json_param`, `open_trans`, `content_type`) VALUES ('K29naO78', 'tmp_wenergy_month', '车间能源分析(月)', '车间能源分析(月)', '[{\"name\":\"year_int\",\"type\":\"bigint\",\"note\":\"\"},{\"name\":\"tid\",\"type\":\"string\",\"note\":\"租户id\"}]', 1, 'kSC2Qziy', 1, 'eh0n3eUm', NULL, NULL, '2023-08-28 14:42:49', '2023-08-30 10:20:26', 0, NULL, 0, 'application/x-www-form-urlencoded');
INSERT INTO `api_config` (`id`, `path`, `name`, `note`, `params`, `status`, `datasource_id`, `previlege`, `group_id`, `cache_plugin`, `cache_plugin_params`, `create_time`, `update_time`, `type`, `json_param`, `open_trans`, `content_type`) VALUES ('kJ2vKiZb', 'workEnergyAnalysis', '车间能源分析', NULL, '[{\"name\":\"date\",\"type\":\"bigint\"},{\"name\":\"dep\",\"type\":\"bigint\"},{\"name\":\"tid\",\"type\":\"string\"}]', 1, 'kSC2Qziy', 1, 'eh0n3eUm', NULL, NULL, '2023-08-24 15:31:55', '2023-08-30 10:21:07', 0, NULL, 0, 'application/x-www-form-urlencoded');
INSERT INTO `api_config` (`id`, `path`, `name`, `note`, `params`, `status`, `datasource_id`, `previlege`, `group_id`, `cache_plugin`, `cache_plugin_params`, `create_time`, `update_time`, `type`, `json_param`, `open_trans`, `content_type`) VALUES ('Nx4g8GTB', 'pubHalfEnergy', '半点能耗统计', '半点能耗统计', '[]', 1, 'kSC2Qziy', 1, 'eh0n3eUm', NULL, NULL, '2023-08-25 10:54:56', '2023-08-30 10:20:48', 0, NULL, 0, 'application/json');
INSERT INTO `api_config` (`id`, `path`, `name`, `note`, `params`, `status`, `datasource_id`, `previlege`, `group_id`, `cache_plugin`, `cache_plugin_params`, `create_time`, `update_time`, `type`, `json_param`, `open_trans`, `content_type`) VALUES ('p2UJlrzZ', 'dbapi/iot/dailyEnergyanalysis', '报表-工厂能源分析(日)', '报表-工厂能源分析(日)', '[]', 1, 'kSC2Qziy', 1, 'eh0n3eUm', NULL, NULL, '2023-08-25 13:41:51', '2023-08-30 10:19:44', 0, NULL, 0, 'application/json');
INSERT INTO `api_config` (`id`, `path`, `name`, `note`, `params`, `status`, `datasource_id`, `previlege`, `group_id`, `cache_plugin`, `cache_plugin_params`, `create_time`, `update_time`, `type`, `json_param`, `open_trans`, `content_type`) VALUES ('RN17YQZz', 'tmp_fenergy_month', '工厂能源分析(月)', '工厂能源分析(月)', '[{\"name\":\"year_int\",\"type\":\"bigint\",\"note\":\"\"},{\"name\":\"tid\",\"type\":\"string\",\"note\":\"租户id\"}]', 1, 'kSC2Qziy', 1, 'eh0n3eUm', NULL, NULL, '2023-08-28 14:30:26', '2023-08-30 10:20:41', 0, NULL, 0, 'application/x-www-form-urlencoded');
INSERT INTO `api_config` (`id`, `path`, `name`, `note`, `params`, `status`, `datasource_id`, `previlege`, `group_id`, `cache_plugin`, `cache_plugin_params`, `create_time`, `update_time`, `type`, `json_param`, `open_trans`, `content_type`) VALUES ('SK6hQIOj', 'pub_latest_telemetry', '仪表当前读数', '', '[{\"name\":\"tid\",\"type\":\"string\",\"note\":\"租户ID\"},{\"name\":\"dname\",\"type\":\"string\",\"note\":\"设备名称\"},{\"name\":\"fname\",\"type\":\"string\",\"note\":\"工厂名称\"},{\"name\":\"wname\",\"type\":\"string\",\"note\":\"车间名称\"},{\"name\":\"grpname\",\"type\":\"string\",\"note\":\"分组名称\"}]', 1, 'kSC2Qziy', 1, 'eh0n3eUm', NULL, NULL, '2023-08-24 10:41:53', '2023-08-30 10:21:24', 0, NULL, 0, 'application/x-www-form-urlencoded');
INSERT INTO `api_config` (`id`, `path`, `name`, `note`, `params`, `status`, `datasource_id`, `previlege`, `group_id`, `cache_plugin`, `cache_plugin_params`, `create_time`, `update_time`, `type`, `json_param`, `open_trans`, `content_type`) VALUES ('V6VnrUXa', 'EquipmentEnergyAnalysis', '设备能源分析', NULL, '[{\"name\":\"date\",\"type\":\"bigint\"},{\"name\":\"dep\",\"type\":\"bigint\"},{\"name\":\"tid\",\"type\":\"string\"}]', 1, 'kSC2Qziy', 1, 'eh0n3eUm', NULL, NULL, '2023-08-23 18:01:24', '2023-08-30 10:21:00', 0, NULL, 0, 'application/x-www-form-urlencoded');
INSERT INTO `api_config` (`id`, `path`, `name`, `note`, `params`, `status`, `datasource_id`, `previlege`, `group_id`, `cache_plugin`, `cache_plugin_params`, `create_time`, `update_time`, `type`, `json_param`, `open_trans`, `content_type`) VALUES ('XO3iDJu3', 'iot/workshopDailyEnergyanalysis', '报表-车间能源分析(日)', '车间能源分析(日)', '[]', 1, 'kSC2Qziy', 1, 'eh0n3eUm', NULL, NULL, '2023-08-29 14:03:04', '2023-08-30 10:19:55', 0, NULL, 0, 'application/json');
COMMIT;
-- ----------------------------
......@@ -159,6 +171,7 @@ INSERT INTO `api_group` (`id`, `name`) VALUES ('uJCO6Dvv', '定时任务统计_
INSERT INTO `api_group` (`id`, `name`) VALUES ('EK9Hliz0', '定时任务统计_写入v3_pgSql_纬度');
INSERT INTO `api_group` (`id`, `name`) VALUES ('GvwgzOrx', '定时任务统计_写入v3_pgSql_能耗统计');
INSERT INTO `api_group` (`id`, `name`) VALUES ('omd4MV0A', '定时任务统计_写入v3_pgSql_能耗统计(碱,蒸汽)');
INSERT INTO `api_group` (`id`, `name`) VALUES ('eh0n3eUm', '能源报表');
COMMIT;
-- ----------------------------
......@@ -251,6 +264,37 @@ INSERT INTO `api_sql` (`id`, `api_id`, `sql_text`, `transform_plugin`, `transfor
INSERT INTO `api_sql` (`id`, `api_id`, `sql_text`, `transform_plugin`, `transform_plugin_params`) VALUES (596, 'FNMVwfcu', '\ninsert into trep_group_sta_detail as trep \n (tid,did,bdate,grpcode,key,val,cron,len,time,ctime,mtime,created_time,updated_time)\nSELECT a.tid,a.did,a.tarr::date as bdate,a.code,a.key,\n a.val,\n 60 as cron,1 as len ,\n 60*1 as time,\n CURRENT_TIMESTAMP,CURRENT_TIMESTAMP,\n (extract(epoch from CURRENT_TIMESTAMP) * 1000)::int8,\n (extract(epoch from CURRENT_TIMESTAMP) * 1000)::int8 \nfrom \n(\n SELECT t.tid,t.did,t.key,\n case when round(date_part(\'epoch\', now()::timestamp - t.update_time::timestamp)::NUMERIC / 60) >= 5 then \'9\' \n else t.val \n end as val,c.code,c.descript,c.tarr,c.tdep\n from vcode_key_detail t ,tcode_model_detail b,(\n SELECT a.* from\n (\n SELECT CONCAT((CURRENT_DATE)::TEXT,\' \',t.arr)::TIMESTAMP as tarr,\n CONCAT((CURRENT_DATE+tdays)::TEXT,\' \',t.dep)::TIMESTAMP as tdep,\n t.* from tcode_group t\n UNION\n SELECT CONCAT((CURRENT_DATE-tdays)::TEXT,\' \',t.arr)::TIMESTAMP as tarr,\n CONCAT((CURRENT_DATE)::TEXT,\' \',t.dep)::TIMESTAMP as tdep,\n t.* from tcode_group t\n where t.tdays &gt; 0\n \n ) a \n where (CURRENT_TIMESTAMP BETWEEN a.tarr and a.tdep) \n ) c\n where t.tid = b.tenant_id and \n t.tid = c.tid and \n t.key = b.key and \n b.code = \'default\' and \n b.change = true\n) a\nON CONFLICT (tid,did,bdate,grpcode,key,val)\nDO UPDATE SET \nlen = trep.len + EXCLUDED.len,\ntime = (trep.len + EXCLUDED.len) * 60,\nmtime = CURRENT_TIMESTAMP,\nupdated_time = (extract(epoch from CURRENT_TIMESTAMP) * 1000)::int8;\n\n\n', NULL, NULL);
INSERT INTO `api_sql` (`id`, `api_id`, `sql_text`, `transform_plugin`, `transform_plugin_params`) VALUES (597, 'FNMVwfcu', '-- 记录日志\nINSERT INTO \"public\".\"trep_group_sta_detail_log\" (\"created_time\", \"start_time\") VALUES ((extract(epoch from CURRENT_TIMESTAMP) * 1000)::int8, NOW());\n', NULL, NULL);
INSERT INTO `api_sql` (`id`, `api_id`, `sql_text`, `transform_plugin`, `transform_plugin_params`) VALUES (598, '73T52QSe', 'update trep_group_sta_detail set \ntime = time + 43200 - c.times \n from (\n SELECT a.did,max(a.mtime) as mtime \n FROM trep_group_sta_detail a\n where a.bdate = CURRENT_DATE - 1 and \n a.tid = \'22eed190-39af-11ed-8d4e-1d9073a615c6\' and \n a.grpcode = \'pm\'\n GROUP BY a.did\n ORDER BY a.did \n ) a,\n (SELECT t.did,sum(time) as times from trep_group_sta_detail t \n where t.bdate = CURRENT_DATE - 1 and \n t.tid = \'22eed190-39af-11ed-8d4e-1d9073a615c6\' and \n t.grpcode = \'pm\'\n GROUP BY t.did\n ORDER BY t.did) c\nwhere trep_group_sta_detail.bdate = CURRENT_DATE - 1 and \n trep_group_sta_detail.tid = \'22eed190-39af-11ed-8d4e-1d9073a615c6\' and \n trep_group_sta_detail.grpcode = \'pm\' and \n trep_group_sta_detail.did = a.did and \n trep_group_sta_detail.mtime = a.mtime and \n trep_group_sta_detail.did = c.did \n \n ', NULL, NULL);
INSERT INTO `api_sql` (`id`, `api_id`, `sql_text`, `transform_plugin`, `transform_plugin_params`) VALUES (837, 'p2UJlrzZ', '-- 请输入sql,一个标签只能输入一条sql\nselect \'工厂名称\' as title,\'fname\' as datakey,\'100px\' as width,\'text\' as dataType,\'text\' as editType,\'\' as lock,\'\' as render,0 as tag,1 as export\nunion all\nSELECT \'能源类型\' as title,\'name\' as datakey,\'150px\' as width ,\'text\' as dataType,\'text\' as editType,\'\' as lock,\'\' as render,0 as tag,1 as export\nunion all\nselect \'单位\' as title,\'units\' as datakey,\'120px\' as width,\'text\' as dataType,\'text\' as editType,\'\' as lock,\'\' as render,0 as tag,1 as export\nunion all\nSELECT to_char(date_value, \'YYYY-MM-DD\') as title, to_char(date_value, \'YYYY-MM-DD\') as dataKey ,\'110px\' as width,\'money\' as dataType,\'text\' as editType,\'\' as lock,\'\' as render,1 as tag,1 as export\n from generate_month_dates(#{year}::int4, #{month}::int4) \n union all \nselect \'累计用量\' as title,\'total_energy\' as datakey,\'100px\' as width,\'text\' as dataType,\'text\' as editType,\'\' as lock,\'\' as render,0 as tag,1 as export', NULL, NULL);
INSERT INTO `api_sql` (`id`, `api_id`, `sql_text`, `transform_plugin`, `transform_plugin_params`) VALUES (838, 'p2UJlrzZ', '-- 生成临时表\nselect * from generate_dynamic_table_f(#{year}::int4, #{month}::int4,#{tid});', NULL, NULL);
INSERT INTO `api_sql` (`id`, `api_id`, `sql_text`, `transform_plugin`, `transform_plugin_params`) VALUES (839, 'p2UJlrzZ', '-- 查询临时表\nselect * from tmp_target_table_f', NULL, NULL);
INSERT INTO `api_sql` (`id`, `api_id`, `sql_text`, `transform_plugin`, `transform_plugin_params`) VALUES (840, 'XO3iDJu3', '-- 表头\nselect \'车间名称\' as title,\'wname\' as datakey,\'100px\' as width,\'text\' as dataType,\'text\' as editType,\'\' as lock,\'\' as render,0 as tag,1 as export\nunion all\nSELECT \'能源类型\' as title,\'name\' as datakey,\'150px\' as width ,\'text\' as dataType,\'text\' as editType,\'\' as lock,\'\' as render,0 as tag,1 as export\nunion all\nselect \'单位\' as title,\'units\' as datakey,\'120px\' as width,\'text\' as dataType,\'text\' as editType,\'\' as lock,\'\' as render,0 as tag,1 as export\nunion all\nSELECT to_char(date_value, \'YYYY-MM-DD\') as title, to_char(date_value, \'YYYY-MM-DD\') as dataKey ,\'110px\' as width,\'money\' as dataType,\'text\' as editType,\'\' as lock,\'\' as render,1 as tag,1 as export\n from generate_month_dates(#{year}::int4, #{month}::int4) \nunion all \nselect \'累计用量\' as title,\'total_energy\' as datakey,\'100px\' as width,\'text\' as dataType,\'text\' as editType,\'\' as lock,\'\' as render,0 as tag,1 as export\n', NULL, NULL);
INSERT INTO `api_sql` (`id`, `api_id`, `sql_text`, `transform_plugin`, `transform_plugin_params`) VALUES (841, 'XO3iDJu3', '-- 生成临时表\nselect * from generate_dynamic_table_workshop(#{year}::int4, #{month}::int4,#{tid});', NULL, NULL);
INSERT INTO `api_sql` (`id`, `api_id`, `sql_text`, `transform_plugin`, `transform_plugin_params`) VALUES (842, 'XO3iDJu3', '-- 查询临时表\nselect * from tmp_target_table_workshop', NULL, NULL);
INSERT INTO `api_sql` (`id`, `api_id`, `sql_text`, `transform_plugin`, `transform_plugin_params`) VALUES (843, 'evthM2bc', '-- 表头\nselect \'车间\' as title,\'wname\' as datakey,\'100px\' as width,\'text\' as dataType,\'text\' as editType,\'\' as lock,\'\' as render,0 as tag,1 as export\nunion all\nselect \'机台\' as title,\'dname\' as datakey,\'100px\' as width,\'text\' as dataType,\'text\' as editType,\'\' as lock,\'\' as render,0 as tag,1 as export\nunion all\nSELECT \'能源类型\' as title,\'name\' as datakey,\'150px\' as width ,\'text\' as dataType,\'text\' as editType,\'\' as lock,\'\' as render,0 as tag,1 as export\nunion all\nselect \'单位\' as title,\'units\' as datakey,\'120px\' as width,\'text\' as dataType,\'text\' as editType,\'\' as lock,\'\' as render,0 as tag,1 as export\nunion all\nSELECT to_char(date_value, \'YYYY-MM-DD\') as title, to_char(date_value, \'YYYY-MM-DD\') as dataKey ,\'110px\' as width,\'money\' as dataType,\'text\' as editType,\'\' as lock,\'\' as render,1 as tag,1 as export\n from generate_month_dates(#{year}::int4, #{month}::int4) \nunion all \nselect \'累计用量\' as title,\'total_energy\' as datakey,\'100px\' as width,\'text\' as dataType,\'text\' as editType,\'\' as lock,\'\' as render,0 as tag,1 as export\n\n', NULL, NULL);
INSERT INTO `api_sql` (`id`, `api_id`, `sql_text`, `transform_plugin`, `transform_plugin_params`) VALUES (844, 'evthM2bc', '-- 生成临时表\nselect * from generate_dynamic_table_jt(#{year}::int4, #{month}::int4,#{tid},\'\');', NULL, NULL);
INSERT INTO `api_sql` (`id`, `api_id`, `sql_text`, `transform_plugin`, `transform_plugin_params`) VALUES (845, 'evthM2bc', '-- 查询数据\nselect * from tmp_target_table_jt order by serial_number,dname', NULL, NULL);
INSERT INTO `api_sql` (`id`, `api_id`, `sql_text`, `transform_plugin`, `transform_plugin_params`) VALUES (846, '8SzuiAbE', 'select \'序号\' as title,\'序号\' as datakey,\'120px\' as width,\'text\' as dataType,\'text\' as editType,\'\' as lock,\'\' as render,0 as tag,1 as export\nunion all \nselect \'车间名称\' as title,\'车间名称\' as datakey,\'100px\' as width,\'text\' as dataType,\'text\' as editType,\'\' as lock,\'\' as render,0 as tag,1 as export\nunion all \nselect \'设备名称\' as title,\'设备名称\' as datakey,\'100px\' as width,\'text\' as dataType,\'text\' as editType,\'\' as lock,\'\' as render,0 as tag,1 as export\nunion all \nSELECT \'能源类型\' as title,\'能源类型\' as datakey,\'150px\' as width ,\'text\' as dataType,\'text\' as editType,\'\' as lock,\'\' as render,0 as tag,1 as export\nunion all \nselect \'单位\' as title,\'单位\' as datakey,\'120px\' as width,\'text\' as dataType,\'text\' as editType,\'\' as lock,\'\' as render,0 as tag,1 as export\nunion all \nselect \'累计用量\' as title,\'累计用量\' as datakey,\'120px\' as width,\'text\' as dataType,\'text\' as editType,\'\' as lock,\'\' as render,0 as tag,1 as export\nunion all \n(SELECT cast(t.month_value as VARCHAR)||\'\' as title,cast(t.month_value as VARCHAR) as dataKey ,\'110px\' as width,\'money\' as dataType,\'text\' as editType,\'\' as lock,\'\' as render,1 as tag,1 as export\n from \n (SELECT * FROM generate_year_months(#{year_int}::int4)) t)\n ', NULL, NULL);
INSERT INTO `api_sql` (`id`, `api_id`, `sql_text`, `transform_plugin`, `transform_plugin_params`) VALUES (847, '8SzuiAbE', 'select tmp_denergy_month(#{year_int}::int4,#{tid}::varchar)\n', NULL, NULL);
INSERT INTO `api_sql` (`id`, `api_id`, `sql_text`, `transform_plugin`, `transform_plugin_params`) VALUES (848, '8SzuiAbE', 'select * from tmp_denergy_month\n', NULL, NULL);
INSERT INTO `api_sql` (`id`, `api_id`, `sql_text`, `transform_plugin`, `transform_plugin_params`) VALUES (849, 'K29naO78', 'select \'序号\' as title,\'序号\' as datakey,\'100px\' as width,\'text\' as dataType,\n \'text\' as editType,\'\' as lock,\'\' as render,0 as tag,1 as export\nunion all \nselect \'车间名称\' as title,\'车间名称\' as datakey,\'100px\' as width,\'text\' as dataType,\'text\' as editType,\'\' as lock,\'\' as render,0 as tag,1 as export\nunion all \nSELECT \'能源类型\' as title,\'能源类型\' as datakey,\'150px\' as width ,\'text\' as dataType,\'text\' as editType,\'\' as lock,\'\' as render,0 as tag,1 as export\nunion all \nselect \'单位\' as title,\'单位\' as datakey,\'120px\' as width,\'text\' as dataType,\'text\' as editType,\'\' as lock,\'\' as render,0 as tag,1 as export\nunion all \nselect \'累计用量\' as title,\'累计用量\' as datakey,\'120px\' as width,\'text\' as dataType,\'text\' as editType,\'\' as lock,\'\' as render,0 as tag,1 as export\nunion all \n(SELECT cast(t.month_value as VARCHAR)||\'\' as title,cast(t.month_value as VARCHAR) as dataKey ,\'110px\' as width,\'money\' as dataType,\'text\' as editType,\'\' as lock,\'\' as render,1 as tag,1 as export\n from \n (SELECT * FROM generate_year_months(#{year_int}::int4)) t)\n ', NULL, NULL);
INSERT INTO `api_sql` (`id`, `api_id`, `sql_text`, `transform_plugin`, `transform_plugin_params`) VALUES (850, 'K29naO78', 'select tmp_wenergy_month(#{year_int}::int4,#{tid}::varchar)\n', NULL, NULL);
INSERT INTO `api_sql` (`id`, `api_id`, `sql_text`, `transform_plugin`, `transform_plugin_params`) VALUES (851, 'K29naO78', 'select * from tmp_wenergy_month\n', NULL, NULL);
INSERT INTO `api_sql` (`id`, `api_id`, `sql_text`, `transform_plugin`, `transform_plugin_params`) VALUES (852, 'RN17YQZz', 'select \'序号\' as title,\'序号\' as datakey,\'120px\' as width,\'text\' as dataType,\'text\' as editType,\'\' as lock,\'\' as render,0 as tag,1 as export\nunion all \nselect \'工厂名称\' as title,\'工厂名称\' as datakey,\'100px\' as width,\'text\' as dataType,\'text\' as editType,\'\' as lock,\'\' as render,0 as tag,1 as export\nunion all \nSELECT \'能源类型\' as title,\'能源类型\' as datakey,\'150px\' as width ,\'text\' as dataType,\'text\' as editType,\'\' as lock,\'\' as render,0 as tag,1 as export\nunion all \nselect \'单位\' as title,\'单位\' as datakey,\'120px\' as width,\'text\' as dataType,\'text\' as editType,\'\' as lock,\'\' as render,0 as tag,1 as export\nunion all \nselect \'累计用量\' as title,\'累计用量\' as datakey,\'120px\' as width,\'text\' as dataType,\'text\' as editType,\'\' as lock,\'\' as render,0 as tag,1 as export\nunion all \n(SELECT cast(t.month_value as VARCHAR)||\'\' as title,cast(t.month_value as VARCHAR) as dataKey ,\'110px\' as width,\'money\' as dataType,\'text\' as editType,\'\' as lock,\'\' as render,1 as tag,1 as export\n from \n (SELECT * FROM generate_year_months(#{year_int}::int4)) t)\n ', NULL, NULL);
INSERT INTO `api_sql` (`id`, `api_id`, `sql_text`, `transform_plugin`, `transform_plugin_params`) VALUES (853, 'RN17YQZz', 'select tmp_fenergy_month(#{year_int}::int4,#{tid}::varchar)\n', NULL, NULL);
INSERT INTO `api_sql` (`id`, `api_id`, `sql_text`, `transform_plugin`, `transform_plugin_params`) VALUES (854, 'RN17YQZz', 'select * from tmp_fenergy_month', NULL, NULL);
INSERT INTO `api_sql` (`id`, `api_id`, `sql_text`, `transform_plugin`, `transform_plugin_params`) VALUES (855, 'Nx4g8GTB', 'SELECT fname,wname,grpname,dname,name,val_std,val_lud,\n(val_lud::NUMERIC-val_std::NUMERIC) val_ret, \nto_char(ltime, \'yyyy-mm-dd hh24:mi:ss\') ltime,\nto_char(mtime, \'yyyy-mm-dd hh24:mi:ss\') mtime\nfrom trep_energy where tid::varchar=#{tid} \nand ltime::varchar>=#{start_time}\nand mtime::varchar between #{start_time} and #{end_time}\nand (name =#{type_name} or \'\' = #{type_name}) \nand (dname like concat(\'%\',#{dname},\'%\') or \'\' = #{dname}) \nand (fname like concat(\'%\',#{fname},\'%\') or \'\' = #{fname})\nand (wname like concat(\'%\',#{wname},\'%\') or \'\' = #{wname})\nand (grpname like concat(\'%\',#{grpname},\'%\') or \'\' = #{grpname})\norder by ltime desc', NULL, NULL);
INSERT INTO `api_sql` (`id`, `api_id`, `sql_text`, `transform_plugin`, `transform_plugin_params`) VALUES (856, 'V6VnrUXa', 'select \'序号\' as title,\'序号\' as datakey,\'100px\' as width,\'text\' as dataType,\n \'text\' as editType,\'\' as lock,\'\' as render,0 as tag,1 as export\nunion all \nselect \'工厂名称\' as title,\'工厂名称\' as datakey,\'100px\' as width,\'text\' as dataType,\n \'text\' as editType,\'\' as lock,\'\' as render,0 as tag,1 as export\nunion all \nselect \'车间名称\' as title,\'车间名称\' as datakey,\'100px\' as width,\'text\' as dataType,\n \'text\' as editType,\'\' as lock,\'\' as render,0 as tag,1 as export\nunion all \nSELECT \'设备名称\' as title,\'设备名称\' as datakey,\'150px\' as width ,\'text\' as dataType,\n \'text\' as editType,\'\' as lock,\'\' as render,0 as tag,1 as export\nunion all \nselect \'能源类型\' as title,\'能源类型\' as datakey,\'120px\' as width,\'text\' as dataType,\n \'text\' as editType,\'\' as lock,\'\' as render,0 as tag,1 as export\nunion all \nselect \'单位\' as title,\'单位\' as datakey,\'120px\' as width,\'text\' as dataType,\n \'text\' as editType,\'\' as lock,\'\' as render,0 as tag,1 as export\nunion all\nSELECT t::VARCHAR as title,t::VARCHAR as dataKey ,\'110px\' as width,\'money\' as dataType,\n \'text\' as editType,\'\' as lock,\'\' as render,1 as tag,1 as export\n from generate_series(#{date}, #{dep}, 1) as t\nunion all\nselect \'累计用量\' as title,\'累计用量\' as datakey,\'120px\' as width,\'money\' as dataType,\n \'text\' as editType,\'\' as lock,\'\' as render,0 as tag,1 as export', NULL, NULL);
INSERT INTO `api_sql` (`id`, `api_id`, `sql_text`, `transform_plugin`, `transform_plugin_params`) VALUES (857, 'V6VnrUXa', 'SELECT tmp_device_energy(#{date}::int4, #{dep}::int4, #{tid}::varchar);', NULL, NULL);
INSERT INTO `api_sql` (`id`, `api_id`, `sql_text`, `transform_plugin`, `transform_plugin_params`) VALUES (858, 'V6VnrUXa', 'SELECT * from tmp_device_energy_table;', NULL, NULL);
INSERT INTO `api_sql` (`id`, `api_id`, `sql_text`, `transform_plugin`, `transform_plugin_params`) VALUES (859, 'kJ2vKiZb', 'select \'序号\' as title,\'序号\' as datakey,\'100px\' as width,\'text\' as dataType,\n \'text\' as editType,\'\' as lock,\'\' as render,0 as tag,1 as export\nunion all \nselect \'工厂名称\' as title,\'工厂名称\' as datakey,\'100px\' as width,\'text\' as dataType,\n \'text\' as editType,\'\' as lock,\'\' as render,0 as tag,1 as export\nunion all \nselect \'车间名称\' as title,\'车间名称\' as datakey,\'100px\' as width,\'text\' as dataType,\n \'text\' as editType,\'\' as lock,\'\' as render,0 as tag,1 as export\nunion all \nselect \'能源类型\' as title,\'能源类型\' as datakey,\'120px\' as width,\'text\' as dataType,\n \'text\' as editType,\'\' as lock,\'\' as render,0 as tag,1 as export\nunion all \nselect \'单位\' as title,\'单位\' as datakey,\'120px\' as width,\'text\' as dataType,\n \'text\' as editType,\'\' as lock,\'\' as render,0 as tag,1 as export\nunion all\nSELECT t::VARCHAR as title,t::VARCHAR as dataKey ,\'110px\' as width,\'money\' as dataType,\n \'text\' as editType,\'\' as lock,\'\' as render,1 as tag,1 as export\n from generate_series(#{date}, #{dep}, 1) as t\nunion all\nselect \'累计用量\' as title,\'累计用量\' as datakey,\'120px\' as width,\'money\' as dataType,\n \'text\' as editType,\'\' as lock,\'\' as render,0 as tag,1 as export', NULL, NULL);
INSERT INTO `api_sql` (`id`, `api_id`, `sql_text`, `transform_plugin`, `transform_plugin_params`) VALUES (860, 'kJ2vKiZb', 'SELECT tmp_wname_energy(#{date}::int4, #{dep}::int4, #{tid}::varchar);', NULL, NULL);
INSERT INTO `api_sql` (`id`, `api_id`, `sql_text`, `transform_plugin`, `transform_plugin_params`) VALUES (861, 'kJ2vKiZb', 'SELECT * from tmp_wname_energy_table;', NULL, NULL);
INSERT INTO `api_sql` (`id`, `api_id`, `sql_text`, `transform_plugin`, `transform_plugin_params`) VALUES (862, 'HMDaRCo8', '\nselect \'序号\' as title,\'序号\' as datakey,\'100px\' as width,\'text\' as dataType,\n \'text\' as editType,\'\' as lock,\'\' as render,0 as tag,1 as export\nunion all \nselect \'工厂名称\' as title,\'工厂名称\' as datakey,\'100px\' as width,\'text\' as dataType,\n \'text\' as editType,\'\' as lock,\'\' as render,0 as tag,1 as export\nunion all\nselect \'能源类型\' as title,\'能源类型\' as datakey,\'120px\' as width,\'text\' as dataType,\n \'text\' as editType,\'\' as lock,\'\' as render,0 as tag,1 as export\nunion all \nselect \'单位\' as title,\'单位\' as datakey,\'120px\' as width,\'text\' as dataType,\n \'text\' as editType,\'\' as lock,\'\' as render,0 as tag,1 as export\nunion all\nSELECT t::VARCHAR as title,t::VARCHAR as dataKey ,\'110px\' as width,\'money\' as dataType,\n \'text\' as editType,\'\' as lock,\'\' as render,1 as tag,1 as export\n from generate_series(#{date}, #{dep}, 1) as t\nunion all\nselect \'累计用量\' as title,\'累计用量\' as datakey,\'120px\' as width,\'money\' as dataType,\n \'text\' as editType,\'\' as lock,\'\' as render,0 as tag,1 as export', NULL, NULL);
INSERT INTO `api_sql` (`id`, `api_id`, `sql_text`, `transform_plugin`, `transform_plugin_params`) VALUES (863, 'HMDaRCo8', 'SELECT tmp_fname_energy(#{date}::int4, #{dep}::int4, #{tid}::varchar);', NULL, NULL);
INSERT INTO `api_sql` (`id`, `api_id`, `sql_text`, `transform_plugin`, `transform_plugin_params`) VALUES (864, 'HMDaRCo8', 'SELECT * from tmp_fname_energy_table;', NULL, NULL);
INSERT INTO `api_sql` (`id`, `api_id`, `sql_text`, `transform_plugin`, `transform_plugin_params`) VALUES (865, 'SK6hQIOj', 'SELECT fname,wname,grpname,gname,key,dname,val,update_time from vcode_key_detail \nwhere tid::varchar=#{tid} \nand (dname like concat(\'%\',#{dname},\'%\') or \'\' = #{dname}) \nand (fname like concat(\'%\',#{fname},\'%\') or \'\' = #{fname})\nand (wname like concat(\'%\',#{wname},\'%\') or \'\' = #{wname})\nand (grpname like concat(\'%\',#{grpname},\'%\') or \'\' = #{grpname})\norder by update_time desc\n', NULL, NULL);
INSERT INTO `api_sql` (`id`, `api_id`, `sql_text`, `transform_plugin`, `transform_plugin_params`) VALUES (866, '5yT39rTw', 'SELECT 所属机台, 能源类型, 单位, 所属车间, 开始值, 结束值, \n结束值::NUMERIC - 开始值::NUMERIC 用量\nfrom (\nSELECT dname 所属机台, name 能源类型, units 单位, wname 所属车间, min(val_std) 开始值, \nmax(val_lud) 结束值 FROM trep_energy \nWHERE tid::varchar = #{tid}::varchar and ltime::date >= #{start_time}::date \nand mtime::date between #{start_time}::date and #{end_time}::date \n and (dname like concat(\'%\',#{dname},\'%\') or \'\' = #{dname}) and \n (name like concat(\'%\',#{type_name},\'%\') or \'\' = #{type_name}) \n and (wname like concat(\'%\',#{wname},\'%\') or \'\' = #{wname})\n group by name,dname,wname,units\n) t1', NULL, NULL);
COMMIT;
-- ----------------------------
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment