Commit 1c8ffdf0 authored by 吴文龙's avatar 吴文龙

update

parent bd02ea1e
/*
Navicat Premium Data Transfer
Source Server : 47.96.236.169
Source Server Type : MySQL
Source Server Version : 80028
Source Host : 47.96.236.169:33306
Source Schema : iot_dbapi
Target Server Type : MySQL
Target Server Version : 80028
File Encoding : 65001
Date: 28/11/2022 19:47:18
*/
SET NAMES utf8mb4;
SET FOREIGN_KEY_CHECKS = 0;
-- ----------------------------
-- Table structure for api_auth
-- ----------------------------
DROP TABLE IF EXISTS `api_auth`;
CREATE TABLE `api_auth` (
`id` int NOT NULL AUTO_INCREMENT,
`token_id` int DEFAULT NULL,
`group_id` varchar(255) DEFAULT NULL,
PRIMARY KEY (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=9 DEFAULT CHARSET=utf8mb3;
-- ----------------------------
-- Records of api_auth
-- ----------------------------
BEGIN;
INSERT INTO `api_auth` (`id`, `token_id`, `group_id`) VALUES (7, 1, 'XlscLq30');
INSERT INTO `api_auth` (`id`, `token_id`, `group_id`) VALUES (8, 2, 'XlscLq30');
COMMIT;
-- ----------------------------
-- Table structure for api_config
-- ----------------------------
DROP TABLE IF EXISTS `api_config`;
CREATE TABLE `api_config` (
`id` varchar(255) NOT NULL,
`path` varchar(255) DEFAULT NULL,
`name` varchar(255) DEFAULT NULL,
`note` varchar(255) DEFAULT NULL,
`params` text,
`status` int DEFAULT NULL,
`datasource_id` varchar(255) DEFAULT NULL,
`previlege` int DEFAULT NULL,
`group_id` varchar(255) DEFAULT NULL,
`cache_plugin` varchar(255) DEFAULT NULL,
`cache_plugin_params` varchar(255) DEFAULT NULL,
`create_time` varchar(20) DEFAULT NULL,
`update_time` varchar(20) DEFAULT NULL,
PRIMARY KEY (`id`),
UNIQUE KEY `path` (`path`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3;
-- ----------------------------
-- Records of api_config
-- ----------------------------
BEGIN;
INSERT INTO `api_config` (`id`, `path`, `name`, `note`, `params`, `status`, `datasource_id`, `previlege`, `group_id`, `cache_plugin`, `cache_plugin_params`, `create_time`, `update_time`) VALUES ('0qLjHowN', 'v1_switch_detail', '南泰君霖对外接口-班组开停机状态查询', NULL, '[{\"name\":\"date\",\"type\":\"string\",\"note\":\"营业日期\"},{\"name\":\"deviceName\",\"type\":\"string\",\"note\":\"设备名称\"},{\"name\":\"grpcode\",\"type\":\"string\",\"note\":\"班组am或pm\"},{\"name\":\"grptype\",\"type\":\"string\",\"note\":\"分区\"}]', 1, 'kSC2Qziy', 0, 'XlscLq30', NULL, NULL, '2022-11-15 13:55:43', '2022-11-15 14:05:44');
INSERT INTO `api_config` (`id`, `path`, `name`, `note`, `params`, `status`, `datasource_id`, `previlege`, `group_id`, `cache_plugin`, `cache_plugin_params`, `create_time`, `update_time`) VALUES ('3qxDmpBG', 'dbapi/f_set_trep_group_detail', '生产-保存班组能耗数据', NULL, '[]', 1, 'kSC2Qziy', 1, 'OPKu3Okm', NULL, NULL, '2022-09-29 14:32:10', '2022-11-15 21:31:37');
INSERT INTO `api_config` (`id`, `path`, `name`, `note`, `params`, `status`, `datasource_id`, `previlege`, `group_id`, `cache_plugin`, `cache_plugin_params`, `create_time`, `update_time`) VALUES ('5SeUCRJy', 'dbapi/f_rep_device_groups_detail', 'f_rep_device_groups_detail', NULL, '[{\"name\":\"did\",\"type\":\"string\"}]', 1, 'kSC2Qziy', 1, 'XlscLq30', NULL, NULL, '2022-10-10 12:27:08', '2022-11-04 00:33:28');
INSERT INTO `api_config` (`id`, `path`, `name`, `note`, `params`, `status`, `datasource_id`, `previlege`, `group_id`, `cache_plugin`, `cache_plugin_params`, `create_time`, `update_time`) VALUES ('7TVjkWPy', 'f_set_days_key_detail', '生产-保存每日能耗数据-停用', NULL, '[]', 0, 'kSC2Qziy', 1, 'OGvyLgXx', NULL, NULL, '2022-11-02 16:48:26', '2022-11-16 01:45:39');
INSERT INTO `api_config` (`id`, `path`, `name`, `note`, `params`, `status`, `datasource_id`, `previlege`, `group_id`, `cache_plugin`, `cache_plugin_params`, `create_time`, `update_time`) VALUES ('9xFhax2y', 'junlin_hous_key', 'junlin_hous_key', NULL, '[]', 1, 'kSC2Qziy', 1, 'OPKu3Okm', NULL, NULL, '2022-09-24 08:05:07', '2022-09-24 19:00:16');
INSERT INTO `api_config` (`id`, `path`, `name`, `note`, `params`, `status`, `datasource_id`, `previlege`, `group_id`, `cache_plugin`, `cache_plugin_params`, `create_time`, `update_time`) VALUES ('B1ANmtET', 'f_set_sta_detail', '生产-当前状态持续时长统计', NULL, '[]', 1, 'kSC2Qziy', 1, 'OGvyLgXx', NULL, NULL, '2022-10-16 00:45:27', '2022-11-16 16:19:48');
INSERT INTO `api_config` (`id`, `path`, `name`, `note`, `params`, `status`, `datasource_id`, `previlege`, `group_id`, `cache_plugin`, `cache_plugin_params`, `create_time`, `update_time`) VALUES ('bw6ULlLe', 'f_func_rep_test', 'f_func_rep_test', NULL, '[]', 1, 'EhgozRdv', 1, 'OGvyLgXx', NULL, NULL, '2022-09-24 23:20:40', '2022-09-24 23:47:39');
INSERT INTO `api_config` (`id`, `path`, `name`, `note`, `params`, `status`, `datasource_id`, `previlege`, `group_id`, `cache_plugin`, `cache_plugin_params`, `create_time`, `update_time`) VALUES ('cD4sCi7I', 'v1_group_detail', '南泰君霖对外接口-班组能耗查询', NULL, '[{\"name\":\"deviceName\",\"type\":\"string\",\"note\":\"设备名称\"},{\"name\":\"propName\",\"type\":\"string\",\"note\":\"属性名称\"},{\"name\":\"grpcode\",\"type\":\"string\",\"note\":\"班组am或pm\"},{\"name\":\"grptype\",\"type\":\"string\",\"note\":\"分组A区或B区等\"},{\"name\":\"arr\",\"type\":\"string\",\"note\":\"开始日期\"},{\"name\":\"dep\",\"type\":\"string\",\"note\":\"结束日期\"}]', 1, 'kSC2Qziy', 0, 'XlscLq30', NULL, NULL, '2022-11-15 13:25:47', '2022-11-17 10:26:06');
INSERT INTO `api_config` (`id`, `path`, `name`, `note`, `params`, `status`, `datasource_id`, `previlege`, `group_id`, `cache_plugin`, `cache_plugin_params`, `create_time`, `update_time`) VALUES ('CQ9VkAr9', 'dbapi/f_rep_hour_key_detail', 'f_rep_hour_key_detail', NULL, '[{\"name\":\"tid\",\"type\":\"string\",\"note\":\"租户ID\"},{\"name\":\"grpid\",\"type\":\"string\",\"note\":\"分组ID\"}]', 1, 'kSC2Qziy', 1, 'XlscLq30', NULL, NULL, '2022-09-24 09:49:48', '2022-11-04 00:37:17');
INSERT INTO `api_config` (`id`, `path`, `name`, `note`, `params`, `status`, `datasource_id`, `previlege`, `group_id`, `cache_plugin`, `cache_plugin_params`, `create_time`, `update_time`) VALUES ('EeBkndxU', 'f_set_hours_switch_detail', '生产-每小时保存开停机变化数据', NULL, '[]', 1, 'kSC2Qziy', 1, 'OGvyLgXx', NULL, NULL, '2022-11-12 13:35:21', '2022-11-14 13:52:41');
INSERT INTO `api_config` (`id`, `path`, `name`, `note`, `params`, `status`, `datasource_id`, `previlege`, `group_id`, `cache_plugin`, `cache_plugin_params`, `create_time`, `update_time`) VALUES ('EnFpExkx', 'dbapi/f_rep_days_hours_device', 'f_rep_days_hours_device', NULL, '[{\"name\":\"did\",\"type\":\"string\"}]', 1, 'kSC2Qziy', 1, 'XlscLq30', NULL, NULL, '2022-09-27 23:30:00', '2022-09-29 13:47:12');
INSERT INTO `api_config` (`id`, `path`, `name`, `note`, `params`, `status`, `datasource_id`, `previlege`, `group_id`, `cache_plugin`, `cache_plugin_params`, `create_time`, `update_time`) VALUES ('FNMVwfcu', 'f_set_group_switch_detail', '生产-班组保存开停机状态', NULL, '[]', 1, 'kSC2Qziy', 1, 'OGvyLgXx', NULL, NULL, '2022-11-12 13:36:00', '2022-11-14 13:52:57');
INSERT INTO `api_config` (`id`, `path`, `name`, `note`, `params`, `status`, `datasource_id`, `previlege`, `group_id`, `cache_plugin`, `cache_plugin_params`, `create_time`, `update_time`) VALUES ('hGLKRYiu', 'f_trep_day_detail', 'f_trep_day_detail', NULL, '[{\"name\":\"month\",\"type\":\"string\",\"note\":\"日期示例10代表10月\"},{\"name\":\"deviceName\",\"type\":\"string\",\"note\":\"设备名称\"},{\"name\":\"propName\",\"type\":\"string\",\"note\":\"属性名称\"},{\"name\":\"year\",\"type\":\"string\",\"note\":\"年份\"},{\"name\":\"grptype\",\"type\":\"string\",\"note\":\"分组A区或B区等\"}]', 1, 'kSC2Qziy', 1, 'XlscLq30', NULL, NULL, '2022-10-09 23:36:54', '2022-11-15 15:55:42');
INSERT INTO `api_config` (`id`, `path`, `name`, `note`, `params`, `status`, `datasource_id`, `previlege`, `group_id`, `cache_plugin`, `cache_plugin_params`, `create_time`, `update_time`) VALUES ('HYORZYyI', 'dbapi/f_rep_yesterday_key_sum', 'f_rep_yesterday_key_sum', NULL, '[{\"name\":\"tid\",\"type\":\"string\"},{\"name\":\"grpid\",\"type\":\"string\"}]', 1, 'kSC2Qziy', 1, 'XlscLq30', NULL, NULL, '2022-11-03 17:43:35', '2022-11-03 18:25:46');
INSERT INTO `api_config` (`id`, `path`, `name`, `note`, `params`, `status`, `datasource_id`, `previlege`, `group_id`, `cache_plugin`, `cache_plugin_params`, `create_time`, `update_time`) VALUES ('IHQJLVtr', 'dbapi/f_rep_group_key_sum', 'f_rep_group_key_sum', NULL, '[{\"name\":\"tid\",\"type\":\"string\"},{\"name\":\"grpid\",\"type\":\"string\"}]', 1, 'kSC2Qziy', 1, 'XlscLq30', NULL, NULL, '2022-11-03 17:42:58', '2022-11-04 00:12:09');
INSERT INTO `api_config` (`id`, `path`, `name`, `note`, `params`, `status`, `datasource_id`, `previlege`, `group_id`, `cache_plugin`, `cache_plugin_params`, `create_time`, `update_time`) VALUES ('K4QZT40A', 'f_junlin_rep_out_key', 'f_junlin_rep_out_key', NULL, '[{\"name\":\"bdate\",\"type\":\"string\",\"note\":\"日期\"}]', 1, 'kSC2Qziy', 0, 'XlscLq30', NULL, NULL, '2022-09-28 14:49:53', '2022-09-28 14:49:53');
INSERT INTO `api_config` (`id`, `path`, `name`, `note`, `params`, `status`, `datasource_id`, `previlege`, `group_id`, `cache_plugin`, `cache_plugin_params`, `create_time`, `update_time`) VALUES ('kU15HMrE', 'dbapi/f_rep_device_days_detail', 'f_rep_device_days_detail', NULL, '[{\"name\":\"did\",\"type\":\"string\",\"note\":\"设备ID\"}]', 1, 'kSC2Qziy', 1, 'XlscLq30', NULL, NULL, '2022-10-10 11:38:43', '2022-10-11 12:06:28');
INSERT INTO `api_config` (`id`, `path`, `name`, `note`, `params`, `status`, `datasource_id`, `previlege`, `group_id`, `cache_plugin`, `cache_plugin_params`, `create_time`, `update_time`) VALUES ('N8sgjOWD', 'dbapi/f_rep_hour_key_sum', 'f_rep_hour_key_sum', NULL, '[{\"name\":\"tid\",\"type\":\"string\"},{\"name\":\"grpid\",\"type\":\"string\"}]', 1, 'kSC2Qziy', 1, 'XlscLq30', NULL, NULL, '2022-09-25 22:26:44', '2022-11-03 15:23:25');
INSERT INTO `api_config` (`id`, `path`, `name`, `note`, `params`, `status`, `datasource_id`, `previlege`, `group_id`, `cache_plugin`, `cache_plugin_params`, `create_time`, `update_time`) VALUES ('pjYii91f', 'f_junlin_temp_cache', '生产-君霖定制处理缓存数据', NULL, '[]', 1, 'kSC2Qziy', 1, 'XlscLq30', NULL, NULL, '2022-11-16 02:05:49', '2022-11-16 02:05:49');
INSERT INTO `api_config` (`id`, `path`, `name`, `note`, `params`, `status`, `datasource_id`, `previlege`, `group_id`, `cache_plugin`, `cache_plugin_params`, `create_time`, `update_time`) VALUES ('RSuNGzhs', 'f_set_day_switch_detail', '生产-每日保存开停机数据', NULL, '[]', 1, 'kSC2Qziy', 1, 'OGvyLgXx', NULL, NULL, '2022-11-12 13:36:36', '2022-11-14 13:53:12');
INSERT INTO `api_config` (`id`, `path`, `name`, `note`, `params`, `status`, `datasource_id`, `previlege`, `group_id`, `cache_plugin`, `cache_plugin_params`, `create_time`, `update_time`) VALUES ('tCoVivD8', 'dbapi/f_set_hour_key_detail', '生产-每小时保存能耗数据', NULL, '[]', 1, 'kSC2Qziy', 1, 'OGvyLgXx', NULL, NULL, '2022-09-26 13:38:15', '2022-11-15 22:41:30');
INSERT INTO `api_config` (`id`, `path`, `name`, `note`, `params`, `status`, `datasource_id`, `previlege`, `group_id`, `cache_plugin`, `cache_plugin_params`, `create_time`, `update_time`) VALUES ('UDzGSkeZ', 'set_tcode_base', 'set_tcode_base', NULL, '[]', 1, 'kSC2Qziy', 1, 'OPKu3Okm', NULL, NULL, '2022-09-24 09:24:20', '2022-09-24 09:24:20');
INSERT INTO `api_config` (`id`, `path`, `name`, `note`, `params`, `status`, `datasource_id`, `previlege`, `group_id`, `cache_plugin`, `cache_plugin_params`, `create_time`, `update_time`) VALUES ('v7p2AAqp', 'v1_device_detail', '南泰君霖对外接口-设备实时采集数据查询', NULL, '[{\"name\":\"deviceName\",\"type\":\"string\",\"note\":\"设备名称\"},{\"name\":\"key\",\"type\":\"string\",\"note\":\"属性名称\"},{\"name\":\"grptype\",\"type\":\"string\",\"note\":\"分区\"}]', 1, 'kSC2Qziy', 0, 'XlscLq30', NULL, NULL, '2022-11-15 14:25:59', '2022-11-15 14:27:35');
INSERT INTO `api_config` (`id`, `path`, `name`, `note`, `params`, `status`, `datasource_id`, `previlege`, `group_id`, `cache_plugin`, `cache_plugin_params`, `create_time`, `update_time`) VALUES ('VyCtYO0f', 'dbapi/f_rep_device_lastDays_detail', 'f_rep_device_lastDays_detail', NULL, '[{\"name\":\"did\",\"type\":\"string\"}]', 1, 'kSC2Qziy', 1, 'XlscLq30', NULL, NULL, '2022-11-03 18:39:46', '2022-11-03 18:44:56');
INSERT INTO `api_config` (`id`, `path`, `name`, `note`, `params`, `status`, `datasource_id`, `previlege`, `group_id`, `cache_plugin`, `cache_plugin_params`, `create_time`, `update_time`) VALUES ('wFz52Yb1', 'dbapi/f_rep_device_months_detail', 'f_rep_device_months_detail', NULL, '[{\"name\":\"did\",\"type\":\"string\",\"note\":\"设备ID\"}]', 1, 'kSC2Qziy', 1, 'XlscLq30', NULL, NULL, '2022-10-10 12:30:16', '2022-10-11 12:13:20');
INSERT INTO `api_config` (`id`, `path`, `name`, `note`, `params`, `status`, `datasource_id`, `previlege`, `group_id`, `cache_plugin`, `cache_plugin_params`, `create_time`, `update_time`) VALUES ('xfXpHIg0', 'f_trep_group_detail', 'f_trep_group_detail', NULL, '[{\"name\":\"date\",\"type\":\"string\",\"note\":\"日期\"},{\"name\":\"deviceName\",\"type\":\"string\",\"note\":\"设备名称\"},{\"name\":\"propName\",\"type\":\"string\",\"note\":\"属性名称\"},{\"name\":\"grpcode\",\"type\":\"string\",\"note\":\"班组am或pm\"},{\"name\":\"grptype\",\"type\":\"string\",\"note\":\"分组A区B区等\"}]', 1, 'kSC2Qziy', 1, 'XlscLq30', NULL, NULL, '2022-09-29 15:11:36', '2022-11-17 10:25:20');
COMMIT;
-- ----------------------------
-- Table structure for api_group
-- ----------------------------
DROP TABLE IF EXISTS `api_group`;
CREATE TABLE `api_group` (
`id` varchar(255) NOT NULL,
`name` varchar(255) DEFAULT NULL,
PRIMARY KEY (`id`),
UNIQUE KEY `name` (`name`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3;
-- ----------------------------
-- Records of api_group
-- ----------------------------
BEGIN;
INSERT INTO `api_group` (`id`, `name`) VALUES ('OGvyLgXx', '公共分组');
INSERT INTO `api_group` (`id`, `name`) VALUES ('OPKu3Okm', '南泰君霖');
INSERT INTO `api_group` (`id`, `name`) VALUES ('XlscLq30', '南泰君霖-输出');
COMMIT;
-- ----------------------------
-- Table structure for api_sql
-- ----------------------------
DROP TABLE IF EXISTS `api_sql`;
CREATE TABLE `api_sql` (
`id` int NOT NULL AUTO_INCREMENT,
`api_id` varchar(11) NOT NULL,
`sql_text` text NOT NULL,
`transform_plugin` varchar(255) DEFAULT NULL,
`transform_plugin_params` varchar(255) DEFAULT NULL,
PRIMARY KEY (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=267 DEFAULT CHARSET=utf8mb3;
-- ----------------------------
-- Records of api_sql
-- ----------------------------
BEGIN;
INSERT INTO `api_sql` (`id`, `api_id`, `sql_text`, `transform_plugin`, `transform_plugin_params`) VALUES (4, 'UDzGSkeZ', 'insert into tcode_device(tid,fid,fname,wid,wname,grpid,grpname,gid,gname,did,dname,knumb,kcnt,sort,halt,htime,ctime,mtime)\nSELECT \nt.tid,t.fid,t.fname,t.wid,t.wname,t.grpid,t.grpname,t.gid,t.gname,\nt.did,t.dname,count(1) as key_cnt ,\nsum(t.volume_on_day) as keyval_cnt,\n\'1000\' as sort,\n\'F\' as halt,CURRENT_TIMESTAMP,CURRENT_TIMESTAMP,CURRENT_TIMESTAMP\nfrom vcode_key_detail t \nGROUP BY t.tid,t.fid,t.fname,t.wid,t.wname,t.grpid,t.grpname,t.gid,t.gname,t.did,t.dname\nORDER BY t.dname desc \nON conflict(tid,did)\ndo update set \nfid = EXCLUDED.fid,\nfname = EXCLUDED.fname,\nwid = EXCLUDED.wid,\nwname = EXCLUDED.wname,\ngrpid = EXCLUDED.grpid,\ngrpname = EXCLUDED.grpname,\ngid = EXCLUDED.gid,\ngname = EXCLUDED.gname,\ndname = EXCLUDED.dname,\nknumb = EXCLUDED.knumb,\nkcnt = EXCLUDED.kcnt,\nmtime = CURRENT_TIMESTAMP;', NULL, NULL);
INSERT INTO `api_sql` (`id`, `api_id`, `sql_text`, `transform_plugin`, `transform_plugin_params`) VALUES (48, '9xFhax2y', 'INSERT into trep_hkey_detail(tid,did,key,bdate,hours,val,ctime,mtime)\nSELECT t.tid,t.did, \n case when t.key = \'gas\' then \'蒸汽\' \n when t.key = \'正向累积数值整数部分\' then \'碱用量\'\n else t.key \n end as key ,\n current_date as bdate,\ndate_part(\'hour\', CURRENT_TIME) as hours,t.val_ex ,\nCURRENT_TIMESTAMP ,CURRENT_TIMESTAMP\nfrom \n(\n SELECT \n to_number(a.val,\'999999999.999999999\') + to_number(b.val,\'999999999.999999999\') as val_ex,\n a.* from \n (\n SELECT t.* from vcode_key_detail t \n where t.key = \'正向累积数值整数部分\'\n \n ) a,\n (\n SELECT t.* from vcode_key_detail t \n WHERE t.key = \'正向累积数值小数部分\'\n ) b\n where a.tid = b.tid and \n a.did = b.did and \n a.tid = \'22eed190-39af-11ed-8d4e-1d9073a615c6\'\n union all \n SELECT to_number(t.val,\'999999999.999999999\') as val_ex,t.* from vcode_key_detail t \n where t.tid = \'22eed190-39af-11ed-8d4e-1d9073a615c6\' and \n t.key = \'gas\'\n) t\nON CONFLICT (tid,did,key,bdate,hours)\nDO UPDATE SET \nval = EXCLUDED.val,\nmtime = CURRENT_TIMESTAMP;\n \n\n\n ', NULL, NULL);
INSERT INTO `api_sql` (`id`, `api_id`, `sql_text`, `transform_plugin`, `transform_plugin_params`) VALUES (50, 'bw6ULlLe', 'begin;\nSELECT func05(\'cur_open\');\nfetch all in cur_open;\nend; ', NULL, NULL);
INSERT INTO `api_sql` (`id`, `api_id`, `sql_text`, `transform_plugin`, `transform_plugin_params`) VALUES (72, 'K4QZT40A', 'SELECT t.* from trep_dkey_detail t \nwhere t.bdate = #{bdate} and \n t.tid = \'22eed190-39af-11ed-8d4e-1d9073a615c6\'', NULL, NULL);
INSERT INTO `api_sql` (`id`, `api_id`, `sql_text`, `transform_plugin`, `transform_plugin_params`) VALUES (77, 'EnFpExkx', 'SELECT t.key,\njsonb_agg(b) as arr\nfrom tcode_model_detail_ex t\n left JOIN \n (select concat(bdate,\' \',hours,\':00:00\')::TIMESTAMP::VARCHAR as time ,tid,key as nkey,val as value \n from trep_hkey_detail \n where ctime >= (CURRENT_TIMESTAMP - interval \'24 hour\')) b \non t.tid = b.tid and \n t.key = b.nkey \nwhere t.tid = \'22eed190-39af-11ed-8d4e-1d9073a615c6\' and \n t.code = \'all\' and \n substr(t.ex_s1,1,1) = \'1\'\nGROUP BY t.key;\n', NULL, NULL);
INSERT INTO `api_sql` (`id`, `api_id`, `sql_text`, `transform_plugin`, `transform_plugin_params`) VALUES (151, 'kU15HMrE', 'SELECT case when t.key = \'蒸汽\' then \'vapor\'\n when t.key = \'碱用量\' then \'alkali\' \n else t.key end as key,t.sort,jsonb_agg(b ORDER BY b.bdate,to_number(b.hours, \'99\')) as arr\n from tcode_model_detail_ex t\n left JOIN \n (select concat(bdate,\' \',hours,\':00:00\')::TIMESTAMP::VARCHAR as time,tid,\n case when key = \'蒸汽\' then \'vapor\'\n when key = \'碱用量\' then \'alkali\' \n else key end as nkey,val as value ,bdate,hours\n from trep_hkey_detail \n where bdate = CURRENT_DATE and \n did::varchar = #{did}\n ) b \n on t.tid = b.tid and \n t.key = b.nkey \n where t.tid = \'22eed190-39af-11ed-8d4e-1d9073a615c6\' and \n t.code = \'all\' and \n t.key in (\'vapor\',\'alkali\',\'electric\',\'gas\',\'water\')\n GROUP BY t.key,t.sort\n ORDER BY t.sort', NULL, NULL);
INSERT INTO `api_sql` (`id`, `api_id`, `sql_text`, `transform_plugin`, `transform_plugin_params`) VALUES (153, 'wFz52Yb1', 'SELECT case when t.key = \'蒸汽\' then \'vapor\'\n when t.key = \'碱用量\' then \'alkali\' \n else t.key end as key,t.sort,jsonb_agg(b ORDER BY b.bdate,to_number(b.hours, \'99\')) as arr\n from tcode_model_detail_ex t\n left JOIN \n (select concat(bdate,\' \',hours,\':00:00\')::TIMESTAMP::VARCHAR as time,tid,\n case when key = \'蒸汽\' then \'vapor\'\n when key = \'碱用量\' then \'alkali\' \n else key end as nkey,val as value ,bdate,hours\n from trep_hkey_detail \n where bdate = CURRENT_DATE and \n did::varchar = #{did}\n ) b \n on t.tid = b.tid and \n t.key = b.nkey \n where t.tid = \'22eed190-39af-11ed-8d4e-1d9073a615c6\' and \n t.code = \'all\' and \n t.key in (\'vapor\',\'alkali\',\'electric\',\'gas\',\'water\')\n GROUP BY t.key,t.sort\n ORDER BY t.sort', NULL, NULL);
INSERT INTO `api_sql` (`id`, `api_id`, `sql_text`, `transform_plugin`, `transform_plugin_params`) VALUES (193, 'N8sgjOWD', 'SELECT b.* from (\n SELECT case when a.key = \'alkali\' then \'碱用量\'\n when a.key = \'vapor\' then \'蒸汽\'\n else a.key \n end as name ,\n a.val as value,\n case when a.key = \'alkali\' then \'1020\'\n when a.key = \'vapor\' then \'1010\'\n else a.key \n end as sort \n from (\n SELECT t.key,\n sum(to_number(val_dep, \'9999999999999999999.99\'))-sum(to_number(val_arr, \'9999999999999999999.99\')) as val\n from trep_hkey_detail t,vcode_key_detail b \n where t.tid = b.tid and \n t.did = b.did and \n t.key = b.key and \n (t.tid::VARCHAR = #{tid}) AND\n (\'\'=#{grpid} or b.grpid::VARCHAR= #{grpid}) and \n t.key in (\'vapor\',\'alkali\') and \n t.bdate = CURRENT_DATE \n group by t.key \n ) a \n) b \norder by b.sort\n', NULL, NULL);
INSERT INTO `api_sql` (`id`, `api_id`, `sql_text`, `transform_plugin`, `transform_plugin_params`) VALUES (194, 'N8sgjOWD', 'SELECT \'蒸汽\' as name,sum(value) as value from (\n SELECT \n concat(a.bdate,\' \',a.hours,\':00:00\')::timestamp as time,\n (a.cval - b.cval) as value,\n a.key,a.hours,a.did\nfrom \n(SELECT to_number(t.val,\'999999999.99\') as cval,t.*,\n b.dname,b.id\n from trep_hkey_detail t,tcode_device b \n where t.tid = b.id and \n t.tid::character varying= #{tid} and \n (\'\' = \'\' or b.gid::character varying = \'\') and \n t.did = b.did and \n t.bdate = CURRENT_DATE - 1\n) a,\n(SELECT to_number(t.val,\'999999999.99\') as cval,t.*,\n b.dname,b.id\n from trep_hkey_detail t,tcode_device b \n where t.tid = b.id and \n t.tid::character varying= #{tid} and \n (\'\' = \'\' or b.gid::character varying = \'\') and \n t.did = b.did and \n t.bdate = CURRENT_DATE - 1\n) b \nwhere a.tid = b.id and \n a.did = b.did and \n a.key = b.key and \n a.key = \'蒸汽\' and \n a.bdate = b.bdate and \n to_number(a.hours,\'999999999\') - 1 = to_number(b.hours, \'999999999\')\n) t \nunion all \nSELECT \'碱用量\' as name,sum(value) as value from (\n SELECT \n concat(a.bdate,\' \',a.hours,\':00:00\')::timestamp as time,\n (a.cval - b.cval) as value,\n a.key,a.hours,a.did\nfrom \n(SELECT to_number(t.val,\'999999999.99\') as cval,t.*,\n b.dname,b.id\n from trep_hkey_detail t,tcode_device b \n where t.tid = b.id and \n t.tid::character varying= #{tid} and \n (\'\' = \'\' or b.gid::character varying = \'\') and \n t.did = b.did and \n t.bdate = CURRENT_DATE - 1\n) a,\n(SELECT to_number(t.val,\'999999999.99\') as cval,t.*,\n b.dname,b.id\n from trep_hkey_detail t,tcode_device b \n where t.tid = b.id and \n t.tid::character varying= #{tid} and \n (\'\' = \'\' or b.gid::character varying = \'\') and \n t.did = b.did and \n t.bdate = CURRENT_DATE -1 \n) b \nwhere a.tid = b.id and \n a.did = b.did and \n a.key = b.key and \n a.key = \'碱用量\' and \n a.bdate = b.bdate and \n to_number(a.hours,\'999999999\') - 1 = to_number(b.hours, \'999999999\')\n) t \n\n', NULL, NULL);
INSERT INTO `api_sql` (`id`, `api_id`, `sql_text`, `transform_plugin`, `transform_plugin_params`) VALUES (202, 'HYORZYyI', 'SELECT name, sum(value) as value \nfrom \n( \n SELECT to_number(t.val_dep,\'9999999999999999999.99\') - to_number(t.val_arr, \'9999999999999999999.99\') as value,\n b.name,t.key,c.descript,d.dname,d.grpname,\n t.bdate,to_char(t.ctime,\'yyyy-mm-dd hh24:mi:ss\') as ctime,to_char(t.mtime,\'yyyy-mm-dd hh24:mi:ss\') as mtime \n from trep_group_detail t,tcode_model_detail_ex b,tcode_group c ,vcode_key_detail d \n where t.tid = b.tid and \n t.tid = c.tid and \n t.tid = d.tid and \n t.did = d.did and \n t.key = d.key and \n t.grpcode = c.code and \n t.bdate = CURRENT_DATE-1 and \n t.key in (\'vapor\',\'alkali\') and \n (t.tid::VARCHAR = #{tid}) AND\n (\'\'=#{grpid} or d.grpid::VARCHAR= #{grpid}) and \n b.code = \'all\' and \n d.grpname != \'\' and \n t.key = b.key and \n substr(b.ex_s1,3,1) = \'1\'\n) a\ngroup by a.name \nORDER BY a.name desc \n', NULL, NULL);
INSERT INTO `api_sql` (`id`, `api_id`, `sql_text`, `transform_plugin`, `transform_plugin_params`) VALUES (203, 'HYORZYyI', 'SELECT b.* from (\n SELECT case when a.key = \'alkali\' then \'碱用量\'\n when a.key = \'vapor\' then \'蒸汽\'\n else a.key \n end as name ,\n a.val as value,\n case when a.key = \'alkali\' then \'1020\'\n when a.key = \'vapor\' then \'1010\'\n else a.key \n end as sort \n from (\n SELECT t.key,\n sum(to_number(val_dep, \'9999999999999999999.99\'))-sum(to_number(val_arr, \'9999999999999999999.99\')) as val\n from trep_hkey_detail t,vcode_key_detail b \n where t.tid = b.tid and \n t.did = b.did and \n t.key = b.key and \n (t.tid::VARCHAR = #{tid}) AND\n (\'\'=#{grpid} or b.grpid::VARCHAR= #{grpid}) and \n t.key in (\'vapor\',\'alkali\') and \n t.bdate = CURRENT_DATE \n group by t.key \n ) a \n) b \norder by b.sort\n', NULL, NULL);
INSERT INTO `api_sql` (`id`, `api_id`, `sql_text`, `transform_plugin`, `transform_plugin_params`) VALUES (205, 'VyCtYO0f', 'SELECT case when t.key = \'蒸汽\' then \'vapor\'\n when t.key = \'碱用量\' then \'alkali\' \n else t.key end as key,t.sort,jsonb_agg(b ORDER BY b.bdate,to_number(b.hours, \'99\')) as arr\n from tcode_model_detail_ex t\n left JOIN \n (select concat(bdate,\' \',hours,\':00:00\')::TIMESTAMP::VARCHAR as time,tid,\n case when key = \'蒸汽\' then \'vapor\'\n when key = \'碱用量\' then \'alkali\' \n else key end as nkey,val as value ,bdate,hours\n from trep_hkey_detail \n where bdate = CURRENT_DATE -1 and \n did::varchar = #{did}\n ) b \n on t.tid = b.tid and \n t.key = b.nkey \n where t.tid = \'22eed190-39af-11ed-8d4e-1d9073a615c6\' and \n t.code = \'all\' and \n t.key in (\'vapor\',\'alkali\',\'electric\',\'gas\',\'water\')\n GROUP BY t.key,t.sort\n ORDER BY t.sort', NULL, NULL);
INSERT INTO `api_sql` (`id`, `api_id`, `sql_text`, `transform_plugin`, `transform_plugin_params`) VALUES (210, 'IHQJLVtr', 'SELECT name, sum(value) as value \nfrom \n( \n SELECT to_number(t.val_dep,\'9999999999999999999.99\') - to_number(t.val_arr, \'9999999999999999999.99\') as value,\n b.name,t.key,c.descript,d.dname,d.grpname,\n t.bdate,to_char(t.ctime,\'yyyy-mm-dd hh24:mi:ss\') as ctime,to_char(t.mtime,\'yyyy-mm-dd hh24:mi:ss\') as mtime \n from trep_group_detail t,tcode_model_detail_ex b,(\n SELECT a.* from\n (\n SELECT CONCAT((CURRENT_DATE)::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.dep >= t.arr\n union\n SELECT CONCAT((CURRENT_DATE)::TEXT,\' \',t.arr)::TIMESTAMP as tarr,\n CONCAT((CURRENT_DATE+1)::TEXT,\' \',t.dep)::TIMESTAMP as tdep,\n t.* from tcode_group t\n where t.dep < t.arr\n union\n SELECT CONCAT((CURRENT_DATE-1)::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.dep < t.arr\n ) a\n where CURRENT_TIMESTAMP > a.tarr and\n CURRENT_TIMESTAMP <= a.tdep\n limit 1\n ) c ,vcode_key_detail d \n where t.tid = b.tid and \n t.tid = c.tid and \n t.tid = d.tid and \n t.did = d.did and \n t.key = d.key and \n t.grpcode = c.code and \n (t.ctime BETWEEN c.tarr and c.tdep) and \n t.key in (\'vapor\',\'alkali\') and \n (t.tid::VARCHAR = #{tid}) AND\n (\'\'=#{grpid} or d.grpid::VARCHAR= #{grpid}) and \n b.code = \'all\' and \n d.grpname != \'\' and \n t.key = b.key and \n substr(b.ex_s1,3,1) = \'1\'\n) a\ngroup by a.name \nORDER BY a.name desc \n', NULL, NULL);
INSERT INTO `api_sql` (`id`, `api_id`, `sql_text`, `transform_plugin`, `transform_plugin_params`) VALUES (211, 'IHQJLVtr', 'SELECT b.* from (\n SELECT case when a.key = \'alkali\' then \'碱用量\'\n when a.key = \'vapor\' then \'蒸汽\'\n else a.key \n end as name ,\n a.val as value,\n case when a.key = \'alkali\' then \'1020\'\n when a.key = \'vapor\' then \'1010\'\n else a.key \n end as sort \n from (\n SELECT t.key,\n sum(to_number(val_dep, \'9999999999999999999.99\'))-sum(to_number(val_arr, \'9999999999999999999.99\')) as val\n from trep_hkey_detail t,vcode_key_detail b \n where t.tid = b.tid and \n t.did = b.did and \n t.key = b.key and \n (t.tid::VARCHAR = #{tid}) AND\n (\'\'=#{grpid} or b.grpid::VARCHAR= #{grpid}) and \n t.key in (\'vapor\',\'alkali\') and \n t.bdate = CURRENT_DATE \n group by t.key \n ) a \n) b \norder by b.sort\n', NULL, NULL);
INSERT INTO `api_sql` (`id`, `api_id`, `sql_text`, `transform_plugin`, `transform_plugin_params`) VALUES (215, '5SeUCRJy', 'SELECT case when t.key = \'蒸汽\' then \'vapor\'\n when t.key = \'碱用量\' then \'alkali\' \n else t.key end as key,t.sort,jsonb_agg(b ORDER BY b.bdate,to_number(b.hours, \'99\')) as arr\n from tcode_model_detail_ex t\n left JOIN \n (select concat(bdate,\' \',hours,\':00:00\')::TIMESTAMP::VARCHAR as time,tid,\n case when key = \'蒸汽\' then \'vapor\'\n when key = \'碱用量\' then \'alkali\' \n else key end as nkey,val as value ,bdate,hours\n from trep_hkey_detail \n where DATE_PART(\'Day\',CURRENT_DATE::timestamp - ctime::timestamp) < 1 and \n DATE_PART(\'hour\',ctime) <= 24 and \n did::varchar = #{did}\n ) b \n on t.tid = b.tid and \n t.key = b.nkey \n where t.tid = \'22eed190-39af-11ed-8d4e-1d9073a615c6\' and \n t.code = \'all\' and \n t.key in (\'vapor\',\'alkali\',\'electric\',\'gas\',\'water\')\n GROUP BY t.key,t.sort\n ORDER BY t.sort', NULL, NULL);
INSERT INTO `api_sql` (`id`, `api_id`, `sql_text`, `transform_plugin`, `transform_plugin_params`) VALUES (216, 'CQ9VkAr9', 'SELECT a.time,a.key,sum(value) as value \nfrom (\nSELECT \n concat(t.bdate,\' \',t.hours,\':00:00\')::timestamp as time,\n t.key,\n (to_number(t.val_dep, \'9999999999999999.99\'))-(to_number(t.val_arr, \'9999999999999999.99\')) as value\nfrom trep_hkey_detail t,vcode_key_detail b \nwhere \n (\'\' = #{tid} or t.tid::VARCHAR = #{tid}) and\n (\'\' = #{grpid} or b.grpid::varchar = #{grpid}) and \n t.key in (\'vapor\') and \n t.tid = b.tid and \n t.did = b.did and \n t.key = b.key and \n DATE_PART(\'Day\',CURRENT_DATE::timestamp - t.ctime::timestamp) < 1 and \n DATE_PART(\'hour\',t.ctime) <= 24 \n order by t.bdate,right(concat(\'00\',t.hours),2)\n) a\nGROUP BY a.time,a.key \nORDER BY a.time,a.key', NULL, NULL);
INSERT INTO `api_sql` (`id`, `api_id`, `sql_text`, `transform_plugin`, `transform_plugin_params`) VALUES (217, 'CQ9VkAr9', 'SELECT a.time,a.key,sum(value) as value \nfrom (\nSELECT \n concat(t.bdate,\' \',t.hours,\':00:00\')::timestamp as time,\n t.key,\n (to_number(t.val_dep, \'9999999999999999.99\'))-(to_number(t.val_arr, \'9999999999999999.99\')) as value\nfrom trep_hkey_detail t,vcode_key_detail b \nwhere \n (\'\' = #{tid} or t.tid::VARCHAR = #{tid}) and\n (\'\' = #{grpid} or b.grpid::varchar = #{grpid}) and \n t.key in (\'alkali\') and \n t.tid = b.tid and \n t.did = b.did and \n t.key = b.key and \n t.ctime > CURRENT_DATE - 1\n order by t.bdate,right(concat(\'00\',t.hours),2)\n) a\nGROUP BY a.time,a.key \nORDER BY a.time,a.key;', NULL, NULL);
INSERT INTO `api_sql` (`id`, `api_id`, `sql_text`, `transform_plugin`, `transform_plugin_params`) VALUES (225, 'EeBkndxU', 'insert into trep_hours_sta_detail as thsd (tid,did,key,bdate,hours,cron,len,val,time,ctime,mtime,created_time,updated_time)\nSELECT a.tid,a.did,a.key,CURRENT_DATE,\n date_part(\'hour\', CURRENT_TIME) as hours,\n 20 as cron,1 as len ,\n a.val,20*1,\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\n from vcode_key_detail t ,tcode_model_detail b \n where t.tid = b.tenant_id and \n t.key = b.key and \n b.code = \'default\' and \n b.change = true\n) a\nON CONFLICT (tid,did,key,bdate,hours,val)\nDO UPDATE SET \nlen = thsd.len + EXCLUDED.len,\ntime = (thsd.len + EXCLUDED.len) * 20,\nmtime = CURRENT_TIMESTAMP,\nupdated_time = (extract(epoch from CURRENT_TIMESTAMP) * 1000)::int8;\n', NULL, NULL);
INSERT INTO `api_sql` (`id`, `api_id`, `sql_text`, `transform_plugin`, `transform_plugin_params`) VALUES (226, '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 20 as cron,1 as len ,\n 20*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 > 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) * 20,\nmtime = CURRENT_TIMESTAMP,\nupdated_time = (extract(epoch from CURRENT_TIMESTAMP) * 1000)::int8;\n', NULL, NULL);
INSERT INTO `api_sql` (`id`, `api_id`, `sql_text`, `transform_plugin`, `transform_plugin_params`) VALUES (227, 'RSuNGzhs', 'insert into trep_day_sta_detail as trep \n (tid,did,bdate,key,val,cron,len,time,ctime,mtime,created_time,updated_time)\nSELECT a.tid,a.did,a.tarr::date as bdate,a.key,\n a.val,\n 20 as cron,1 as len ,\n 20*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.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_days 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_days t\n where t.tdays > 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,key,val)\nDO UPDATE SET \nlen = trep.len + EXCLUDED.len,\ntime = (trep.len + EXCLUDED.len) * 20,\nmtime = CURRENT_TIMESTAMP,\nupdated_time = (extract(epoch from CURRENT_TIMESTAMP) * 1000)::int8;\n', NULL, NULL);
INSERT INTO `api_sql` (`id`, `api_id`, `sql_text`, `transform_plugin`, `transform_plugin_params`) VALUES (235, '0qLjHowN', 'SELECT t.*,\n d.fid,d.fname,d.wid,d.wname,d.grpid,d.grpname,d.gid,d.gname,d.dname,d.volume_on_day \n from trep_group_sta_detail t,tcode_group c ,vcode_key_detail d \n where t.tid = d.tid and \n t.tid = \'22eed190-39af-11ed-8d4e-1d9073a615c6\' and \n t.tid = c.tid and \n t.tid = d.tid and \n t.key = d.key and \n t.grpcode = c.code and \n t.bdate::varchar = #{date}::varchar and \n (d.dname like concat(#{deviceName},\'%\') or \'\' = #{deviceName}) and \n (c.code = #{grpcode} or \'\' = #{grpcode}) and \n (d.grpname like concat(#{grptype},\'%\') or \'\' = #{grptype}) and \n d.grpname != \'\' ;', NULL, NULL);
INSERT INTO `api_sql` (`id`, `api_id`, `sql_text`, `transform_plugin`, `transform_plugin_params`) VALUES (237, 'v7p2AAqp', 'SELECT t.* \nfrom vcode_key_detail t \nwhere t.tid = \'22eed190-39af-11ed-8d4e-1d9073a615c6\' and \n (t.dname like concat(#{deviceName},\'%\') or \'\' = #{deviceName}) and \n (t.key = #{key} or \'\' = #{key}) and \n (t.grpname like concat(#{grptype},\'%\') or \'\' = #{grptype}) and \n t.grpname != \'\' ;', NULL, NULL);
INSERT INTO `api_sql` (`id`, `api_id`, `sql_text`, `transform_plugin`, `transform_plugin_params`) VALUES (240, 'hGLKRYiu', 'SELECT to_number(t.val_dep,\'9999999999999999999.9999\') - to_number(t.val_arr, \'9999999999999999999.9999\') as value,\n b.name,d.dname,d.key,d.grpname,\n t.bdate,to_char(t.ctime,\'yyyy-mm-dd hh24:mi:ss\') as ctime,to_char(t.mtime,\'yyyy-mm-dd hh24:mi:ss\') as mtime \n from trep_dkey_detail t,tcode_model_detail_ex b,vcode_key_detail d\n where t.tid = b.tid and \n t.tid = d.tid and \n t.did = d.did and \n t.key = d.key and \n (t.bdate BETWEEN concat(to_char(date_trunc(\'month\', concat(#{year},\'-\',#{month},\'-01\')::DATE - interval \'1\' month),\'yyyy-mm\'),\'-26\')::DATE and \n concat(#{year},\'-\',#{month},\'-25\')::DATE) and \n (d.dname like concat(#{deviceName},\'%\') or \'\' = #{deviceName}) and \n (b.name like concat(#{propName},\'%\') or \'\' = #{propName}) and \n (d.grpname like concat(#{grptype},\'%\') or \'\' = #{grptype}) and \n b.code = \'all\' and \n t.key = b.key and \n d.grpname != \'\' and \n substr(b.ex_s1,3,1) = \'1\'\n ORDER BY bdate desc,grpname,dname,key asc ;\n ', NULL, NULL);
INSERT INTO `api_sql` (`id`, `api_id`, `sql_text`, `transform_plugin`, `transform_plugin_params`) VALUES (246, '3qxDmpBG', 'SELECT trep_group_detail_function();', NULL, NULL);
INSERT INTO `api_sql` (`id`, `api_id`, `sql_text`, `transform_plugin`, `transform_plugin_params`) VALUES (247, '3qxDmpBG', 'INSERT into trep_dkey_detail(tid,did,key,bdate,ctime,mtime,val,val_dep,val_arr)\nselect a.tid,a.did,a.key,a.bdate,\nmin(a.ctime),max(a.mtime),\n(to_number(min(val_arr), \'999999999999999.99\') + sum(a.value))::varchar as val,\n(to_number(min(val_arr), \'999999999999999.99\') + sum(a.value))::varchar as val_dep,\nmin(val_arr) as val_arr\nfrom \n(\nSELECT t.*,to_number(t.val_dep, \'999999999999999.9999\') - to_number(t.val_arr, \'999999999999999.9999\') as value \nfrom trep_group_detail t\nwhere t.bdate = CURRENT_DATE\n) a\ngroup by a.tid,a.did,a.key,a.bdate\nON CONFLICT (tid,did,key,bdate)\nDO UPDATE SET \nval = EXCLUDED.val,\nval_dep = EXCLUDED.val_dep,\nmtime = CURRENT_TIMESTAMP;', NULL, NULL);
INSERT INTO `api_sql` (`id`, `api_id`, `sql_text`, `transform_plugin`, `transform_plugin_params`) VALUES (248, 'tCoVivD8', 'INSERT into trep_hkey_detail(tid,did,key,bdate,hours,val,ctime,mtime,val_arr,val_dep)\nSELECT t.tid,t.did, t.key,current_date as bdate,\ndate_part(\'hour\', CURRENT_TIME) as hours,t.val ,\nCURRENT_TIMESTAMP ,CURRENT_TIMESTAMP,\nt.val,t.val\n from vcode_key_detail t,tcode_model_detail b\nwhere t.tid = b.tenant_id and \n t.key = b.key and \n b.code = \'default\' and \n b.halt = \'F\' and \n b.hour = true \n ON CONFLICT (tid,did,key,bdate,hours)\nDO UPDATE SET \nval = EXCLUDED.val,\nval_dep = EXCLUDED.val_dep,\nmtime = CURRENT_TIMESTAMP;', NULL, NULL);
INSERT INTO `api_sql` (`id`, `api_id`, `sql_text`, `transform_plugin`, `transform_plugin_params`) VALUES (249, 'tCoVivD8', 'update trep_hkey_detail \n set peak = case when c.switch = 1 then \n (to_number(val_dep,\'9999999999999999999.99\') - to_number(val_arr, \'9999999999999999999.99\'))::varchar else \n \'0.00\' end ,\n valley = case when c.switch = 0 then \n (to_number(val_dep,\'9999999999999999999.99\') - to_number(val_arr, \'9999999999999999999.99\'))::varchar else \n \'0.00\' end \n from \n (SELECT case when CURRENT_TIME >= \'08:00\'::time then 1\n else 0 end \n as switch) c\nwhere bdate = CURRENT_DATE and \n hours = date_part(\'hour\', CURRENT_TIME)::varchar and \n key = \'electric\';', NULL, NULL);
INSERT INTO `api_sql` (`id`, `api_id`, `sql_text`, `transform_plugin`, `transform_plugin_params`) VALUES (250, '7TVjkWPy', 'INSERT into trep_dkey_detail(tid,did,key,bdate,val_arr,val_dep,val,ctime,mtime) \nSELECT t.tid,t.did,t.key,c.tarr::date as bdate,\n t.val,t.val,t.val,CURRENT_TIMESTAMP,CURRENT_TIMESTAMP\n from vcode_key_detail t ,tcode_model_detail b,\n (\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_days 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_days t\n where t.tdays > 0\n \n ) a \n where (CURRENT_TIMESTAMP BETWEEN a.tarr and a.tdep) \n ) c\n where \n 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.day = true\nON CONFLICT (tid,did,key,bdate)\nDO UPDATE SET \nval_dep = EXCLUDED.val_dep,\nmtime = CURRENT_TIMESTAMP;', NULL, NULL);
INSERT INTO `api_sql` (`id`, `api_id`, `sql_text`, `transform_plugin`, `transform_plugin_params`) VALUES (251, '7TVjkWPy', 'update trep_dkey_detail \n set peak = (to_number(val_dep,\'9999999999999999999.99\') - to_number(val_arr, \'9999999999999999999.99\'))::varchar,\n valley = \'0.00\'\nwhere bdate = CURRENT_DATE and \n key = \'electric\';', NULL, NULL);
INSERT INTO `api_sql` (`id`, `api_id`, `sql_text`, `transform_plugin`, `transform_plugin_params`) VALUES (252, 'pjYii91f', 'SELECT tmp_cache_group_detail_function();', NULL, NULL);
INSERT INTO `api_sql` (`id`, `api_id`, `sql_text`, `transform_plugin`, `transform_plugin_params`) VALUES (262, 'B1ANmtET', 'insert into trep_sta_detail(tid,did,key,val_arr,val_dep)\nSELECT a.tid,a.did,a.key,a.val as val_arr,a.val as val_dep\nfrom \n(\n SELECT t.tid,t.did,t.key,\n min(case when round(date_part(\'epoch\', now()::timestamp - \n (select max(update_time)\n from vcode_key_detail x \n where x.tid = t.tid and \n x.did = t.did and \n x.key = t.key \n )::timestamp\n )::NUMERIC / 60) >= 5 then \'9\' \n else t.val \n end ) as val\n from vcode_key_detail t ,tcode_model_detail b \n where t.tid = b.tenant_id and \n t.key = b.key and \n b.code = \'default\' and \n b.change = true \n GROUP BY t.tid,t.did,t.key\n) a\nON CONFLICT (tid,did,key)\nDO UPDATE SET \nval_dep = EXCLUDED.val_dep,\nmtime = CURRENT_TIMESTAMP;\n\n', NULL, NULL);
INSERT INTO `api_sql` (`id`, `api_id`, `sql_text`, `transform_plugin`, `transform_plugin_params`) VALUES (263, 'B1ANmtET', 'INSERT into trep_hsta_detail(tid,did,key,val,arr,dep)\nSELECT t.tid,t.did,t.key,t.val_arr,t.ctime,t.mtime\n from trep_sta_detail t \n where t.val_arr != t.val_dep ;', NULL, NULL);
INSERT INTO `api_sql` (`id`, `api_id`, `sql_text`, `transform_plugin`, `transform_plugin_params`) VALUES (264, 'B1ANmtET', 'UPDATE trep_sta_detail \n set val_arr = val_dep,ctime = CURRENT_TIMESTAMP \n where val_arr != val_dep;', NULL, NULL);
INSERT INTO `api_sql` (`id`, `api_id`, `sql_text`, `transform_plugin`, `transform_plugin_params`) VALUES (265, 'xfXpHIg0', 'SELECT to_number(t.val_dep,\'9999999999999999999.9999\') - to_number(t.val_arr, \'9999999999999999999.9999\') as value,\n b.name,c.descript,d.dname,d.grpname,\n t.bdate,to_char(t.ctime,\'yyyy-mm-dd hh24:mi:ss\') as ctime,to_char(t.mtime,\'yyyy-mm-dd hh24:mi:ss\') as mtime \n from trep_group_detail t,tcode_model_detail_ex b,tcode_group c ,vcode_key_detail d \n where t.tid = b.tid and \n t.tid = c.tid and \n t.tid = d.tid and \n t.did = d.did and \n t.key = d.key and \n t.grpcode = c.code and \n t.bdate::varchar = #{date}::varchar and \n (d.dname like concat(\'%\',#{deviceName},\'%\') or \'\' = #{deviceName}) and \n (b.name like concat(#{propName},\'%\') or \'\' = #{propName}) and \n (c.code = #{grpcode} or \'\' = #{grpcode}) and \n (d.grpname like concat(#{grptype},\'%\') or \'\' = #{grptype}) and \n b.code = \'all\' and \n d.grpname != \'\' and \n t.key = b.key and \n substr(b.ex_s1,3,1) = \'1\'', NULL, NULL);
INSERT INTO `api_sql` (`id`, `api_id`, `sql_text`, `transform_plugin`, `transform_plugin_params`) VALUES (266, 'cD4sCi7I', 'SELECT to_number(t.val_dep,\'9999999999999999999.9999\') - to_number(t.val_arr, \'9999999999999999999.9999\') as value,\n b.name,c.descript,d.dname,d.grpname,\n t.bdate,to_char(t.ctime,\'yyyy-mm-dd hh24:mi:ss\') as ctime,to_char(t.mtime,\'yyyy-mm-dd hh24:mi:ss\') as mtime \n from trep_group_detail t,tcode_model_detail_ex b,tcode_group c ,vcode_key_detail d \n where t.tid = b.tid and \n t.tid = \'22eed190-39af-11ed-8d4e-1d9073a615c6\' and \n t.tid = c.tid and \n t.tid = d.tid and \n t.did = d.did and \n t.key = d.key and \n t.grpcode = c.code and \n (t.bdate BETWEEN #{arr}::date and #{dep}::date ) and \n (d.dname like concat(\'%\',#{deviceName},\'%\') or \'\' = #{deviceName}) and \n (b.name like concat(#{propName},\'%\') or \'\' = #{propName}) and \n (c.code = #{grpcode} or \'\' = #{grpcode}) and \n (d.grpname like concat(#{grptype},\'%\') or \'\' = #{grptype}) and \n b.code = \'all\' and \n d.grpname != \'\' and \n t.key = b.key and \n substr(b.ex_s1,3,1) = \'1\'\n order by t.did,t.key,t.bdate,t.grpcode;\n\n \n ', NULL, NULL);
COMMIT;
-- ----------------------------
-- Table structure for datasource
-- ----------------------------
DROP TABLE IF EXISTS `datasource`;
CREATE TABLE `datasource` (
`id` varchar(255) NOT NULL,
`name` varchar(255) DEFAULT NULL,
`note` varchar(255) DEFAULT NULL,
`type` varchar(255) DEFAULT NULL,
`url` varchar(255) DEFAULT NULL,
`username` varchar(255) DEFAULT NULL,
`password` varchar(255) DEFAULT NULL,
`driver` varchar(100) DEFAULT NULL,
`table_sql` varchar(255) DEFAULT NULL,
`create_time` varchar(20) DEFAULT NULL,
`update_time` varchar(20) DEFAULT NULL,
PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3;
-- ----------------------------
-- Records of datasource
-- ----------------------------
BEGIN;
INSERT INTO `datasource` (`id`, `name`, `note`, `type`, `url`, `username`, `password`, `driver`, `table_sql`, `create_time`, `update_time`) VALUES ('EhgozRdv', 'V3-测试环境', '', 'postgresql', 'jdbc:postgresql://121.199.175.235:30433/hsiotdb', 'postgres', 'ZeDk5+VSpaKseaGVpkfEcA==', 'org.postgresql.Driver', 'SELECT table_name FROM information_schema.tables WHERE table_schema = \'public\' ORDER BY table_name', '2022-09-24 23:19:12', '2022-09-24 23:19:12');
INSERT INTO `datasource` (`id`, `name`, `note`, `type`, `url`, `username`, `password`, `driver`, `table_sql`, `create_time`, `update_time`) VALUES ('kSC2Qziy', '物联平台V3生产', '', 'postgresql', 'jdbc:postgresql://47.99.83.75:30433/hsiotdb', 'postgres', 'ZeDk5+VSpaKseaGVpkfEcA==', 'org.postgresql.Driver', 'SELECT table_name FROM information_schema.tables WHERE table_schema = \'public\' ORDER BY table_name', '2022-09-23 12:30:22', '2022-09-23 13:13:59');
COMMIT;
-- ----------------------------
-- Table structure for firewall
-- ----------------------------
DROP TABLE IF EXISTS `firewall`;
CREATE TABLE `firewall` (
`status` varchar(255) DEFAULT NULL,
`mode` varchar(255) DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3;
-- ----------------------------
-- Records of firewall
-- ----------------------------
BEGIN;
INSERT INTO `firewall` (`status`, `mode`) VALUES ('off', 'black');
COMMIT;
-- ----------------------------
-- Table structure for ip_rules
-- ----------------------------
DROP TABLE IF EXISTS `ip_rules`;
CREATE TABLE `ip_rules` (
`type` varchar(255) DEFAULT NULL,
`ip` varchar(10240) DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3;
-- ----------------------------
-- Records of ip_rules
-- ----------------------------
BEGIN;
INSERT INTO `ip_rules` (`type`, `ip`) VALUES ('white', NULL);
INSERT INTO `ip_rules` (`type`, `ip`) VALUES ('black', NULL);
COMMIT;
-- ----------------------------
-- Table structure for token
-- ----------------------------
DROP TABLE IF EXISTS `token`;
CREATE TABLE `token` (
`id` int NOT NULL AUTO_INCREMENT,
`token` varchar(255) DEFAULT NULL,
`note` varchar(255) DEFAULT NULL,
`expire` bigint DEFAULT NULL,
`create_time` bigint DEFAULT NULL,
PRIMARY KEY (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=3 DEFAULT CHARSET=utf8mb3;
-- ----------------------------
-- Records of token
-- ----------------------------
BEGIN;
INSERT INTO `token` (`id`, `token`, `note`, `expire`, `create_time`) VALUES (1, '6f3ec539d2ad4d08384e9c1f080e2eda', '', NULL, 1663984118254);
INSERT INTO `token` (`id`, `token`, `note`, `expire`, `create_time`) VALUES (2, 'a4359cffacda5d0f24d11af4e6952312', '南泰君霖', NULL, 1668485985478);
COMMIT;
-- ----------------------------
-- Table structure for user
-- ----------------------------
DROP TABLE IF EXISTS `user`;
CREATE TABLE `user` (
`id` int NOT NULL AUTO_INCREMENT,
`username` varchar(255) DEFAULT NULL,
`password` varchar(255) DEFAULT NULL,
PRIMARY KEY (`id`),
UNIQUE KEY `username` (`username`)
) ENGINE=InnoDB AUTO_INCREMENT=2 DEFAULT CHARSET=utf8mb3;
-- ----------------------------
-- Records of user
-- ----------------------------
BEGIN;
INSERT INTO `user` (`id`, `username`, `password`) VALUES (1, 'admin', 'admin');
COMMIT;
CREATE TABLE `api_execute_log` (
`id` varchar(255) NOT NULL,
`create_time` varchar(20) CHARACTER SET utf8 COLLATE utf8_general_ci DEFAULT NULL COMMENT '日志创建时间',
`execute_time` int NOT NULL DEFAULT '0' COMMENT '执行时长单位毫秒',
`api_path` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci DEFAULT NULL COMMENT '执行api地址',
`api_id` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL COMMENT '执行api标识',
PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3;
SET FOREIGN_KEY_CHECKS = 1;
/*
Navicat Premium Data Transfer
Source Server : 47.96.236.169
Source Server Type : MySQL
Source Server Version : 80028
Source Host : 47.96.236.169:33306
Source Schema : iot_dbapi
Target Server Type : MySQL
Target Server Version : 80028
File Encoding : 65001
Date: 08/08/2023 13:38:42
*/
create database `iot_dbapi` default character set utf8 collate utf8_general_ci; create database `iot_dbapi` default character set utf8 collate utf8_general_ci;
use `iot_dbapi`;
use iot_dbapi; SET NAMES utf8mb4;
DROP TABLE IF EXISTS `api_auth`; SET FOREIGN_KEY_CHECKS = 0;
CREATE TABLE `api_auth` -- ----------------------------
( -- Table structure for api_auth
`id` int(11) NOT NULL AUTO_INCREMENT, -- ----------------------------
`token_id` int(11) DEFAULT NULL, DROP TABLE IF EXISTS `api_auth`;
CREATE TABLE `api_auth` (
`id` int NOT NULL AUTO_INCREMENT,
`token_id` int DEFAULT NULL,
`group_id` varchar(255) DEFAULT NULL, `group_id` varchar(255) DEFAULT NULL,
PRIMARY KEY (`id`) PRIMARY KEY (`id`)
) ENGINE = InnoDB ) ENGINE=InnoDB AUTO_INCREMENT=11 DEFAULT CHARSET=utf8mb3;
DEFAULT CHARSET = utf8;
-- ----------------------------
-- Records of api_auth
-- ----------------------------
BEGIN;
INSERT INTO `api_auth` (`id`, `token_id`, `group_id`) VALUES (7, 1, 'XlscLq30');
INSERT INTO `api_auth` (`id`, `token_id`, `group_id`) VALUES (9, 2, 'XlscLq30');
INSERT INTO `api_auth` (`id`, `token_id`, `group_id`) VALUES (10, 2, 'Ket4Asgj');
COMMIT;
-- ----------------------------
-- Table structure for api_config
-- ----------------------------
DROP TABLE IF EXISTS `api_config`; DROP TABLE IF EXISTS `api_config`;
CREATE TABLE `api_config` (
CREATE TABLE `api_config`
(
`id` varchar(255) NOT NULL, `id` varchar(255) NOT NULL,
`path` varchar(255) DEFAULT NULL, `path` varchar(255) DEFAULT NULL,
`name` varchar(255) DEFAULT NULL, `name` varchar(255) DEFAULT NULL,
`note` varchar(255) DEFAULT NULL, `note` varchar(255) DEFAULT NULL,
`params` text, `params` text,
`status` int(11) DEFAULT NULL, `status` int DEFAULT NULL,
`datasource_id` varchar(255) DEFAULT NULL, `datasource_id` varchar(255) DEFAULT NULL,
`previlege` int(11) DEFAULT NULL, `previlege` int DEFAULT NULL,
`group_id` varchar(255) DEFAULT NULL, `group_id` varchar(255) DEFAULT NULL,
`cache_plugin` varchar(255) DEFAULT NULL, `cache_plugin` varchar(255) DEFAULT NULL,
`cache_plugin_params` varchar(255) DEFAULT NULL, `cache_plugin_params` varchar(255) DEFAULT NULL,
`create_time` varchar(20) DEFAULT NULL, `create_time` varchar(20) DEFAULT NULL,
`update_time` varchar(20) DEFAULT NULL, `update_time` varchar(20) DEFAULT NULL,
`type` int DEFAULT '0' COMMENT 'api类型(0-原子api;1-流程api)',
`open_trans` int DEFAULT '0' COMMENT '是否打开事务,1-是;0-否',
`content_type` varchar(50) DEFAULT 'application/x-www-form-urlencoded',
`json_param` text,
PRIMARY KEY (`id`), PRIMARY KEY (`id`),
UNIQUE KEY `path` (`path`) UNIQUE KEY `path` (`path`)
) ENGINE = InnoDB ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3;
DEFAULT CHARSET = utf8;
DROP TABLE IF EXISTS `api_sql`; -- ----------------------------
CREATE TABLE `api_sql` -- Records of api_config
( -- ----------------------------
`id` int(11) NOT NULL AUTO_INCREMENT, BEGIN;
`api_id` varchar(11) NOT 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 ('0qLjHowN', 'v1_switch_detail', '南泰君霖对外接口-班组开停机状态查询', NULL, '[{\"name\":\"date\",\"type\":\"string\",\"note\":\"营业日期\"},{\"name\":\"deviceName\",\"type\":\"string\",\"note\":\"设备名称\"},{\"name\":\"grpcode\",\"type\":\"string\",\"note\":\"班组am或pm\"},{\"name\":\"grptype\",\"type\":\"string\",\"note\":\"分区\"}]', 1, 'kSC2Qziy', 0, 'Ket4Asgj', NULL, NULL, '2022-11-15 13:55:43', '2023-07-04 08:45:28', 0, 0, 'application/x-www-form-urlencoded', NULL);
`sql_text` text NOT 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 ('1amyDI0t', 'dbapi/f_rep_month_key_sum', 'f_rep_month_key_sum', NULL, '[{\"name\":\"tid\",\"type\":\"string\"},{\"name\":\"grpid\",\"type\":\"string\"}]', 1, 'kSC2Qziy', 1, 'kh6ZZHjl', NULL, NULL, '2023-01-04 17:21:25', '2023-01-04 17:39:29', 0, 0, 'application/x-www-form-urlencoded', NULL);
`transform_plugin` varchar(255) DEFAULT 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 ('3qxDmpBG', 'dbapi/f_set_trep_group_detail', '生产-保存班组能耗数据', '生产-保存班组能耗数据', '[]', 1, 'kSC2Qziy', 1, 'GvwgzOrx', NULL, NULL, '2022-09-29 14:32:10', '2023-06-07 08:25:20', 0, 0, 'application/x-www-form-urlencoded', NULL);
`transform_plugin_params` varchar(255) DEFAULT 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 ('4nITQagX', 'statisticsErpProductionHour', '采集每小时纬度值', '定时每小时获取erp最新值并保存到小时统计表', '[]', 1, NULL, 1, 'd5Wilw1l', NULL, NULL, '2023-04-25 18:28:23', '2023-04-26 10:23:13', 1, 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 ('5McuqqRW', 'f_trep_group_sta_detail', 'f_trep_group_sta_detail', NULL, '[{\"name\":\"deviceName\",\"type\":\"string\",\"note\":\"设备名称\"},{\"name\":\"grpcode\",\"type\":\"string\",\"note\":\"班组am或pm\"},{\"name\":\"grptype\",\"type\":\"string\",\"note\":\"分组A区B区等\"},{\"name\":\"startDate\",\"type\":\"string\",\"note\":\"开始时间\"},{\"name\":\"endDate\",\"type\":\"string\",\"note\":\"结束时间\"},{\"name\":\"sta\",\"type\":\"string\",\"note\":\"状态\"}]', 1, 'kSC2Qziy', 1, 'kh6ZZHjl', NULL, NULL, '2022-11-30 17:11:22', '2023-06-28 15:18:05', 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 ('5oOPLE2a', 'f_rep_online_energy', '报表-线上抄表', NULL, '[{\"name\":\"grptype\",\"type\":\"string\",\"note\":\"分组\"}]', 1, 'kSC2Qziy', 1, 'kh6ZZHjl', NULL, NULL, '2023-03-11 09:02:54', '2023-03-23 10:42:38', 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 ('5SeUCRJy', 'dbapi/f_rep_device_groups_detail', 'f_rep_device_groups_detail', NULL, '[{\"name\":\"did\",\"type\":\"string\"}]', 1, 'kSC2Qziy', 1, 'kh6ZZHjl', NULL, NULL, '2022-10-10 12:27:08', '2022-11-04 00:33:28', 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 ('73T52QSe', 'f_trep_repair_group_sta_detail', '君霖班组开机状态报表重算', NULL, '[]', 1, 'kSC2Qziy', 1, 'Ket4Asgj', NULL, NULL, '2023-08-05 09:26:12', '2023-08-05 09:26:12', 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 ('7BlefeCW', 'auto_update_sort', '修复生产报错500的问题', NULL, '[]', 1, 'kSC2Qziy', 1, 'gridVPEW', NULL, NULL, '2023-07-27 15:21:00', '2023-07-27 15:22:33', 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 ('7TVjkWPy', 'f_set_days_key_detail', '生产-保存每日能耗数据-停用', NULL, '[]', 0, 'kSC2Qziy', 1, 'GvwgzOrx', NULL, NULL, '2022-11-02 16:48:26', '2022-11-16 01:45:39', 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 ('9IwIMzRf', 'f_set_total_detail', '生产-累计产量统计', NULL, '[]', 1, 'kSC2Qziy', 1, 'qTRavJqw', NULL, NULL, '2023-04-10 17:59:13', '2023-04-10 17:59:13', 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 ('9xFhax2y', 'junlin_hous_key', 'junlin_hous_key', NULL, '[]', 1, 'kSC2Qziy', 1, 'omd4MV0A', NULL, NULL, '2022-09-24 08:05:07', '2022-09-24 19:00:16', 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 ('B1ANmtET', 'f_set_sta_detail', '生产-当前状态持续时长统计', NULL, '[]', 1, 'kSC2Qziy', 1, 'OW5fGirI', NULL, NULL, '2022-10-16 00:45:27', '2022-11-16 16:19:48', 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 ('bw6ULlLe', 'f_func_rep_test', 'f_func_rep_test', NULL, '[]', 1, 'EhgozRdv', 1, 'rihofAYb', NULL, NULL, '2022-09-24 23:20:40', '2023-06-07 10:11:40', 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 ('c4GbWKlb', 'f_tmp_update_device_sort', '修复生产设备列表排序为空的问题', NULL, '[]', 0, 'kSC2Qziy', 1, 'gridVPEW', NULL, NULL, '2023-01-12 14:00:17', '2023-01-12 14:00:17', 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 ('CBwIhABd', 'qj_column', '区间能耗报表', NULL, '[{\"name\":\"date\",\"type\":\"string\",\"note\":\"开始时间\"},{\"name\":\"dep\",\"type\":\"string\",\"note\":\"结束时间\"},{\"name\":\"grptype\",\"type\":\"string\",\"note\":\"分组\"}]', 1, 'kSC2Qziy', 1, 'kh6ZZHjl', NULL, NULL, '2023-02-21 13:49:03', '2023-02-25 01:10:06', 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 ('cD4sCi7I', 'v1_group_detail', '南泰君霖对外接口-班组能耗查询', NULL, '[{\"name\":\"deviceName\",\"type\":\"string\",\"note\":\"设备名称\"},{\"name\":\"propName\",\"type\":\"string\",\"note\":\"属性名称\"},{\"name\":\"grpcode\",\"type\":\"string\",\"note\":\"班组am或pm\"},{\"name\":\"grptype\",\"type\":\"string\",\"note\":\"分组A区或B区等\"},{\"name\":\"arr\",\"type\":\"string\",\"note\":\"开始日期\"},{\"name\":\"dep\",\"type\":\"string\",\"note\":\"结束日期\"}]', 1, 'kSC2Qziy', 0, 'Ket4Asgj', NULL, NULL, '2022-11-15 13:25:47', '2022-11-17 10:26:06', 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 ('CQ9VkAr9', 'dbapi/f_rep_hour_key_detail', 'f_rep_hour_key_detail', NULL, '[{\"name\":\"tid\",\"type\":\"string\",\"note\":\"租户ID\"},{\"name\":\"grpid\",\"type\":\"string\",\"note\":\"分组ID\"}]', 1, 'kSC2Qziy', 1, 'kh6ZZHjl', NULL, NULL, '2022-09-24 09:49:48', '2022-11-04 00:37:17', 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 ('dTh8vJ0X', 'get_report_grpname', '报表分组统计', NULL, '[{\"name\":\"tid\",\"type\":\"string\"}]', 1, 'kSC2Qziy', 1, '1RNi0tix', NULL, NULL, '2023-02-24 23:41:18', '2023-02-25 00:07:20', 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 ('EeBkndxU', 'f_set_hours_switch_detail', '生产-每小时保存开停机变化数据-新', NULL, '[]', 1, 'kSC2Qziy', 1, 'OW5fGirI', NULL, NULL, '2022-11-12 13:35:21', '2023-04-11 17:46:02', 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 ('EnFpExkx', 'dbapi/f_rep_days_hours_device', 'f_rep_days_hours_device', NULL, '[{\"name\":\"did\",\"type\":\"string\"}]', 1, 'kSC2Qziy', 1, 'kh6ZZHjl', NULL, NULL, '2022-09-27 23:30:00', '2022-09-29 13:47:12', 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 ('F9Y3ZjqK', 'getDeviceTest', 'getDeviceTest', 'getTest', '[{\"name\":\"factory_id\",\"type\":\"string\",\"note\":\"工厂id\"},{\"name\":\"workshop_id\",\"type\":\"Array<string>\",\"note\":\"车间id集合\"}]', 1, 'kSC2Qziy', 1, 'rihofAYb', NULL, NULL, '2023-02-23 14:59:53', '2023-02-28 17:27:20', 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 ('FNMVwfcu', 'f_set_group_switch_detail', '生产-班组保存开停机状态', NULL, '[]', 1, 'kSC2Qziy', 1, 'OW5fGirI', NULL, NULL, '2022-11-12 13:36:00', '2023-08-03 19:47:07', 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 ('hGLKRYiu', 'f_trep_day_detail', 'f_trep_day_detail', NULL, '[{\"name\":\"month\",\"type\":\"string\",\"note\":\"日期示例10代表10月\"},{\"name\":\"deviceName\",\"type\":\"string\",\"note\":\"设备名称\"},{\"name\":\"propName\",\"type\":\"string\",\"note\":\"属性名称\"},{\"name\":\"year\",\"type\":\"string\",\"note\":\"年份\"},{\"name\":\"grptype\",\"type\":\"string\",\"note\":\"分组A区或B区等\"}]', 1, 'kSC2Qziy', 1, 'kh6ZZHjl', NULL, NULL, '2022-10-09 23:36:54', '2022-11-15 15:55:42', 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 ('HtgA8FbR', 'f_junlin_trep_group_sta_detail', '南泰君霖开放班组开停机报表接口', NULL, '[{\"name\":\"deviceName\",\"type\":\"string\",\"note\":\"设备名称,可为空\"},{\"name\":\"grpcode\",\"type\":\"string\",\"note\":\"班组am或pm,可为空\"},{\"name\":\"grptype\",\"type\":\"string\",\"note\":\"分组A区B区等,可为空\"},{\"name\":\"startDate\",\"type\":\"string\",\"note\":\"开始时间,必填\"},{\"name\":\"endDate\",\"type\":\"string\",\"note\":\"结束时间,必填\"},{\"name\":\"sta\",\"type\":\"string\",\"note\":\"状态,0停机,1运行,9离线,可为空\"}]', 1, 'kSC2Qziy', 0, 'Ket4Asgj', NULL, NULL, '2023-06-29 09:13:22', '2023-06-29 09:13:22', 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 ('HYORZYyI', 'dbapi/f_rep_yesterday_key_sum', 'f_rep_yesterday_key_sum', NULL, '[{\"name\":\"tid\",\"type\":\"string\"},{\"name\":\"grpid\",\"type\":\"string\"}]', 1, 'kSC2Qziy', 1, 'kh6ZZHjl', NULL, NULL, '2022-11-03 17:43:35', '2022-11-03 18:25:46', 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 ('IHQJLVtr', 'dbapi/f_rep_group_key_sum', 'f_rep_group_key_sum', NULL, '[{\"name\":\"tid\",\"type\":\"string\"},{\"name\":\"grpid\",\"type\":\"string\"}]', 1, 'kSC2Qziy', 1, 'kh6ZZHjl', NULL, NULL, '2022-11-03 17:42:58', '2023-02-07 16:19:23', 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 ('K4QZT40A', 'f_junlin_rep_out_key', 'f_junlin_rep_out_key', NULL, '[{\"name\":\"bdate\",\"type\":\"string\",\"note\":\"日期\"}]', 1, 'kSC2Qziy', 0, 'kh6ZZHjl', NULL, NULL, '2022-09-28 14:49:53', '2022-09-28 14:49:53', 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 ('kU15HMrE', 'dbapi/f_rep_device_days_detail', 'f_rep_device_days_detail', NULL, '[{\"name\":\"did\",\"type\":\"string\",\"note\":\"设备ID\"}]', 1, 'kSC2Qziy', 1, 'kh6ZZHjl', NULL, NULL, '2022-10-10 11:38:43', '2022-10-11 12:06:28', 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 ('MsRKsiUV', 'f_junlin_trep_sta_detail', '南泰君霖开停机明细记录接口', NULL, '[{\"name\":\"bdate\",\"type\":\"string\",\"note\":\"日期\"},{\"name\":\"deviceName\",\"type\":\"string\",\"note\":\"设备名称可空\"},{\"name\":\"grptype\",\"type\":\"string\",\"note\":\"分组\"},{\"name\":\"sta\",\"type\":\"string\",\"note\":\"状态\"}]', 1, 'kSC2Qziy', 0, 'Ket4Asgj', NULL, NULL, '2023-07-05 13:16:36', '2023-07-05 13:30:10', 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 ('N8sgjOWD', 'dbapi/f_rep_hour_key_sum', 'f_rep_hour_key_sum', NULL, '[{\"name\":\"tid\",\"type\":\"string\"},{\"name\":\"grpid\",\"type\":\"string\"}]', 1, 'kSC2Qziy', 1, 'kh6ZZHjl', NULL, NULL, '2022-09-25 22:26:44', '2022-11-03 15:23:25', 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 ('relN3Q8Q', 'public_screen_device_sta', '自定义大屏看板', NULL, '[]', 1, 'kSC2Qziy', 1, 'GqI4gLZm', NULL, NULL, '2022-12-05 17:54:36', '2022-12-05 17:55:38', 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 ('RSuNGzhs', 'f_set_day_switch_detail', '生产-每日保存开停机数据', NULL, '[]', 1, 'kSC2Qziy', 1, 'OW5fGirI', NULL, NULL, '2022-11-12 13:36:36', '2022-11-14 13:53:12', 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 ('soWGWcwj', 'getFactoryListTest', 'getFactoryListTest', 'getFactoryListTest测试', '[{\"name\":\"factory_id\",\"type\":\"string\",\"note\":\"工厂id\"}]', 1, 'kSC2Qziy', 1, 'rihofAYb', NULL, NULL, '2023-02-28 11:29:01', '2023-02-28 11:29:01', 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 ('tCoVivD8', 'dbapi/f_set_hour_key_detail', '生产-每小时保存能耗数据', NULL, '[]', 1, 'kSC2Qziy', 1, 'GvwgzOrx', NULL, NULL, '2022-09-26 13:38:15', '2022-11-15 22:41:30', 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 ('TVCRetxT', 'daling', '生产调试', NULL, '[{\"name\":\"name\",\"type\":\"Array<string>\",\"note\":\"设备名称\"}]', 1, 'EhgozRdv', 1, 'rihofAYb', NULL, NULL, '2023-02-28 16:12:09', '2023-06-07 10:04:17', 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 ('UDzGSkeZ', 'set_tcode_base', 'set_tcode_base', NULL, '[]', 1, 'kSC2Qziy', 1, 'Ket4Asgj', NULL, NULL, '2022-09-24 09:24:20', '2022-09-24 09:24:20', 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 ('v7p2AAqp', 'v1_device_detail', '南泰君霖对外接口-设备实时采集数据查询', NULL, '[{\"name\":\"deviceName\",\"type\":\"string\",\"note\":\"设备名称\"},{\"name\":\"key\",\"type\":\"string\",\"note\":\"属性名称\"},{\"name\":\"grptype\",\"type\":\"string\",\"note\":\"分区\"}]', 1, 'kSC2Qziy', 0, 'Ket4Asgj', NULL, NULL, '2022-11-15 14:25:59', '2022-11-15 14:27: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 ('vKDBdbvA', 'f_set_yield_detail', '生产-百米能耗', NULL, '[]', 1, 'kSC2Qziy', 1, 'uJCO6Dvv', NULL, NULL, '2023-04-10 17:59:59', '2023-04-10 19:39:44', 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 ('VyCtYO0f', 'dbapi/f_rep_device_lastDays_detail', 'f_rep_device_lastDays_detail', NULL, '[{\"name\":\"did\",\"type\":\"string\"}]', 1, 'kSC2Qziy', 1, 'kh6ZZHjl', NULL, NULL, '2022-11-03 18:39:46', '2022-11-03 18:44:56', 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 ('wFz52Yb1', 'dbapi/f_rep_device_months_detail', 'f_rep_device_months_detail', NULL, '[{\"name\":\"did\",\"type\":\"string\",\"note\":\"设备ID\"}]', 1, 'kSC2Qziy', 1, 'kh6ZZHjl', NULL, NULL, '2022-10-10 12:30:16', '2022-10-11 12:13:20', 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 ('xfXpHIg0', 'f_trep_group_detail', 'f_trep_group_detail', NULL, '[{\"name\":\"date\",\"type\":\"string\",\"note\":\"日期\"},{\"name\":\"deviceName\",\"type\":\"string\",\"note\":\"设备名称\"},{\"name\":\"propName\",\"type\":\"string\",\"note\":\"属性名称\"},{\"name\":\"grpcode\",\"type\":\"string\",\"note\":\"班组am或pm\"},{\"name\":\"grptype\",\"type\":\"string\",\"note\":\"分组A区B区等\"}]', 1, 'kSC2Qziy', 1, 'kh6ZZHjl', NULL, NULL, '2022-09-29 15:11:36', '2023-05-16 09:29:16', 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 ('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);
COMMIT;
-- ----------------------------
-- Table structure for api_execute_log
-- ----------------------------
DROP TABLE IF EXISTS `api_execute_log`;
CREATE TABLE `api_execute_log` (
`id` varchar(255) NOT NULL,
`create_time` varchar(20) CHARACTER SET utf8 COLLATE utf8_general_ci DEFAULT NULL COMMENT '日志创建时间',
`execute_time` int NOT NULL DEFAULT '0' COMMENT '执行时长单位毫秒',
`api_path` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci DEFAULT NULL COMMENT '执行api地址',
`api_id` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL COMMENT '执行api标识',
PRIMARY KEY (`id`) PRIMARY KEY (`id`)
) ENGINE = InnoDB ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3;
DEFAULT CHARSET = utf8;
DROP TABLE IF EXISTS `api_group`;
CREATE TABLE `api_group` -- ----------------------------
( -- Table structure for api_group
-- ----------------------------
DROP TABLE IF EXISTS `api_group`;
CREATE TABLE `api_group` (
`id` varchar(255) NOT NULL, `id` varchar(255) NOT NULL,
`name` varchar(255) DEFAULT NULL, `name` varchar(255) DEFAULT NULL,
PRIMARY KEY (`id`), PRIMARY KEY (`id`),
UNIQUE KEY `name` (`name`) UNIQUE KEY `name` (`name`)
) ENGINE = InnoDB ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3;
DEFAULT CHARSET = utf8;
-- ----------------------------
-- Records of api_group
-- ----------------------------
BEGIN;
INSERT INTO `api_group` (`id`, `name`) VALUES ('fwmIB1r0', 'sqlServer_WorkStudio_库接口_田园');
INSERT INTO `api_group` (`id`, `name`) VALUES ('Ket4Asgj', 'v3_pgsql_库接口_南泰');
INSERT INTO `api_group` (`id`, `name`) VALUES ('GqI4gLZm', 'v3_pgsql_库接口_开停机查询接口');
INSERT INTO `api_group` (`id`, `name`) VALUES ('1RNi0tix', 'v3_pgsql_库接口_查询接口');
INSERT INTO `api_group` (`id`, `name`) VALUES ('d5Wilw1l', 'v3_pgsql_库接口_田园');
INSERT INTO `api_group` (`id`, `name`) VALUES ('kh6ZZHjl', 'v3_pgsql_库接口_能耗查询');
INSERT INTO `api_group` (`id`, `name`) VALUES ('rihofAYb', 'v3_测试接口');
INSERT INTO `api_group` (`id`, `name`) VALUES ('gridVPEW', '定时任务_数据异常_v3pgSql');
INSERT INTO `api_group` (`id`, `name`) VALUES ('qTRavJqw', '定时任务统计_写入v3_pgSql_产量统计');
INSERT INTO `api_group` (`id`, `name`) VALUES ('OW5fGirI', '定时任务统计_写入v3_pgSql_开停机统计');
INSERT INTO `api_group` (`id`, `name`) VALUES ('uJCO6Dvv', '定时任务统计_写入v3_pgSql_百米能耗');
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_能耗统计(碱,蒸汽)');
COMMIT;
DROP TABLE IF EXISTS `datasource`; -- ----------------------------
-- Table structure for api_sql
-- ----------------------------
DROP TABLE IF EXISTS `api_sql`;
CREATE TABLE `api_sql` (
`id` int NOT NULL AUTO_INCREMENT,
`api_id` varchar(11) NOT NULL,
`sql_text` text NOT NULL,
`transform_plugin` varchar(255) DEFAULT NULL,
`transform_plugin_params` varchar(255) DEFAULT NULL,
PRIMARY KEY (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=599 DEFAULT CHARSET=utf8mb3;
-- ----------------------------
-- Records of api_sql
-- ----------------------------
BEGIN;
INSERT INTO `api_sql` (`id`, `api_id`, `sql_text`, `transform_plugin`, `transform_plugin_params`) VALUES (4, 'UDzGSkeZ', 'insert into tcode_device(tid,fid,fname,wid,wname,grpid,grpname,gid,gname,did,dname,knumb,kcnt,sort,halt,htime,ctime,mtime)\nSELECT \nt.tid,t.fid,t.fname,t.wid,t.wname,t.grpid,t.grpname,t.gid,t.gname,\nt.did,t.dname,count(1) as key_cnt ,\nsum(t.volume_on_day) as keyval_cnt,\n\'1000\' as sort,\n\'F\' as halt,CURRENT_TIMESTAMP,CURRENT_TIMESTAMP,CURRENT_TIMESTAMP\nfrom vcode_key_detail t \nGROUP BY t.tid,t.fid,t.fname,t.wid,t.wname,t.grpid,t.grpname,t.gid,t.gname,t.did,t.dname\nORDER BY t.dname desc \nON conflict(tid,did)\ndo update set \nfid = EXCLUDED.fid,\nfname = EXCLUDED.fname,\nwid = EXCLUDED.wid,\nwname = EXCLUDED.wname,\ngrpid = EXCLUDED.grpid,\ngrpname = EXCLUDED.grpname,\ngid = EXCLUDED.gid,\ngname = EXCLUDED.gname,\ndname = EXCLUDED.dname,\nknumb = EXCLUDED.knumb,\nkcnt = EXCLUDED.kcnt,\nmtime = CURRENT_TIMESTAMP;', NULL, NULL);
INSERT INTO `api_sql` (`id`, `api_id`, `sql_text`, `transform_plugin`, `transform_plugin_params`) VALUES (48, '9xFhax2y', 'INSERT into trep_hkey_detail(tid,did,key,bdate,hours,val,ctime,mtime)\nSELECT t.tid,t.did, \n case when t.key = \'gas\' then \'蒸汽\' \n when t.key = \'正向累积数值整数部分\' then \'碱用量\'\n else t.key \n end as key ,\n current_date as bdate,\ndate_part(\'hour\', CURRENT_TIME) as hours,t.val_ex ,\nCURRENT_TIMESTAMP ,CURRENT_TIMESTAMP\nfrom \n(\n SELECT \n to_number(a.val,\'999999999.999999999\') + to_number(b.val,\'999999999.999999999\') as val_ex,\n a.* from \n (\n SELECT t.* from vcode_key_detail t \n where t.key = \'正向累积数值整数部分\'\n \n ) a,\n (\n SELECT t.* from vcode_key_detail t \n WHERE t.key = \'正向累积数值小数部分\'\n ) b\n where a.tid = b.tid and \n a.did = b.did and \n a.tid = \'22eed190-39af-11ed-8d4e-1d9073a615c6\'\n union all \n SELECT to_number(t.val,\'999999999.999999999\') as val_ex,t.* from vcode_key_detail t \n where t.tid = \'22eed190-39af-11ed-8d4e-1d9073a615c6\' and \n t.key = \'gas\'\n) t\nON CONFLICT (tid,did,key,bdate,hours)\nDO UPDATE SET \nval = EXCLUDED.val,\nmtime = CURRENT_TIMESTAMP;\n \n\n\n ', NULL, NULL);
INSERT INTO `api_sql` (`id`, `api_id`, `sql_text`, `transform_plugin`, `transform_plugin_params`) VALUES (72, 'K4QZT40A', 'SELECT t.* from trep_dkey_detail t \nwhere t.bdate = #{bdate} and \n t.tid = \'22eed190-39af-11ed-8d4e-1d9073a615c6\'', NULL, NULL);
INSERT INTO `api_sql` (`id`, `api_id`, `sql_text`, `transform_plugin`, `transform_plugin_params`) VALUES (77, 'EnFpExkx', 'SELECT t.key,\njsonb_agg(b) as arr\nfrom tcode_model_detail_ex t\n left JOIN \n (select concat(bdate,\' \',hours,\':00:00\')::TIMESTAMP::VARCHAR as time ,tid,key as nkey,val as value \n from trep_hkey_detail \n where ctime >= (CURRENT_TIMESTAMP - interval \'24 hour\')) b \non t.tid = b.tid and \n t.key = b.nkey \nwhere t.tid = \'22eed190-39af-11ed-8d4e-1d9073a615c6\' and \n t.code = \'all\' and \n substr(t.ex_s1,1,1) = \'1\'\nGROUP BY t.key;\n', NULL, NULL);
INSERT INTO `api_sql` (`id`, `api_id`, `sql_text`, `transform_plugin`, `transform_plugin_params`) VALUES (151, 'kU15HMrE', 'SELECT case when t.key = \'蒸汽\' then \'vapor\'\n when t.key = \'碱用量\' then \'alkali\' \n else t.key end as key,t.sort,jsonb_agg(b ORDER BY b.bdate,to_number(b.hours, \'99\')) as arr\n from tcode_model_detail_ex t\n left JOIN \n (select concat(bdate,\' \',hours,\':00:00\')::TIMESTAMP::VARCHAR as time,tid,\n case when key = \'蒸汽\' then \'vapor\'\n when key = \'碱用量\' then \'alkali\' \n else key end as nkey,val as value ,bdate,hours\n from trep_hkey_detail \n where bdate = CURRENT_DATE and \n did::varchar = #{did}\n ) b \n on t.tid = b.tid and \n t.key = b.nkey \n where t.tid = \'22eed190-39af-11ed-8d4e-1d9073a615c6\' and \n t.code = \'all\' and \n t.key in (\'vapor\',\'alkali\',\'electric\',\'gas\',\'water\')\n GROUP BY t.key,t.sort\n ORDER BY t.sort', NULL, NULL);
INSERT INTO `api_sql` (`id`, `api_id`, `sql_text`, `transform_plugin`, `transform_plugin_params`) VALUES (153, 'wFz52Yb1', 'SELECT case when t.key = \'蒸汽\' then \'vapor\'\n when t.key = \'碱用量\' then \'alkali\' \n else t.key end as key,t.sort,jsonb_agg(b ORDER BY b.bdate,to_number(b.hours, \'99\')) as arr\n from tcode_model_detail_ex t\n left JOIN \n (select concat(bdate,\' \',hours,\':00:00\')::TIMESTAMP::VARCHAR as time,tid,\n case when key = \'蒸汽\' then \'vapor\'\n when key = \'碱用量\' then \'alkali\' \n else key end as nkey,val as value ,bdate,hours\n from trep_hkey_detail \n where bdate = CURRENT_DATE and \n did::varchar = #{did}\n ) b \n on t.tid = b.tid and \n t.key = b.nkey \n where t.tid = \'22eed190-39af-11ed-8d4e-1d9073a615c6\' and \n t.code = \'all\' and \n t.key in (\'vapor\',\'alkali\',\'electric\',\'gas\',\'water\')\n GROUP BY t.key,t.sort\n ORDER BY t.sort', NULL, NULL);
INSERT INTO `api_sql` (`id`, `api_id`, `sql_text`, `transform_plugin`, `transform_plugin_params`) VALUES (193, 'N8sgjOWD', 'SELECT b.* from (\n SELECT case when a.key = \'alkali\' then \'碱用量\'\n when a.key = \'vapor\' then \'蒸汽\'\n else a.key \n end as name ,\n a.val as value,\n case when a.key = \'alkali\' then \'1020\'\n when a.key = \'vapor\' then \'1010\'\n else a.key \n end as sort \n from (\n SELECT t.key,\n sum(to_number(val_dep, \'9999999999999999999.99\'))-sum(to_number(val_arr, \'9999999999999999999.99\')) as val\n from trep_hkey_detail t,vcode_key_detail b \n where t.tid = b.tid and \n t.did = b.did and \n t.key = b.key and \n (t.tid::VARCHAR = #{tid}) AND\n (\'\'=#{grpid} or b.grpid::VARCHAR= #{grpid}) and \n t.key in (\'vapor\',\'alkali\') and \n t.bdate = CURRENT_DATE \n group by t.key \n ) a \n) b \norder by b.sort\n', NULL, NULL);
INSERT INTO `api_sql` (`id`, `api_id`, `sql_text`, `transform_plugin`, `transform_plugin_params`) VALUES (194, 'N8sgjOWD', 'SELECT \'蒸汽\' as name,sum(value) as value from (\n SELECT \n concat(a.bdate,\' \',a.hours,\':00:00\')::timestamp as time,\n (a.cval - b.cval) as value,\n a.key,a.hours,a.did\nfrom \n(SELECT to_number(t.val,\'999999999.99\') as cval,t.*,\n b.dname,b.id\n from trep_hkey_detail t,tcode_device b \n where t.tid = b.id and \n t.tid::character varying= #{tid} and \n (\'\' = \'\' or b.gid::character varying = \'\') and \n t.did = b.did and \n t.bdate = CURRENT_DATE - 1\n) a,\n(SELECT to_number(t.val,\'999999999.99\') as cval,t.*,\n b.dname,b.id\n from trep_hkey_detail t,tcode_device b \n where t.tid = b.id and \n t.tid::character varying= #{tid} and \n (\'\' = \'\' or b.gid::character varying = \'\') and \n t.did = b.did and \n t.bdate = CURRENT_DATE - 1\n) b \nwhere a.tid = b.id and \n a.did = b.did and \n a.key = b.key and \n a.key = \'蒸汽\' and \n a.bdate = b.bdate and \n to_number(a.hours,\'999999999\') - 1 = to_number(b.hours, \'999999999\')\n) t \nunion all \nSELECT \'碱用量\' as name,sum(value) as value from (\n SELECT \n concat(a.bdate,\' \',a.hours,\':00:00\')::timestamp as time,\n (a.cval - b.cval) as value,\n a.key,a.hours,a.did\nfrom \n(SELECT to_number(t.val,\'999999999.99\') as cval,t.*,\n b.dname,b.id\n from trep_hkey_detail t,tcode_device b \n where t.tid = b.id and \n t.tid::character varying= #{tid} and \n (\'\' = \'\' or b.gid::character varying = \'\') and \n t.did = b.did and \n t.bdate = CURRENT_DATE - 1\n) a,\n(SELECT to_number(t.val,\'999999999.99\') as cval,t.*,\n b.dname,b.id\n from trep_hkey_detail t,tcode_device b \n where t.tid = b.id and \n t.tid::character varying= #{tid} and \n (\'\' = \'\' or b.gid::character varying = \'\') and \n t.did = b.did and \n t.bdate = CURRENT_DATE -1 \n) b \nwhere a.tid = b.id and \n a.did = b.did and \n a.key = b.key and \n a.key = \'碱用量\' and \n a.bdate = b.bdate and \n to_number(a.hours,\'999999999\') - 1 = to_number(b.hours, \'999999999\')\n) t \n\n', NULL, NULL);
INSERT INTO `api_sql` (`id`, `api_id`, `sql_text`, `transform_plugin`, `transform_plugin_params`) VALUES (202, 'HYORZYyI', 'SELECT name, sum(value) as value \nfrom \n( \n SELECT to_number(t.val_dep,\'9999999999999999999.99\') - to_number(t.val_arr, \'9999999999999999999.99\') as value,\n b.name,t.key,c.descript,d.dname,d.grpname,\n t.bdate,to_char(t.ctime,\'yyyy-mm-dd hh24:mi:ss\') as ctime,to_char(t.mtime,\'yyyy-mm-dd hh24:mi:ss\') as mtime \n from trep_group_detail t,tcode_model_detail_ex b,tcode_group c ,vcode_key_detail d \n where t.tid = b.tid and \n t.tid = c.tid and \n t.tid = d.tid and \n t.did = d.did and \n t.key = d.key and \n t.grpcode = c.code and \n t.bdate = CURRENT_DATE-1 and \n t.key in (\'vapor\',\'alkali\') and \n (t.tid::VARCHAR = #{tid}) AND\n (\'\'=#{grpid} or d.grpid::VARCHAR= #{grpid}) and \n b.code = \'all\' and \n d.grpname != \'\' and \n t.key = b.key and \n substr(b.ex_s1,3,1) = \'1\'\n) a\ngroup by a.name \nORDER BY a.name desc \n', NULL, NULL);
INSERT INTO `api_sql` (`id`, `api_id`, `sql_text`, `transform_plugin`, `transform_plugin_params`) VALUES (203, 'HYORZYyI', 'SELECT b.* from (\n SELECT case when a.key = \'alkali\' then \'碱用量\'\n when a.key = \'vapor\' then \'蒸汽\'\n else a.key \n end as name ,\n a.val as value,\n case when a.key = \'alkali\' then \'1020\'\n when a.key = \'vapor\' then \'1010\'\n else a.key \n end as sort \n from (\n SELECT t.key,\n sum(to_number(val_dep, \'9999999999999999999.99\'))-sum(to_number(val_arr, \'9999999999999999999.99\')) as val\n from trep_hkey_detail t,vcode_key_detail b \n where t.tid = b.tid and \n t.did = b.did and \n t.key = b.key and \n (t.tid::VARCHAR = #{tid}) AND\n (\'\'=#{grpid} or b.grpid::VARCHAR= #{grpid}) and \n t.key in (\'vapor\',\'alkali\') and \n t.bdate = CURRENT_DATE \n group by t.key \n ) a \n) b \norder by b.sort\n', NULL, NULL);
INSERT INTO `api_sql` (`id`, `api_id`, `sql_text`, `transform_plugin`, `transform_plugin_params`) VALUES (205, 'VyCtYO0f', 'SELECT case when t.key = \'蒸汽\' then \'vapor\'\n when t.key = \'碱用量\' then \'alkali\' \n else t.key end as key,t.sort,jsonb_agg(b ORDER BY b.bdate,to_number(b.hours, \'99\')) as arr\n from tcode_model_detail_ex t\n left JOIN \n (select concat(bdate,\' \',hours,\':00:00\')::TIMESTAMP::VARCHAR as time,tid,\n case when key = \'蒸汽\' then \'vapor\'\n when key = \'碱用量\' then \'alkali\' \n else key end as nkey,val as value ,bdate,hours\n from trep_hkey_detail \n where bdate = CURRENT_DATE -1 and \n did::varchar = #{did}\n ) b \n on t.tid = b.tid and \n t.key = b.nkey \n where t.tid = \'22eed190-39af-11ed-8d4e-1d9073a615c6\' and \n t.code = \'all\' and \n t.key in (\'vapor\',\'alkali\',\'electric\',\'gas\',\'water\')\n GROUP BY t.key,t.sort\n ORDER BY t.sort', NULL, NULL);
INSERT INTO `api_sql` (`id`, `api_id`, `sql_text`, `transform_plugin`, `transform_plugin_params`) VALUES (215, '5SeUCRJy', 'SELECT case when t.key = \'蒸汽\' then \'vapor\'\n when t.key = \'碱用量\' then \'alkali\' \n else t.key end as key,t.sort,jsonb_agg(b ORDER BY b.bdate,to_number(b.hours, \'99\')) as arr\n from tcode_model_detail_ex t\n left JOIN \n (select concat(bdate,\' \',hours,\':00:00\')::TIMESTAMP::VARCHAR as time,tid,\n case when key = \'蒸汽\' then \'vapor\'\n when key = \'碱用量\' then \'alkali\' \n else key end as nkey,val as value ,bdate,hours\n from trep_hkey_detail \n where DATE_PART(\'Day\',CURRENT_DATE::timestamp - ctime::timestamp) &lt; 1 and \n DATE_PART(\'hour\',ctime) &lt;= 24 and \n did::varchar = #{did}\n ) b \n on t.tid = b.tid and \n t.key = b.nkey \n where t.tid = \'22eed190-39af-11ed-8d4e-1d9073a615c6\' and \n t.code = \'all\' and \n t.key in (\'vapor\',\'alkali\',\'electric\',\'gas\',\'water\')\n GROUP BY t.key,t.sort\n ORDER BY t.sort', NULL, NULL);
INSERT INTO `api_sql` (`id`, `api_id`, `sql_text`, `transform_plugin`, `transform_plugin_params`) VALUES (216, 'CQ9VkAr9', 'SELECT a.time,a.key,sum(value) as value \nfrom (\nSELECT \n concat(t.bdate,\' \',t.hours,\':00:00\')::timestamp as time,\n t.key,\n (to_number(t.val_dep, \'9999999999999999.99\'))-(to_number(t.val_arr, \'9999999999999999.99\')) as value\nfrom trep_hkey_detail t,vcode_key_detail b \nwhere \n (\'\' = #{tid} or t.tid::VARCHAR = #{tid}) and\n (\'\' = #{grpid} or b.grpid::varchar = #{grpid}) and \n t.key in (\'vapor\') and \n t.tid = b.tid and \n t.did = b.did and \n t.key = b.key and \n DATE_PART(\'Day\',CURRENT_DATE::timestamp - t.ctime::timestamp) &lt; 1 and \n DATE_PART(\'hour\',t.ctime) &lt;= 24 \n order by t.bdate,right(concat(\'00\',t.hours),2)\n) a\nGROUP BY a.time,a.key \nORDER BY a.time,a.key', NULL, NULL);
INSERT INTO `api_sql` (`id`, `api_id`, `sql_text`, `transform_plugin`, `transform_plugin_params`) VALUES (217, 'CQ9VkAr9', 'SELECT a.time,a.key,sum(value) as value \nfrom (\nSELECT \n concat(t.bdate,\' \',t.hours,\':00:00\')::timestamp as time,\n t.key,\n (to_number(t.val_dep, \'9999999999999999.99\'))-(to_number(t.val_arr, \'9999999999999999.99\')) as value\nfrom trep_hkey_detail t,vcode_key_detail b \nwhere \n (\'\' = #{tid} or t.tid::VARCHAR = #{tid}) and\n (\'\' = #{grpid} or b.grpid::varchar = #{grpid}) and \n t.key in (\'alkali\') and \n t.tid = b.tid and \n t.did = b.did and \n t.key = b.key and \n t.ctime > CURRENT_DATE - 1\n order by t.bdate,right(concat(\'00\',t.hours),2)\n) a\nGROUP BY a.time,a.key \nORDER BY a.time,a.key;', NULL, NULL);
INSERT INTO `api_sql` (`id`, `api_id`, `sql_text`, `transform_plugin`, `transform_plugin_params`) VALUES (227, 'RSuNGzhs', 'insert into trep_day_sta_detail as trep \n (tid,did,bdate,key,val,cron,len,time,ctime,mtime,created_time,updated_time)\nSELECT a.tid,a.did,a.tarr::date as bdate,a.key,\n a.val,\n 20 as cron,1 as len ,\n 20*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.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_days 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_days 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,key,val)\nDO UPDATE SET \nlen = trep.len + EXCLUDED.len,\ntime = (trep.len + EXCLUDED.len) * 20,\nmtime = CURRENT_TIMESTAMP,\nupdated_time = (extract(epoch from CURRENT_TIMESTAMP) * 1000)::int8;\n', NULL, NULL);
INSERT INTO `api_sql` (`id`, `api_id`, `sql_text`, `transform_plugin`, `transform_plugin_params`) VALUES (237, 'v7p2AAqp', 'SELECT t.* \nfrom vcode_key_detail t \nwhere t.tid = \'22eed190-39af-11ed-8d4e-1d9073a615c6\' and \n (t.dname like concat(#{deviceName},\'%\') or \'\' = #{deviceName}) and \n (t.key = #{key} or \'\' = #{key}) and \n (t.grpname like concat(#{grptype},\'%\') or \'\' = #{grptype}) and \n t.grpname != \'\' ;', NULL, NULL);
INSERT INTO `api_sql` (`id`, `api_id`, `sql_text`, `transform_plugin`, `transform_plugin_params`) VALUES (240, 'hGLKRYiu', 'SELECT to_number(t.val_dep,\'9999999999999999999.9999\') - to_number(t.val_arr, \'9999999999999999999.9999\') as value,\n b.name,d.dname,d.key,d.grpname,\n t.bdate,to_char(t.ctime,\'yyyy-mm-dd hh24:mi:ss\') as ctime,to_char(t.mtime,\'yyyy-mm-dd hh24:mi:ss\') as mtime \n from trep_dkey_detail t,tcode_model_detail_ex b,vcode_key_detail d\n where t.tid = b.tid and \n t.tid = d.tid and \n t.did = d.did and \n t.key = d.key and \n (t.bdate BETWEEN concat(to_char(date_trunc(\'month\', concat(#{year},\'-\',#{month},\'-01\')::DATE - interval \'1\' month),\'yyyy-mm\'),\'-26\')::DATE and \n concat(#{year},\'-\',#{month},\'-25\')::DATE) and \n (d.dname like concat(#{deviceName},\'%\') or \'\' = #{deviceName}) and \n (b.name like concat(#{propName},\'%\') or \'\' = #{propName}) and \n (d.grpname like concat(#{grptype},\'%\') or \'\' = #{grptype}) and \n b.code = \'all\' and \n t.key = b.key and \n d.grpname != \'\' and \n substr(b.ex_s1,3,1) = \'1\'\n ORDER BY bdate desc,grpname,dname,key asc ;\n ', NULL, NULL);
INSERT INTO `api_sql` (`id`, `api_id`, `sql_text`, `transform_plugin`, `transform_plugin_params`) VALUES (248, 'tCoVivD8', 'INSERT into trep_hkey_detail(tid,did,key,bdate,hours,val,ctime,mtime,val_arr,val_dep)\nSELECT t.tid,t.did, t.key,current_date as bdate,\ndate_part(\'hour\', CURRENT_TIME) as hours,t.val ,\nCURRENT_TIMESTAMP ,CURRENT_TIMESTAMP,\nt.val,t.val\n from vcode_key_detail t,tcode_model_detail b\nwhere t.tid = b.tenant_id and \n t.key = b.key and \n b.code = \'default\' and \n b.halt = \'F\' and \n b.hour = true \n ON CONFLICT (tid,did,key,bdate,hours)\nDO UPDATE SET \nval = EXCLUDED.val,\nval_dep = EXCLUDED.val_dep,\nmtime = CURRENT_TIMESTAMP;', NULL, NULL);
INSERT INTO `api_sql` (`id`, `api_id`, `sql_text`, `transform_plugin`, `transform_plugin_params`) VALUES (249, 'tCoVivD8', 'update trep_hkey_detail \n set peak = case when c.switch = 1 then \n (to_number(val_dep,\'9999999999999999999.99\') - to_number(val_arr, \'9999999999999999999.99\'))::varchar else \n \'0.00\' end ,\n valley = case when c.switch = 0 then \n (to_number(val_dep,\'9999999999999999999.99\') - to_number(val_arr, \'9999999999999999999.99\'))::varchar else \n \'0.00\' end \n from \n (SELECT case when CURRENT_TIME &gt;= \'08:00\'::time then 1\n else 0 end \n as switch) c\nwhere bdate = CURRENT_DATE and \n hours = date_part(\'hour\', CURRENT_TIME)::varchar and \n key = \'electric\';', NULL, NULL);
INSERT INTO `api_sql` (`id`, `api_id`, `sql_text`, `transform_plugin`, `transform_plugin_params`) VALUES (250, '7TVjkWPy', 'INSERT into trep_dkey_detail(tid,did,key,bdate,val_arr,val_dep,val,ctime,mtime) \nSELECT t.tid,t.did,t.key,c.tarr::date as bdate,\n t.val,t.val,t.val,CURRENT_TIMESTAMP,CURRENT_TIMESTAMP\n from vcode_key_detail t ,tcode_model_detail b,\n (\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_days 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_days t\n where t.tdays &gt; 0\n \n ) a \n where (CURRENT_TIMESTAMP BETWEEN a.tarr and a.tdep) \n ) c\n where \n 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.day = true\nON CONFLICT (tid,did,key,bdate)\nDO UPDATE SET \nval_dep = EXCLUDED.val_dep,\nmtime = CURRENT_TIMESTAMP;', NULL, NULL);
INSERT INTO `api_sql` (`id`, `api_id`, `sql_text`, `transform_plugin`, `transform_plugin_params`) VALUES (251, '7TVjkWPy', 'update trep_dkey_detail \n set peak = (to_number(val_dep,\'9999999999999999999.99\') - to_number(val_arr, \'9999999999999999999.99\'))::varchar,\n valley = \'0.00\'\nwhere bdate = CURRENT_DATE and \n key = \'electric\';', NULL, NULL);
INSERT INTO `api_sql` (`id`, `api_id`, `sql_text`, `transform_plugin`, `transform_plugin_params`) VALUES (262, 'B1ANmtET', 'insert into trep_sta_detail(tid,did,key,val_arr,val_dep)\nSELECT a.tid,a.did,a.key,a.val as val_arr,a.val as val_dep\nfrom \n(\n SELECT t.tid,t.did,t.key,\n min(case when round(date_part(\'epoch\', now()::timestamp - \n (select max(update_time)\n from vcode_key_detail x \n where x.tid = t.tid and \n x.did = t.did and \n x.key = t.key \n )::timestamp\n )::NUMERIC / 60) &gt;= 5 then \'9\' \n else t.val \n end ) as val\n from vcode_key_detail t ,tcode_model_detail b \n where t.tid = b.tenant_id and \n t.key = b.key and \n b.code = \'default\' and \n b.change = true \n GROUP BY t.tid,t.did,t.key\n) a\nON CONFLICT (tid,did,key)\nDO UPDATE SET \nval_dep = EXCLUDED.val_dep,\nmtime = CURRENT_TIMESTAMP;\n\n', NULL, NULL);
INSERT INTO `api_sql` (`id`, `api_id`, `sql_text`, `transform_plugin`, `transform_plugin_params`) VALUES (263, 'B1ANmtET', 'INSERT into trep_hsta_detail(tid,did,key,val,arr,dep)\nSELECT t.tid,t.did,t.key,t.val_arr,t.ctime,t.mtime\n from trep_sta_detail t \n where t.val_arr != t.val_dep ;', NULL, NULL);
INSERT INTO `api_sql` (`id`, `api_id`, `sql_text`, `transform_plugin`, `transform_plugin_params`) VALUES (264, 'B1ANmtET', 'UPDATE trep_sta_detail \n set val_arr = val_dep,ctime = CURRENT_TIMESTAMP \n where val_arr != val_dep;', NULL, NULL);
INSERT INTO `api_sql` (`id`, `api_id`, `sql_text`, `transform_plugin`, `transform_plugin_params`) VALUES (266, 'cD4sCi7I', 'SELECT to_number(t.val_dep,\'9999999999999999999.9999\') - to_number(t.val_arr, \'9999999999999999999.9999\') as value,\n b.name,c.descript,d.dname,d.grpname,\n t.bdate,to_char(t.ctime,\'yyyy-mm-dd hh24:mi:ss\') as ctime,to_char(t.mtime,\'yyyy-mm-dd hh24:mi:ss\') as mtime \n from trep_group_detail t,tcode_model_detail_ex b,tcode_group c ,vcode_key_detail d \n where t.tid = b.tid and \n t.tid = \'22eed190-39af-11ed-8d4e-1d9073a615c6\' and \n t.tid = c.tid and \n t.tid = d.tid and \n t.did = d.did and \n t.key = d.key and \n t.grpcode = c.code and \n (t.bdate BETWEEN #{arr}::date and #{dep}::date ) and \n (d.dname like concat(\'%\',#{deviceName},\'%\') or \'\' = #{deviceName}) and \n (b.name like concat(#{propName},\'%\') or \'\' = #{propName}) and \n (c.code = #{grpcode} or \'\' = #{grpcode}) and \n (d.grpname like concat(#{grptype},\'%\') or \'\' = #{grptype}) and \n b.code = \'all\' and \n d.grpname != \'\' and \n t.key = b.key and \n substr(b.ex_s1,3,1) = \'1\'\n order by t.did,t.key,t.bdate,t.grpcode;\n\n \n ', NULL, NULL);
INSERT INTO `api_sql` (`id`, `api_id`, `sql_text`, `transform_plugin`, `transform_plugin_params`) VALUES (277, 'relN3Q8Q', 'SELECT a.bdate,a.sta,\n a.time,(a.time/60) as minutes,concat((round((a.time/b.time_total),2)*100)::varchar,\'%\') as bl,\n a.descript,a.dname,a.grpname,\n a.ctime,a.mtime,b.time_total\nfrom \n(SELECT t.did,t.bdate,\n case \n when t.val = \'0\' then \'停机\'\n when t.val = \'1\' then \'运行\'\n when t.val = \'9\' then \'离线\'\n end as sta,\n t.time,\n c.descript,d.dname,d.grpname,\n to_char(t.ctime,\'yyyy-mm-dd hh24:mi:ss\') as ctime,to_char(t.mtime,\'yyyy-mm-dd hh24:mi:ss\') as mtime \n from trep_group_sta_detail t,tcode_group c ,vcode_key_detail d \n where \n t.bdate = CURRENT_DATE and \n t.tid = c.tid and \n t.tid = d.tid and \n t.did = d.did and \n t.key = d.key and \n t.grpcode = c.code and \n d.grpname != \'\'\n) a,\n(\nSELECT t.did,t.bdate,\n (sum(t.time)) as time_total,\n c.descript,d.dname,d.grpname\n from trep_group_sta_detail t,tcode_group c ,vcode_key_detail d \n where \n t.bdate = CURRENT_DATE and \n t.tid = c.tid and \n t.tid = d.tid and \n t.did = d.did and \n t.key = d.key and \n t.grpcode = c.code and \n d.grpname != \'\'\n GROUP BY t.did,t.bdate,c.descript,d.dname,d.grpname\n order by t.bdate,t.did\n) b \nwhere a.did = b.did and \n a.bdate = b.bdate and \n a.descript = b.descript and \n a.dname = b.dname\n \n', NULL, NULL);
INSERT INTO `api_sql` (`id`, `api_id`, `sql_text`, `transform_plugin`, `transform_plugin_params`) VALUES (295, '1amyDI0t', 'SELECT name, sum(value) as value \nfrom \n( \n SELECT to_number(t.val_dep,\'9999999999999999999.99\') - to_number(t.val_arr, \'9999999999999999999.99\') as value,\n b.name,t.key,d.dname,d.grpname,\n t.bdate,to_char(t.ctime,\'yyyy-mm-dd hh24:mi:ss\') as ctime,to_char(t.mtime,\'yyyy-mm-dd hh24:mi:ss\') as mtime \n from trep_group_detail t,tcode_model_detail_ex b,vcode_key_detail d \n where t.tid = b.tid and \n t.tid = d.tid and \n t.did = d.did and \n t.key = d.key and \n (t.bdate BETWEEN concat(to_char(date_trunc(\'month\', concat(to_char(CURRENT_DATE,\'yyyy\'),\'-\',to_char(CURRENT_DATE,\'mm\'),\'-01\')::DATE - interval \'1\' month),\'yyyy-mm\'),\'-26\')::DATE and \n concat(to_char(CURRENT_DATE,\'yyyy\'),\'-\',to_char(CURRENT_DATE,\'mm\'),\'-25\')::DATE) and \n t.key in (\'vapor\',\'alkali\') and \n (t.tid::VARCHAR = #{tid}) AND\n (\'\'=#{grpid} or d.grpid::VARCHAR= #{grpid}) and \n b.code = \'all\' and \n d.grpname != \'\' and \n t.key = b.key and \n substr(b.ex_s1,3,1) = \'1\'\n) a\ngroup by a.name \nORDER BY a.name desc \n\n \n \n', NULL, NULL);
INSERT INTO `api_sql` (`id`, `api_id`, `sql_text`, `transform_plugin`, `transform_plugin_params`) VALUES (296, '1amyDI0t', 'SELECT 0', NULL, NULL);
INSERT INTO `api_sql` (`id`, `api_id`, `sql_text`, `transform_plugin`, `transform_plugin_params`) VALUES (303, 'c4GbWKlb', 'update hs_device_extension t \nset sort = 1000\nwhere t.sort is null ', NULL, NULL);
INSERT INTO `api_sql` (`id`, `api_id`, `sql_text`, `transform_plugin`, `transform_plugin_params`) VALUES (304, 'IHQJLVtr', 'SELECT name, sum(value) as value \nfrom \n( \n SELECT to_number(t.val_dep,\'9999999999999999999.99\') - to_number(t.val_arr, \'9999999999999999999.99\') as value,\n b.name,t.key,c.descript,d.dname,d.grpname,\n t.bdate,to_char(t.ctime,\'yyyy-mm-dd hh24:mi:ss\') as ctime,to_char(t.mtime,\'yyyy-mm-dd hh24:mi:ss\') as mtime \n from trep_group_detail t,tcode_model_detail_ex b,(\n SELECT a.* from\n (\n SELECT CONCAT((CURRENT_DATE)::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.dep &gt;= t.arr\n union\n SELECT CONCAT((CURRENT_DATE)::TEXT,\' \',t.arr)::TIMESTAMP as tarr,\n CONCAT((CURRENT_DATE+1)::TEXT,\' \',t.dep)::TIMESTAMP as tdep,\n t.* from tcode_group t\n where t.dep &lt; t.arr\n union\n SELECT CONCAT((CURRENT_DATE-1)::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.dep &lt; t.arr\n ) a\n where CURRENT_TIMESTAMP &gt; a.tarr and\n CURRENT_TIMESTAMP &lt;= a.tdep\n ) c ,vcode_key_detail d \n where t.tid = b.tid and \n t.tid = c.tid and \n t.tid = d.tid and \n t.did = d.did and \n t.key = d.key and \n t.grpcode = c.code and \n (t.ctime BETWEEN c.tarr and c.tdep) and \n t.key in (\'vapor\',\'alkali\') and \n (t.tid::VARCHAR = #{tid}) AND\n (\'\'=#{grpid} or d.grpid::VARCHAR= #{grpid}) and \n b.code = \'all\' and \n d.grpname != \'\' and \n t.key = b.key and \n substr(b.ex_s1,3,1) = \'1\'\n) a\ngroup by a.name \nORDER BY a.name desc \n', NULL, NULL);
INSERT INTO `api_sql` (`id`, `api_id`, `sql_text`, `transform_plugin`, `transform_plugin_params`) VALUES (305, 'IHQJLVtr', 'SELECT b.* from (\n SELECT case when a.key = \'alkali\' then \'碱用量\'\n when a.key = \'vapor\' then \'蒸汽\'\n else a.key \n end as name ,\n a.val as value,\n case when a.key = \'alkali\' then \'1020\'\n when a.key = \'vapor\' then \'1010\'\n else a.key \n end as sort \n from (\n SELECT t.key,\n sum(to_number(val_dep, \'9999999999999999999.99\'))-sum(to_number(val_arr, \'9999999999999999999.99\')) as val\n from trep_hkey_detail t,vcode_key_detail b \n where t.tid = b.tid and \n t.did = b.did and \n t.key = b.key and \n (t.tid::VARCHAR = #{tid}) AND\n (\'\'=#{grpid} or b.grpid::VARCHAR= #{grpid}) and \n t.key in (\'vapor\',\'alkali\') and \n t.bdate = CURRENT_DATE \n group by t.key \n ) a \n) b \norder by b.sort\n', NULL, NULL);
INSERT INTO `api_sql` (`id`, `api_id`, `sql_text`, `transform_plugin`, `transform_plugin_params`) VALUES (399, 'dTh8vJ0X', 'SELECT \'所有\' as label,\'\' as value\nunion all \nSELECT a.label,a.label as value\nfrom\n(SELECT DISTINCT grpname as label\nfrom vcode_key_detail t\nwhere t.grpname != \'\' and \n (t.tid::VARCHAR=#{tid} or \'\' = #{tid})\nORDER BY t.grpname \n) a ', NULL, NULL);
INSERT INTO `api_sql` (`id`, `api_id`, `sql_text`, `transform_plugin`, `transform_plugin_params`) VALUES (400, 'CBwIhABd', 'select \'分组\' as title,\'grpname\' 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,\'150px\' as width ,\'text\' as dataType,\'text\' as editType,\'\' as lock,\'\' as render,0 as tag,1 as export\nunion all \nselect \'能耗类型\' as title,\'key\' 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(t, \'yyyy-mm-dd\') as title,to_char(t, \'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 \n generate_series(#{date}::date,#{dep}::date,\'1 days\') as t ', NULL, NULL);
INSERT INTO `api_sql` (`id`, `api_id`, `sql_text`, `transform_plugin`, `transform_plugin_params`) VALUES (401, 'CBwIhABd', 'SELECT tmp_count(#{date}::date,#{dep}::date,#{grptype});\n\n', NULL, NULL);
INSERT INTO `api_sql` (`id`, `api_id`, `sql_text`, `transform_plugin`, `transform_plugin_params`) VALUES (402, 'CBwIhABd', 'select * from \"tmp_table2\";', NULL, NULL);
INSERT INTO `api_sql` (`id`, `api_id`, `sql_text`, `transform_plugin`, `transform_plugin_params`) VALUES (409, 'ZwOIf9HG', 'SELECT * from asset where type=\'workshop\' and id::character varying in (#{workshop_id})', NULL, NULL);
INSERT INTO `api_sql` (`id`, `api_id`, `sql_text`, `transform_plugin`, `transform_plugin_params`) VALUES (410, 'soWGWcwj', 'SELECT * from asset where type=\'factory\' and id::character varying in (#{factory_id})', NULL, NULL);
INSERT INTO `api_sql` (`id`, `api_id`, `sql_text`, `transform_plugin`, `transform_plugin_params`) VALUES (419, 'F9Y3ZjqK', 'SELECT * FROM hs_device_extension where factory_id::character varying=#{factory_id} \nand workshop_id::character varying in <foreach collection=\'workshop_id\' open=\'(\' separator=\',\' close=\')\'>#{workshop_id}</foreach>;', NULL, NULL);
INSERT INTO `api_sql` (`id`, `api_id`, `sql_text`, `transform_plugin`, `transform_plugin_params`) VALUES (420, 'bg7i9UIX', 'SELECT * from api_config where id in (#{id})', NULL, NULL);
INSERT INTO `api_sql` (`id`, `api_id`, `sql_text`, `transform_plugin`, `transform_plugin_params`) VALUES (485, '5oOPLE2a', ' select b.dname,\n sum(case when b.key = \'water\' then to_number( b.val, \'999999999999999999999999999.99\' ) else 0 end ) water,\n sum(case when b.key = \'electric\' then to_number( b.val, \'999999999999999999999999999.99\' ) else 0 end ) electric,\n sum(case when b.key = \'gas\' then to_number( b.val, \'999999999999999999999999999.99\' ) else 0 end ) gas,\n sum(case when b.key = \'wapor\' then to_number( b.val, \'999999999999999999999999999.99\' ) else 0 end ) wapor,\n sum(case when b.key = \'alkali\' then to_number( b.val, \'999999999999999999999999999.99\' ) else 0 end ) alkali\n from tcode_model_detail t ,vcode_key_detail b\n where t.tenant_id = \'22eed190-39af-11ed-8d4e-1d9073a615c6\' AND\n t.code = \'default\' and \n t.tenant_id = b.tid and \n t.key = b.key and \n t.key in (\'water\',\'electric\',\'gas\',\'wapor\',\'alkali\') and \n b.grpname != \'\'\n group by b.grpname,b.dname\n ', NULL, NULL);
INSERT INTO `api_sql` (`id`, `api_id`, `sql_text`, `transform_plugin`, `transform_plugin_params`) VALUES (486, '9IwIMzRf', 'insert into trep_total_detail(tid,did,key,val_arr,val_dep)\nSELECT a.tid,a.did,a.key,a.val as val_arr,a.val as val_dep\nfrom \n(\n SELECT t.tid,t.did,t.key,t.val \n from vcode_key_detail t ,tcode_model_detail b \n where t.tid = b.tenant_id and \n t.key = b.key and \n b.code = \'default\' and \n substr(b.ex_s1,4,1) = \'1\'\n) a\nON CONFLICT (tid,did,key)\nDO UPDATE SET\nmtime = EXCLUDED.mtime;', NULL, NULL);
INSERT INTO `api_sql` (`id`, `api_id`, `sql_text`, `transform_plugin`, `transform_plugin_params`) VALUES (487, '9IwIMzRf', ' insert into trep_total_detail(tid,did,key,val_arr,val_dep)\n SELECT t.tid,t.did,t.key,t.val as val_arr,t.val as val_dep\n from vcode_key_detail t ,tcode_model_detail b ,trep_total_detail c\n where t.tid = b.tenant_id and \n t.tid = c.tid and \n t.did = c.did and \n t.key = c.key and \n t.key = b.key and \n b.code = \'default\' and \n to_number(c.val_arr, \'99999999999999999999.99\') &lt;= to_number(t.val, \'99999999999999999999.99\') and \n substr(b.ex_s1,4,1) = \'1\'\nON CONFLICT (tid,did,key)\nDO UPDATE SET\nval_dep = EXCLUDED.val_dep,\nmtime = CURRENT_TIMESTAMP;', NULL, NULL);
INSERT INTO `api_sql` (`id`, `api_id`, `sql_text`, `transform_plugin`, `transform_plugin_params`) VALUES (488, '9IwIMzRf', ' insert into trep_htotal_detail(id,tid,did,key,bdate,val_arr,val_dep)\n SELECT uuid_generate_v4(),t.tid,t.did,t.key,CURRENT_DATE as bdate,c.val_arr,c.val_dep\n from vcode_key_detail t ,tcode_model_detail b ,trep_total_detail c\n where t.tid = b.tenant_id and \n t.tid = c.tid and \n t.did = c.did and \n t.key = c.key and \n t.key = b.key and \n b.code = \'default\' and \n to_number(c.val_arr, \'99999999999999999999.99\') &gt; to_number(t.val, \'99999999999999999999.99\') and \n substr(b.ex_s1,4,1) = \'1\';', NULL, NULL);
INSERT INTO `api_sql` (`id`, `api_id`, `sql_text`, `transform_plugin`, `transform_plugin_params`) VALUES (489, '9IwIMzRf', ' insert into trep_total_detail(tid,did,key,val_arr,val_dep)\n SELECT t.tid,t.did,t.key,t.val as val_arr,t.val as val_dep\n from vcode_key_detail t ,tcode_model_detail b ,trep_total_detail c\n where t.tid = b.tenant_id and \n t.tid = c.tid and \n t.did = c.did and \n t.key = c.key and \n t.key = b.key and \n b.code = \'default\' and \n to_number(c.val_arr, \'99999999999999999999.99\') &gt;= to_number(t.val, \'99999999999999999999.99\') and \n substr(b.ex_s1,4,1) = \'1\'\nON CONFLICT (tid,did,key)\nDO UPDATE SET\nval_arr = EXCLUDED.val_arr,\nval_dep = EXCLUDED.val_dep,\nmtime = CURRENT_TIMESTAMP;', NULL, NULL);
INSERT INTO `api_sql` (`id`, `api_id`, `sql_text`, `transform_plugin`, `transform_plugin_params`) VALUES (495, 'vKDBdbvA', 'insert into trep_yield_detail(tid,did,bdate,key,key_yield,val_arr,val_dep,val_yield,ctime,mtime)\nSELECT a.tid,a.did,CURRENT_DATE as bdate ,a.key,\'长度\' as key_yield,\n a.val_arr,a.val_dep,b.val_yield,CURRENT_TIMESTAMP as ctime,CURRENT_TIMESTAMP as mtime\nfrom \n(\nSELECT t.tid,t.did,CURRENT_DATE as bdate ,t.key,\'长度\' as key_yield,\n t.val as val_arr,t.val as val_dep\n from vcode_key_detail t,tcode_model_detail b \n where t.tid = b.tenant_id and \n t.key = b.key and \n substr(b.ex_s1, 5,1) = \'1\' and \n b.code = \'default\'\n) a,\n(\nSELECT x.*,x.val_dep - x.val_arr as val_yield\nfrom \n(\n SELECT a.tid,a.did,a.key,\n sum(to_number(a.val_arr, \'99999999999999999999.99\')) as val_arr,sum(to_number(a.val_dep, \'99999999999999999999.99\')) as val_dep\n from (\n SELECT t.tid,t.did,t.key,t.val_arr,t.val_dep\n from trep_total_detail t \n union all \n SELECT t.tid,t.did,t.key,t.val_arr,t.val_dep\n from trep_htotal_detail t \n where t.bdate = CURRENT_DATE \n ) a \n GROUP BY a.tid,a.did,a.key\n) x ,vcode_key_detail b \nwhere x.tid = b.tid and \n x.did = b.did and \n x.key = b.key \n) b \nwhere a.tid = b.tid and \n a.did = b.did \nON CONFLICT (tid,did,bdate,key,key_yield)\nDO UPDATE SET\nval_dep = EXCLUDED.val_dep,\nval_yield = EXCLUDED.val_yield,\nmtime = CURRENT_TIMESTAMP;\n', NULL, NULL);
INSERT INTO `api_sql` (`id`, `api_id`, `sql_text`, `transform_plugin`, `transform_plugin_params`) VALUES (497, 'EeBkndxU', 'insert into trep_hours_sta_detail as thsd (tid,did,key,bdate,hours,cron,len,val,time,ctime,mtime,created_time,updated_time)\nSELECT a.tid,a.did,a.key,CURRENT_DATE,\n date_part(\'hour\', CURRENT_TIME) as hours,\n 20 as cron,1 as len ,\n a.val,20*1,\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) &gt;= 5 then \'9\' \n else t.val \n end as val\n from vcode_key_detail t ,tcode_model_detail b \n where t.tid = b.tenant_id and \n t.key = b.key and \n b.code = \'default\' and \n b.change = true\n) a\nON CONFLICT (tid,did,key,bdate,hours,val)\nDO UPDATE SET \nlen = thsd.len + EXCLUDED.len,\ntime = (thsd.len + EXCLUDED.len) * 20,\nmtime = CURRENT_TIMESTAMP,\nupdated_time = (extract(epoch from CURRENT_TIMESTAMP) * 1000)::int8;\n', NULL, NULL);
INSERT INTO `api_sql` (`id`, `api_id`, `sql_text`, `transform_plugin`, `transform_plugin_params`) VALUES (511, '1mZbPpz7', 'SELECT \'tday\' as name,ISNULL( SUM(A.nQty), 0) as val \nFROM HSTextileERP.dbo.pbCommonWorkOutPut A WITH(NOLOCK) \nWHERE A.iCommonType = 20059 \n--本日产量\nAND CONVERT(DATE,A.tCreateTime) = CONVERT(DATE,GETDATE()) \nunion all \nSELECT \'yday\' as name,ISNULL( SUM(A.nQty), 0) as val \nFROM HSTextileERP.dbo.pbCommonWorkOutPut A WITH(NOLOCK) \nWHERE A.iCommonType = 20059 \n--昨日产量 \nAND CONVERT(DATE,A.tCreateTime) = DATEADD(DAY,-1,CONVERT(DATE,GETDATE())) \nunion all \nSELECT \'mday\' as name,ISNULL( SUM(A.nQty), 0) as val \nFROM HSTextileERP.dbo.pbCommonWorkOutPut A WITH(NOLOCK) \nWHERE A.iCommonType = 20059 \n--本月产量(从上个月26号到本月25号)\nAND CONVERT(DATE,A.tCreateTime) &gt;= DATEFROMPARTS(YEAR(getdate()),MONTH(DATEADD(MONTH,-1,getdate())),26) \nAND CONVERT(DATE,A.tCreateTime) &lt;= DATEFROMPARTS(YEAR(getdate()),MONTH(getdate()),25) \n', NULL, NULL);
INSERT INTO `api_sql` (`id`, `api_id`, `sql_text`, `transform_plugin`, `transform_plugin_params`) VALUES (513, 'Uop5ioDg', 'SELECT \'tday\' as name,ISNULL( SUM(A.nQty), 0) as val\nFROM HSTextileERP.dbo.pbCommonWorkOutPut A WITH(NOLOCK)\nWHERE A.iCommonType = 20059\n-- 本日产量\nAND CONVERT(DATE,A.tCreateTime) = CONVERT(DATE,GETDATE())\nunion all \nSELECT \'yday\' as name,ISNULL( SUM(A.nQty), 0) as val\nFROM HSTextileERP.dbo.pbCommonWorkOutPut A WITH(NOLOCK)\nWHERE A.iCommonType = 20059\n-- 昨日产量\nAND CONVERT(DATE,A.tCreateTime) = DATEADD(DAY,-1,CONVERT(DATE,GETDATE()))\nunion all \nSELECT \'mday\' as name,ISNULL( SUM(A.nQty), 0) as val\nFROM HSTextileERP.dbo.pbCommonWorkOutPut A WITH(NOLOCK)\nWHERE A.iCommonType = 20059\n-- 本月产量(从上个月26号到本月25号)\nAND CONVERT(DATE,A.tCreateTime) &gt;= DATEFROMPARTS(YEAR(getdate()),MONTH(DATEADD(MONTH,-1,getdate())),26) \nAND CONVERT(DATE,A.tCreateTime) &lt;= DATEFROMPARTS(YEAR(getdate()),MONTH(getdate()),25)\n\n', NULL, NULL);
INSERT INTO `api_sql` (`id`, `api_id`, `sql_text`, `transform_plugin`, `transform_plugin_params`) VALUES (515, 'dbubUW4F', '-- 请输入sql,一个标签只能输入一条sql\n select pwrr.sEquipmentNo as deviceNo ,\n sum(pwrr.nRunTime) as runTime ,\n sum(pwrr.nTotalTime) as totalTime,\n ROUND(sum(pwrr.nRunTime)/sum(pwrr.nTotalTime),2) as efficiency\n from dbo.ppWarpRunRecord pwrr \n where CONVERT(date,tStartTime) =CONVERT(date,GETDATE())\n AND pwrr.sEquipmentNo IS NOT NULL AND \n pwrr.sEquipmentNo in\n <foreach open=\"(\" close=\")\" collection=\"ids\" separator=\",\" item=\"item\" index=\"index\">#{item}</foreach>\n group by pwrr.sEquipmentNo ', NULL, NULL);
INSERT INTO `api_sql` (`id`, `api_id`, `sql_text`, `transform_plugin`, `transform_plugin_params`) VALUES (516, 'kNU3EDud', 'INSERT INTO hs_erp_production_hour (\"date_hour\", \"latest_value\", \"create_time\") \nVALUES (date_trunc(\'hour\', now()), #{val}, CURRENT_DATE);', NULL, NULL);
INSERT INTO `api_sql` (`id`, `api_id`, `sql_text`, `transform_plugin`, `transform_plugin_params`) VALUES (522, 'h0dCv9PK', 'SELECT \'tday\' as name,ISNULL( SUM(A.nQty), 0) as val\nFROM HSTextileERP.dbo.pbCommonWorkOutPut A WITH(NOLOCK)\nWHERE A.iCommonType = 20059\nAND CONVERT(DATE,A.tCreateTime) = CONVERT(DATE,GETDATE())', NULL, NULL);
INSERT INTO `api_sql` (`id`, `api_id`, `sql_text`, `transform_plugin`, `transform_plugin_params`) VALUES (523, 'b8zKyFJ9', 'SELECT \'tday\' as name,ISNULL( SUM(A.nQty), 0) as val\nFROM HSTextileERP.dbo.pbCommonWorkOutPut A WITH(NOLOCK)\nWHERE A.iCommonType = 20059\nAND CONVERT(DATE,A.tCreateTime) = CONVERT(DATE,GETDATE())\nunion all \nSELECT \'yday\' as name,ISNULL( SUM(A.nQty), 0) as val\nFROM HSTextileERP.dbo.pbCommonWorkOutPut A WITH(NOLOCK)\nWHERE A.iCommonType = 20059\nAND CONVERT(DATE,A.tCreateTime) = DATEADD(DAY,-1,CONVERT(DATE,GETDATE()))\nunion all \nSELECT \'mday\' as name,ISNULL( SUM(A.nQty), 0) as val\nFROM HSTextileERP.dbo.pbCommonWorkOutPut A WITH(NOLOCK)\nWHERE A.iCommonType = 20059\nAND CONVERT(DATE,A.tCreateTime) &gt;= DATEFROMPARTS(YEAR(getdate()),MONTH(DATEADD(MONTH,-1,getdate())),26) \nAND CONVERT(DATE,A.tCreateTime) &lt;= DATEFROMPARTS(YEAR(getdate()),MONTH(getdate()),25)', NULL, NULL);
INSERT INTO `api_sql` (`id`, `api_id`, `sql_text`, `transform_plugin`, `transform_plugin_params`) VALUES (524, '4nITQagX', '', NULL, NULL);
INSERT INTO `api_sql` (`id`, `api_id`, `sql_text`, `transform_plugin`, `transform_plugin_params`) VALUES (553, 'GrG0Yk1l', 'SELECT\n row_number() over(order by A.tCreateTime DESC ) as rownumber,\n[订单号]=F.sOrderNo,\n[品名]=E.sMaterialName,\n[品号]=E.sMaterialNo,\n[卡号]=B.sCardNo,\n[计划产出]=B.nPlanOutputQty,\n[上机电表电量]=A.nElectcUp,\n[下机电表电量]=A.nElectDown,\n[耗用电量]=A.nElectTotal,\n[上机温度]=A.nTemUp,\n[下机温度]=A.nTemDown,\n[码表读数]=A.nClockQtyDw,\n[上机时间]=CONVERT(VARCHAR(19),A.tCreateTime, 120),\n[下机时间]=CONVERT(VARCHAR(19),A.tOffTime, 120),\n[效率]= ROUND(A.nClockQtyDw / NULLIF(DATEDIFF(MINUTE,A.tCreateTime,A.tOffTime),0),2)\nFROM [HSTextileERP].dbo.psEneryRecord A(NOLOCK)\nINNER JOIN [HSTextileERP].dbo.psWorkFlowCard B(NOLOCK) ON A.upsWorkFlowCardGUID = B.uGUID\nINNER JOIN [HSTextileERP].dbo.psWorkCentreJob C(NOLOCK) ON B.upsWorkCentreJobGUID = C.uGUID\nINNER JOIN [HSTextileERP].dbo.sdOrderLot D(NOLOCK) ON C.usdOrderLotGUID = D.uGUID\nINNER JOIN [HSTextileERP].dbo.sdOrderDtl E(NOLOCK) ON E.uGUID = D.usdOrderDtlGUID\nINNER JOIN [HSTextileERP].dbo.sdOrderHdr F(NOLOCK) ON F.uGUID = E.usdOrderHdrGUID\nWHERE DATEDIFF(DAY,A.tCreateTime,GETDATE()) &lt;= 50\nORDER BY A.tCreateTime DESC', NULL, NULL);
INSERT INTO `api_sql` (`id`, `api_id`, `sql_text`, `transform_plugin`, `transform_plugin_params`) VALUES (554, '039bVy7j', 'SELECT\nrow_number() over(order by A.sEquipmentNo,A.tStartTime DESC ) as rownumber, \n[订单号]=B.sOrderNo,\n [品号]=D.sMaterialNo,\n [品名]=D.sMaterialName,\n [卡号]=A.sCardNo,\n [机台号]=sEquipmentNo,\n [开始时间]=CONVERT(VARCHAR(19),tStartTime, 120),\n [结束时间]=CONVERT(VARCHAR(19),tEndTime, 120),\n [运行时间(分钟)]=CONVERT(DECIMAL(9,2),nRunTime / 60),\n [停车时间(分钟)]=CONVERT(DECIMAL(9,2),nStopTime / 60),\n [总时间]=CONVERT(DECIMAL(9,2),A.nTotalTime / 60),\n [效率] = CONVERT(DECIMAL(9, 2), A.nRunTime / A.nTotalTime)\nFROM dbo.ppWarpRunRecord A WITH (NOLOCK)\n INNER JOIN HSTextileERP.dbo.psWeaveWorkFlowCard B WITH (NOLOCK)\n ON A.sCardNo = B.sCardNo\n INNER JOIN HSTextileERP.dbo.psWorkCentreJob C WITH (NOLOCK)\n ON B.upsWorkCentreJobGUID = C.uGUID\n INNER JOIN HSTextileERP.dbo.mmMaterial D WITH (NOLOCK)\n ON B.ummMaterialGUID = D.uGUID\n WHERE DATEDIFF(DAY,A.tEndTime,GETDATE()) &lt; 3\n AND A.nStopTime IS NOT NULL\nORDER BY A.sEquipmentNo,\n A.tStartTime DESC;', NULL, NULL);
INSERT INTO `api_sql` (`id`, `api_id`, `sql_text`, `transform_plugin`, `transform_plugin_params`) VALUES (555, 'YM5183P7', 'DELETE from trep_dkey_detail where bdate = CURRENT_DATE - 1;\nINSERT into trep_dkey_detail(tid,did,key,bdate,ctime,mtime,val,val_dep,val_arr)\nselect a.tid,a.did,a.key,a.bdate,\nmin(a.ctime),max(a.mtime),\n(to_number(min(val_arr), \'999999999999999.99\') + sum(a.value))::varchar as val,\n(to_number(min(val_arr), \'999999999999999.99\') + sum(a.value))::varchar as val_dep,\nmin(val_arr) as val_arr\nfrom \n(\nSELECT t.*,to_number(t.val_dep, \'999999999999999.9999\') - to_number(t.val_arr, \'999999999999999.9999\') as value \nfrom trep_group_detail t\nwhere t.bdate = CURRENT_DATE - 1\n) a\ngroup by a.tid,a.did,a.key,a.bdate;', NULL, NULL);
INSERT INTO `api_sql` (`id`, `api_id`, `sql_text`, `transform_plugin`, `transform_plugin_params`) VALUES (556, 'YM5183P7', 'update trep_dkey_detail \n set peak = ((to_number(trep_dkey_detail.val_dep,\'9999999999999999999.99\') - to_number(trep_dkey_detail.val_arr, \'9999999999999999999.99\')) -c.valley_ex )::varchar,\n valley = c.valley_ex\nfrom (\n select \n t.*,\n case when (to_number(val_dep,\'9999999999999999999.99\') - to_number(val_arr, \'9999999999999999999.99\')) - to_number(t.valley,\'9999999999999999999.99\') &gt;= 0 \n then to_number(t.valley,\'9999999999999999999.99\')\n else (to_number(val_dep,\'9999999999999999999.99\') - to_number(val_arr, \'9999999999999999999.99\')) * 0.3\n end as valley_ex\n from (\n SELECT t.tid,t.did,t.key,t.bdate,\n sum(to_number(t.valley, \'9999999999999999999.99\')) as valley\n from trep_hkey_detail t\n where CURRENT_DATE - 1 = t.bdate and\n t.key = \'electric\'\n GROUP BY t.tid,t.did,t.key,t.bdate\n ) c,trep_dkey_detail t\nwhere t.bdate = c.bdate and \n t.tid = c.tid and \n t.did = c.did and \n t.key = c.key and \n t.key = c.key ) c\n where trep_dkey_detail.bdate = c.bdate and \n trep_dkey_detail.tid = c.tid and \n trep_dkey_detail.did = c.did and \n trep_dkey_detail.key = c.key and \n trep_dkey_detail.key = c.key;\n \n \n \n ', NULL, NULL);
INSERT INTO `api_sql` (`id`, `api_id`, `sql_text`, `transform_plugin`, `transform_plugin_params`) VALUES (557, 'YM5183P7', 'DELETE from trep_dkey_detail where bdate = CURRENT_DATE;\nINSERT into trep_dkey_detail(tid,did,key,bdate,ctime,mtime,val,val_dep,val_arr)\nselect a.tid,a.did,a.key,a.bdate,\nmin(a.ctime),max(a.mtime),\n(to_number(min(val_arr), \'999999999999999.99\') + sum(a.value))::varchar as val,\n(to_number(min(val_arr), \'999999999999999.99\') + sum(a.value))::varchar as val_dep,\nmin(val_arr) as val_arr\nfrom \n(\nSELECT t.*,to_number(t.val_dep, \'999999999999999.9999\') - to_number(t.val_arr, \'999999999999999.9999\') as value \nfrom trep_group_detail t\nwhere t.bdate = CURRENT_DATE \n) a\ngroup by a.tid,a.did,a.key,a.bdate;', NULL, NULL);
INSERT INTO `api_sql` (`id`, `api_id`, `sql_text`, `transform_plugin`, `transform_plugin_params`) VALUES (558, 'YM5183P7', 'update trep_dkey_detail \n set peak = ((to_number(val_dep,\'9999999999999999999.99\') - to_number(val_arr, \'9999999999999999999.99\')) )::varchar,\n valley = \'0.00\'\n from (\n SELECT t.tid,t.did,t.key,t.bdate,\n sum(to_number(t.valley, \'9999999999999999999.99\')) as valley\n from trep_hkey_detail t\n where t.bdate = CURRENT_DATE and\n t.key = \'electric\'\n GROUP BY t.tid,t.did,t.key,t.bdate\n ) c\nwhere trep_dkey_detail.bdate = CURRENT_DATE and \n trep_dkey_detail.tid = c.tid and \n trep_dkey_detail.did = c.did and \n trep_dkey_detail.key = c.key and \n trep_dkey_detail.key = \'electric\';', NULL, NULL);
INSERT INTO `api_sql` (`id`, `api_id`, `sql_text`, `transform_plugin`, `transform_plugin_params`) VALUES (559, 'xfXpHIg0', 'SELECT to_number(t.val_dep,\'9999999999999999999.9999\') - to_number(t.val_arr, \'9999999999999999999.9999\') as value,\n b.name,c.descript,d.dname,d.grpname,\n t.bdate,to_char(t.ctime,\'yyyy-mm-dd hh24:mi:ss\') as ctime,to_char(t.mtime,\'yyyy-mm-dd hh24:mi:ss\') as mtime \n from trep_group_detail t,tcode_model_detail_ex b,tcode_group c ,vcode_key_detail d \n where t.tid = b.tid and \n t.tid = c.tid and \n t.tid = d.tid and \n t.did = d.did and \n t.key = d.key and \n t.grpcode = c.code and \n t.bdate::varchar = #{date}::varchar and \n (d.dname like concat(\'%\',#{deviceName},\'%\') or \'\' = #{deviceName}) and \n (b.name like concat(#{propName},\'%\') or \'\' = #{propName}) and \n (c.code = #{grpcode} or \'\' = #{grpcode}) and \n (d.grpname like concat(#{grptype},\'%\') or \'\' = #{grptype}) and \n b.code = \'all\' and \n d.grpname != \'\' and \n t.key = b.key and \n substr(b.ex_s1,3,1) = \'1\' and t.tid IN(SELECT tenant_id from hs_config_table where key=\'NANTAI_TENANT_BUSINESS\')', NULL, NULL);
INSERT INTO `api_sql` (`id`, `api_id`, `sql_text`, `transform_plugin`, `transform_plugin_params`) VALUES (576, '3qxDmpBG', 'INSERT into trep_group_detail(tid,did,key,bdate,grpcode,val_arr,val_dep,ctime,mtime)\n SELECT t.tid,t.did, t.key,c.tarr::date as bdate,\n c.code,t.val ,t.val,\n CURRENT_TIMESTAMP ,CURRENT_TIMESTAMP\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)::TEXT,\' \',t.dep)::TIMESTAMP as tdep,\n t.* from tcode_group t\n where t.dep &gt;= t.arr\n union\n SELECT CONCAT((CURRENT_DATE)::TEXT,\' \',t.arr)::TIMESTAMP as tarr,\n CONCAT((CURRENT_DATE+1)::TEXT,\' \',t.dep)::TIMESTAMP as tdep,\n t.* from tcode_group t\n where t.dep &lt; t.arr\n union\n SELECT CONCAT((CURRENT_DATE-1)::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.dep &lt; t.arr\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 b.code = \'default\' and \n t.key = b.key and \n b.day = true\n ON CONFLICT (tid,did,key,bdate,grpcode)\n DO UPDATE SET\n val_dep = EXCLUDED.val_dep,\n mtime = CURRENT_TIMESTAMP;\n \n ', NULL, NULL);
INSERT INTO `api_sql` (`id`, `api_id`, `sql_text`, `transform_plugin`, `transform_plugin_params`) VALUES (577, '3qxDmpBG', 'INSERT into trep_dkey_detail(tid,did,key,bdate,ctime,mtime,val,val_dep,val_arr)\nselect a.tid,a.did,a.key,a.bdate,\nmin(a.ctime),max(a.mtime),\n(to_number(min(val_arr), \'999999999999999.99\') + sum(a.value))::varchar as val,\n(to_number(min(val_arr), \'999999999999999.99\') + sum(a.value))::varchar as val_dep,\nmin(val_arr) as val_arr\nfrom \n(\nSELECT t.*,to_number(t.val_dep, \'999999999999999.9999\') - to_number(t.val_arr, \'999999999999999.9999\') as value \nfrom trep_group_detail t\nwhere t.bdate = CURRENT_DATE\n) a\ngroup by a.tid,a.did,a.key,a.bdate\nON CONFLICT (tid,did,key,bdate)\nDO UPDATE SET \nval = EXCLUDED.val,\nval_dep = EXCLUDED.val_dep,\nmtime = CURRENT_TIMESTAMP;\n', NULL, NULL);
INSERT INTO `api_sql` (`id`, `api_id`, `sql_text`, `transform_plugin`, `transform_plugin_params`) VALUES (578, 'TVCRetxT', 'SELECT * from device where name in (#{name})', NULL, NULL);
INSERT INTO `api_sql` (`id`, `api_id`, `sql_text`, `transform_plugin`, `transform_plugin_params`) VALUES (579, 'bw6ULlLe', 'begin;\nSELECT func05(\'cur_open\');\nfetch all in cur_open;\nend; ', NULL, NULL);
INSERT INTO `api_sql` (`id`, `api_id`, `sql_text`, `transform_plugin`, `transform_plugin_params`) VALUES (580, '5McuqqRW', 'SELECT a.sta,\n a.time,round((a.time/60),2) as minutes,concat((round((a.time/b.time_total),2)*100)::varchar,\'%\') as bl,\n a.descript,a.dname,a.grpname,\n a.ctime,a.mtime,b.time_total\nfrom \n(SELECT t.did,\n case \n when t.val = \'0\' then \'停机\'\n when t.val = \'1\' then \'运行\'\n when t.val = \'9\' then \'离线\'\n end as sta,\n sum(t.time) as time,\n c.descript,d.dname,d.grpname,\n to_char(min(t.ctime),\'yyyy-mm-dd hh24:mi:ss\') as ctime,to_char(max(t.mtime),\'yyyy-mm-dd hh24:mi:ss\') as mtime \n from trep_group_sta_detail t,tcode_group c ,vcode_key_detail d \n where \n t.tid = c.tid and \n t.tid = d.tid and \n t.tid = \'22eed190-39af-11ed-8d4e-1d9073a615c6\' and \n t.did = d.did and \n t.key = d.key and \n t.grpcode = c.code and \n (t.bdate BETWEEN date(#{startDate}) and date(#{endDate})) and \n (d.dname like concat(\'%\',#{deviceName},\'%\') or \'\' = #{deviceName}) and \n (c.code = #{grpcode} or \'\' = #{grpcode}) and \n (d.grpname like concat(#{grptype},\'%\') or \'\' = #{grptype}) and \n (\'\' = #{sta} or t.val=#{sta}) and \n d.grpname != \'\'\n group by t.did,t.val,c.descript,d.dname,d.grpname\n) a,\n(\nSELECT t.did,\n (sum(t.time)) as time_total,\n c.descript,d.dname,d.grpname\n from trep_group_sta_detail t,tcode_group c ,vcode_key_detail d \n where \n t.tid = c.tid and \n t.tid = d.tid and \n t.tid = \'22eed190-39af-11ed-8d4e-1d9073a615c6\' and \n t.did = d.did and \n t.key = d.key and \n t.grpcode = c.code and \n (t.bdate BETWEEN date(#{startDate}) and date(#{endDate})) and \n (d.dname like concat(\'%\',#{deviceName},\'%\') or \'\' = #{deviceName}) and \n (c.code = #{grpcode} or \'\' = #{grpcode}) and \n (d.grpname like concat(#{grptype},\'%\') or \'\' = #{grptype}) and \n d.grpname != \'\'\n GROUP BY t.did,c.descript,d.dname,d.grpname\n order by t.did\n) b \nwhere a.did = b.did and \n a.descript = b.descript and \n a.dname = b.dname\n order by a.grpname,a.descript,a.dname\n \n', NULL, NULL);
INSERT INTO `api_sql` (`id`, `api_id`, `sql_text`, `transform_plugin`, `transform_plugin_params`) VALUES (581, 'HtgA8FbR', 'SELECT a.sta,\n a.time,round((a.time/60),2) as minutes,concat((round((a.time/b.time_total),2)*100)::varchar,\'%\') as bl,\n a.descript,a.dname,a.grpname,\n a.ctime,a.mtime,b.time_total\nfrom \n(SELECT t.did,\n case \n when t.val = \'0\' then \'停机\'\n when t.val = \'1\' then \'运行\'\n when t.val = \'9\' then \'离线\'\n end as sta,\n sum(t.time) as time,\n c.descript,d.dname,d.grpname,\n to_char(min(t.ctime),\'yyyy-mm-dd hh24:mi:ss\') as ctime,to_char(max(t.mtime),\'yyyy-mm-dd hh24:mi:ss\') as mtime \n from trep_group_sta_detail t,tcode_group c ,vcode_key_detail d \n where \n t.tid = c.tid and \n t.tid = d.tid and \n t.tid = \'22eed190-39af-11ed-8d4e-1d9073a615c6\' and \n t.did = d.did and \n t.key = d.key and \n t.grpcode = c.code and \n (t.bdate BETWEEN date(#{startDate}) and date(#{endDate})) and \n (d.dname like concat(\'%\',#{deviceName},\'%\') or \'\' = #{deviceName}) and \n (c.code = #{grpcode} or \'\' = #{grpcode}) and \n (d.grpname like concat(#{grptype},\'%\') or \'\' = #{grptype}) and \n (\'\' = #{sta} or t.val=#{sta}) and \n d.grpname != \'\'\n group by t.did,t.val,c.descript,d.dname,d.grpname\n) a,\n(\nSELECT t.did,\n (sum(t.time)) as time_total,\n c.descript,d.dname,d.grpname\n from trep_group_sta_detail t,tcode_group c ,vcode_key_detail d \n where \n t.tid = c.tid and \n t.tid = d.tid and \n t.tid = \'22eed190-39af-11ed-8d4e-1d9073a615c6\' and \n t.did = d.did and \n t.key = d.key and \n t.grpcode = c.code and \n (t.bdate BETWEEN date(#{startDate}) and date(#{endDate})) and \n (d.dname like concat(\'%\',#{deviceName},\'%\') or \'\' = #{deviceName}) and \n (c.code = #{grpcode} or \'\' = #{grpcode}) and \n (d.grpname like concat(#{grptype},\'%\') or \'\' = #{grptype}) and \n d.grpname != \'\'\n GROUP BY t.did,c.descript,d.dname,d.grpname\n order by t.did\n) b \nwhere a.did = b.did and \n a.descript = b.descript and \n a.dname = b.dname\n order by a.grpname,a.descript,a.dname\n', NULL, NULL);
INSERT INTO `api_sql` (`id`, `api_id`, `sql_text`, `transform_plugin`, `transform_plugin_params`) VALUES (582, '0qLjHowN', 'SELECT t.*,\n d.fid,d.fname,d.wid,d.wname,d.grpid,d.grpname,d.gid,d.gname,d.dname,d.volume_on_day \n from trep_group_sta_detail t,tcode_group c ,vcode_key_detail d \n where t.tid = d.tid and \n t.tid = \'22eed190-39af-11ed-8d4e-1d9073a615c6\' and \n t.tid = c.tid and \n t.tid = d.tid and \n t.key = d.key and \n t.did = d.did and \n t.grpcode = c.code and \n t.bdate::varchar = #{date}::varchar and \n (d.dname like concat(#{deviceName},\'%\') or \'\' = #{deviceName}) and \n (c.code = #{grpcode} or \'\' = #{grpcode}) and \n (d.grpname like concat(#{grptype},\'%\') or \'\' = #{grptype}) and \n d.grpname != \'\' ;', NULL, NULL);
INSERT INTO `api_sql` (`id`, `api_id`, `sql_text`, `transform_plugin`, `transform_plugin_params`) VALUES (586, 'MsRKsiUV', 'SELECT a.* ,d.dname,date_part(\'min\',a.dep - a.arr) as times\nfrom \n(\n\n SELECT tid,did,key,val_arr as val ,ctime as arr,mtime as dep from trep_sta_detail t \n where t.tid = \'22eed190-39af-11ed-8d4e-1d9073a615c6\'\n UNION all \n SELECT tid,did,key,val,arr,dep from trep_hsta_detail t \n where t.tid = \'22eed190-39af-11ed-8d4e-1d9073a615c6\' and \n #{bdate}::date BETWEEN date(t.arr) and date(t.dep)\n \n) a,vcode_key_detail d\nwhere a.tid = d.tid and \n a.did = d.did and \n a.key = d.key and \n (d.dname like concat(\'%\',#{deviceName},\'%\') or \'\' = #{deviceName}) and \n (d.grpname like concat(#{grptype},\'%\') or \'\' = #{grptype}) and \n (\'\' = #{sta} or a.val=#{sta}) \norder by a.tid,a.did,a.arr\n\n\n\n', NULL, NULL);
INSERT INTO `api_sql` (`id`, `api_id`, `sql_text`, `transform_plugin`, `transform_plugin_params`) VALUES (591, 'yBjFp1tx', 'SELECT to_number(t.val_dep,\'9999999999999999999.9999\') - to_number(t.val_arr, \'9999999999999999999.9999\') as value,\n b.val as name ,c.descript,d.dname,d.grpname,\n t.bdate,to_char(t.ctime,\'yyyy-mm-dd hh24:mi:ss\') as ctime,to_char(t.mtime,\'yyyy-mm-dd hh24:mi:ss\') as mtime \n from trep_group_detail t,tcode_model_detail b,tcode_group c ,vcode_key_detail d \n where t.tid = b.tenant_id and \n t.tid = c.tid and \n t.tid = d.tid and \n t.did = d.did and \n t.key = d.key and \n t.grpcode = c.code and \n t.tid::varchar = #{tid} and \n t.bdate::varchar = #{date}::varchar and \n (d.dname like concat(\'%\',#{deviceName},\'%\') or \'\' = #{deviceName}) and \n (b.val like concat(#{propName},\'%\') or \'\' = #{propName}) and \n (c.code = #{grpcode} or \'\' = #{grpcode}) and \n (d.grpname like concat(#{grptype},\'%\') or \'\' = #{grptype}) and \n b.code = \'default\' and \n d.grpname != \'\' and \n t.key = b.key and \n b.hour = true\n \n \n ', NULL, NULL);
INSERT INTO `api_sql` (`id`, `api_id`, `sql_text`, `transform_plugin`, `transform_plugin_params`) VALUES (593, '7BlefeCW', 'update hs_device_extension set sort = 1000\nwhere sort is null \n', NULL, NULL);
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);
COMMIT;
CREATE TABLE `datasource` -- ----------------------------
( -- Table structure for datasource
-- ----------------------------
DROP TABLE IF EXISTS `datasource`;
CREATE TABLE `datasource` (
`id` varchar(255) NOT NULL, `id` varchar(255) NOT NULL,
`name` varchar(255) DEFAULT NULL, `name` varchar(255) DEFAULT NULL,
`note` varchar(255) DEFAULT NULL, `note` varchar(255) DEFAULT NULL,
...@@ -76,64 +270,116 @@ CREATE TABLE `datasource` ...@@ -76,64 +270,116 @@ CREATE TABLE `datasource`
`create_time` varchar(20) DEFAULT NULL, `create_time` varchar(20) DEFAULT NULL,
`update_time` varchar(20) DEFAULT NULL, `update_time` varchar(20) DEFAULT NULL,
PRIMARY KEY (`id`) PRIMARY KEY (`id`)
) ENGINE = InnoDB ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3;
DEFAULT CHARSET = utf8;
-- ----------------------------
-- Records of datasource
-- ----------------------------
BEGIN;
DROP TABLE IF EXISTS `firewall`; INSERT INTO `datasource` (`id`, `name`, `note`, `type`, `url`, `username`, `password`, `driver`, `table_sql`, `create_time`, `update_time`) VALUES ('EhgozRdv', 'V3-测试环境', '', 'postgresql', 'jdbc:postgresql://121.199.175.235:30433/hsiotdb', 'postgres', 'ZeDk5+VSpaKseaGVpkfEcA==', 'org.postgresql.Driver', 'SELECT table_name FROM information_schema.tables WHERE table_schema = \'public\' ORDER BY table_name', '2022-09-24 23:19:12', '2022-09-24 23:19:12');
INSERT INTO `datasource` (`id`, `name`, `note`, `type`, `url`, `username`, `password`, `driver`, `table_sql`, `create_time`, `update_time`) VALUES ('kSC2Qziy', '物联平台V3生产', '', 'postgresql', 'jdbc:postgresql://tb-database:5432/hsiotdb', 'postgres', 'ts2vZv9vtxKjgaowDq1fOw==', 'org.postgresql.Driver', 'SELECT table_name FROM information_schema.tables WHERE table_schema = \'public\' ORDER BY table_name', '2022-09-23 12:30:22', '2023-03-06 18:11:39');
COMMIT;
CREATE TABLE `firewall` -- ----------------------------
( -- Table structure for firewall
-- ----------------------------
DROP TABLE IF EXISTS `firewall`;
CREATE TABLE `firewall` (
`status` varchar(255) DEFAULT NULL, `status` varchar(255) DEFAULT NULL,
`mode` varchar(255) DEFAULT NULL `mode` varchar(255) DEFAULT NULL
) ENGINE = InnoDB ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3;
DEFAULT CHARSET = utf8;
-- ----------------------------
-- Records of firewall
-- ----------------------------
BEGIN;
INSERT INTO `firewall` (`status`, `mode`) VALUES ('off', 'black');
COMMIT;
-- ----------------------------
-- Table structure for ip_rules
-- ----------------------------
DROP TABLE IF EXISTS `ip_rules`; DROP TABLE IF EXISTS `ip_rules`;
CREATE TABLE `ip_rules` (
CREATE TABLE `ip_rules`
(
`type` varchar(255) DEFAULT NULL, `type` varchar(255) DEFAULT NULL,
`ip` varchar(10240) DEFAULT NULL `ip` varchar(10240) DEFAULT NULL
) ENGINE = InnoDB ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3;
DEFAULT CHARSET = utf8;
-- ----------------------------
-- Records of ip_rules
-- ----------------------------
BEGIN;
INSERT INTO `ip_rules` (`type`, `ip`) VALUES ('white', NULL);
INSERT INTO `ip_rules` (`type`, `ip`) VALUES ('black', NULL);
COMMIT;
DROP TABLE IF EXISTS `token`; -- ----------------------------
-- Table structure for process_api_detail
-- ----------------------------
DROP TABLE IF EXISTS `process_api_detail`;
CREATE TABLE `process_api_detail` (
`id` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL COMMENT '标识',
`api_id` varchar(255) NOT NULL COMMENT 'api标识',
`input_param` json DEFAULT NULL COMMENT '入参',
`output_param` json DEFAULT NULL COMMENT '出参',
`sort` tinyint NOT NULL COMMENT '排序',
`create_time` varchar(20) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL COMMENT '创建时间\n',
`update_time` varchar(20) DEFAULT NULL COMMENT '修改时间',
`process_api_id` varchar(255) DEFAULT NULL COMMENT '流程api标识',
PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COMMENT='流程API';
CREATE TABLE `token` -- ----------------------------
( -- Records of process_api_detail
`id` int(11) NOT NULL AUTO_INCREMENT, -- ----------------------------
BEGIN;
INSERT INTO `process_api_detail` (`id`, `api_id`, `input_param`, `output_param`, `sort`, `create_time`, `update_time`, `process_api_id`) VALUES ('kdlNlK8U', 'h0dCv9PK', '[]', NULL, 10, '2023-04-26 10:23:13', '2023-04-26 10:23:13', '4nITQagX');
INSERT INTO `process_api_detail` (`id`, `api_id`, `input_param`, `output_param`, `sort`, `create_time`, `update_time`, `process_api_id`) VALUES ('pUxHbDrY', 'F9Y3ZjqK', '[{\"name\": \"factory_id\", \"note\": \"工厂id\", \"type\": \"string\"}, {\"name\": \"workshop_id\", \"note\": \"车间id集合\", \"type\": \"Array<string>\"}]', '{}', 1, '2023-02-23 14:59:55', '2023-02-23 14:59:55', 'F9Y3ZjqK');
INSERT INTO `process_api_detail` (`id`, `api_id`, `input_param`, `output_param`, `sort`, `create_time`, `update_time`, `process_api_id`) VALUES ('TUyyTUsW', 'kNU3EDud', '[{\"name\": \"val\", \"note\": \"最新值\", \"type\": \"string\"}]', NULL, 20, '2023-04-26 10:23:13', '2023-04-26 10:23:13', '4nITQagX');
INSERT INTO `process_api_detail` (`id`, `api_id`, `input_param`, `output_param`, `sort`, `create_time`, `update_time`, `process_api_id`) VALUES ('V8Ciuvnl', 'AQQK2Ega', '[{\"name\": \"tenant_id\", \"note\": \"tenant_id\", \"type\": \"string\"}]', '{}', 3, '2023-02-23 14:59:55', '2023-02-23 14:59:55', 'F9Y3ZjqK');
INSERT INTO `process_api_detail` (`id`, `api_id`, `input_param`, `output_param`, `sort`, `create_time`, `update_time`, `process_api_id`) VALUES ('V8Ciuvnn', 'soWGWcwj', '[{\"name\": \"factory_id\", \"note\": \"工厂id\", \"type\": \"string\"}]', '{}', 1, '2023-02-23 14:59:55', '2023-02-23 14:59:55', '');
INSERT INTO `process_api_detail` (`id`, `api_id`, `input_param`, `output_param`, `sort`, `create_time`, `update_time`, `process_api_id`) VALUES ('V8Ciuvnw', 'ZwOIf9HG', '[{\"name\": \"workshop_id\", \"note\": \"车间id集合\", \"type\": \"Array<string>\"}]', '{}', 2, '2023-02-23 14:59:55', '2023-02-23 14:59:55', 'F9Y3ZjqK');
COMMIT;
-- ----------------------------
-- Table structure for token
-- ----------------------------
DROP TABLE IF EXISTS `token`;
CREATE TABLE `token` (
`id` int NOT NULL AUTO_INCREMENT,
`token` varchar(255) DEFAULT NULL, `token` varchar(255) DEFAULT NULL,
`note` varchar(255) DEFAULT NULL, `note` varchar(255) DEFAULT NULL,
`expire` bigint(20) DEFAULT NULL, `expire` bigint DEFAULT NULL,
`create_time` bigint(20) DEFAULT NULL, `create_time` bigint DEFAULT NULL,
PRIMARY KEY (`id`) PRIMARY KEY (`id`)
) ENGINE = InnoDB ) ENGINE=InnoDB AUTO_INCREMENT=3 DEFAULT CHARSET=utf8mb3;
AUTO_INCREMENT = 1
DEFAULT CHARSET = utf8;
-- ----------------------------
-- Records of token
-- ----------------------------
BEGIN;
INSERT INTO `token` (`id`, `token`, `note`, `expire`, `create_time`) VALUES (1, '6f3ec539d2ad4d08384e9c1f080e2eda', '', NULL, 1663984118254);
INSERT INTO `token` (`id`, `token`, `note`, `expire`, `create_time`) VALUES (2, 'a4359cffacda5d0f24d11af4e6952312', '南泰君霖', NULL, 1668485985478);
COMMIT;
-- ----------------------------
-- Table structure for user
-- ----------------------------
DROP TABLE IF EXISTS `user`; DROP TABLE IF EXISTS `user`;
CREATE TABLE `user` (
CREATE TABLE `user` `id` int NOT NULL AUTO_INCREMENT,
(
`id` int(11) NOT NULL AUTO_INCREMENT,
`username` varchar(255) DEFAULT NULL, `username` varchar(255) DEFAULT NULL,
`password` varchar(255) DEFAULT NULL, `password` varchar(255) DEFAULT NULL,
PRIMARY KEY (`id`), PRIMARY KEY (`id`),
UNIQUE KEY `username` (`username`) UNIQUE KEY `username` (`username`)
) ENGINE = InnoDB ) ENGINE=InnoDB AUTO_INCREMENT=2 DEFAULT CHARSET=utf8mb3;
AUTO_INCREMENT = 1
DEFAULT CHARSET = utf8;
insert into `firewall`(`status`, `mode`)
values ('off', 'black');
insert into `ip_rules`(`type`, `ip`) -- ----------------------------
values ('white', NULL), -- Records of user
('black', NULL); -- ----------------------------
BEGIN;
INSERT INTO `user` (`id`, `username`, `password`) VALUES (1, 'admin', 'admin');
COMMIT;
insert into `user`(`id`, `username`, `password`) SET FOREIGN_KEY_CHECKS = 1;
values (1, 'admin', 'admin');
\ No newline at end of file
This source diff could not be displayed because it is too large. You can view the blob instead.
/*
Navicat Premium Data Transfer
Source Server : 47.96.236.169
Source Server Type : MySQL
Source Server Version : 80028
Source Host : 47.96.236.169:33306
Source Schema : iot_job
Target Server Type : MySQL
Target Server Version : 80028
File Encoding : 65001
Date: 28/11/2022 19:52:07
*/
SET NAMES utf8mb4;
SET FOREIGN_KEY_CHECKS = 0;
-- ----------------------------
-- Table structure for hs_api_job
-- ----------------------------
DROP TABLE IF EXISTS `hs_api_job`;
CREATE TABLE `hs_api_job` (
`id` int NOT NULL AUTO_INCREMENT,
`job_id` int NOT NULL COMMENT '任务标识',
`api_id` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NOT NULL COMMENT 'api标识',
`update_time` datetime NULL DEFAULT NULL,
PRIMARY KEY (`id`) USING BTREE
) ENGINE = InnoDB AUTO_INCREMENT = 29 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_0900_ai_ci COMMENT = 'Api调度任务';
-- ----------------------------
-- Records of hs_api_job
-- ----------------------------
BEGIN;
INSERT INTO `hs_api_job` (`id`, `job_id`, `api_id`, `update_time`) VALUES (1, 2, 'j0BpIQhp', '2022-09-23 12:32:13'), (2, 3, '9xFhax2y', '2022-09-24 08:05:07'), (3, 4, 'UDzGSkeZ', '2022-09-24 09:24:21'), (4, 5, 'CQ9VkAr9', '2022-09-24 09:49:48'), (5, 6, 'bw6ULlLe', '2022-09-24 23:20:41'), (6, 7, 'N8sgjOWD', '2022-09-25 22:26:44'), (7, 8, 'tCoVivD8', '2022-09-26 13:38:16'), (8, 9, 'O3KlnSsU', '2022-09-26 14:05:34'), (9, 10, 'EnFpExkx', '2022-09-27 23:30:01'), (10, 11, 'K4QZT40A', '2022-09-28 14:49:53'), (11, 12, '3qxDmpBG', '2022-09-29 14:32:10'), (12, 13, 'xfXpHIg0', '2022-09-29 15:11:37'), (13, 14, 'hGLKRYiu', '2022-10-09 23:36:54'), (14, 15, 'kU15HMrE', '2022-10-10 11:38:43'), (15, 16, '5SeUCRJy', '2022-10-10 12:27:08'), (16, 17, 'wFz52Yb1', '2022-10-10 12:30:16'), (17, 18, 'B1ANmtET', '2022-10-16 00:45:28'), (18, 19, '7TVjkWPy', '2022-11-02 16:48:27'), (19, 20, 'IHQJLVtr', '2022-11-03 17:42:59'), (20, 21, 'HYORZYyI', '2022-11-03 17:43:35'), (21, 22, 'VyCtYO0f', '2022-11-03 18:39:46'), (22, 23, 'EeBkndxU', '2022-11-12 13:35:21'), (23, 24, 'FNMVwfcu', '2022-11-12 13:36:01'), (24, 25, 'RSuNGzhs', '2022-11-12 13:36:37'), (25, 26, 'cD4sCi7I', '2022-11-15 13:25:47'), (26, 27, '0qLjHowN', '2022-11-15 13:55:43'), (27, 28, 'v7p2AAqp', '2022-11-15 14:26:00'), (28, 29, 'pjYii91f', '2022-11-16 02:05:50');
COMMIT;
-- ----------------------------
-- Table structure for xxl_job_group
-- ----------------------------
DROP TABLE IF EXISTS `xxl_job_group`;
CREATE TABLE `xxl_job_group` (
`id` int NOT NULL AUTO_INCREMENT,
`app_name` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NOT NULL COMMENT '执行器AppName',
`title` varchar(12) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NOT NULL COMMENT '执行器名称',
`address_type` tinyint NOT NULL DEFAULT 0 COMMENT '执行器地址类型:0=自动注册、1=手动录入',
`address_list` text CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL COMMENT '执行器地址列表,多地址逗号分隔',
`update_time` datetime NULL DEFAULT NULL,
PRIMARY KEY (`id`) USING BTREE
) ENGINE = InnoDB AUTO_INCREMENT = 5 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_0900_ai_ci;
-- ----------------------------
-- Records of xxl_job_group
-- ----------------------------
BEGIN;
INSERT INTO `xxl_job_group` (`id`, `app_name`, `title`, `address_type`, `address_list`, `update_time`) VALUES (1, 'xxl-job-executor-sample', '示例执行器', 0, NULL, '2022-11-28 19:51:54'), (4, 'dbapi-job-executor', 'dbapi', 0, 'http://10.227.8.243:8888/', '2022-11-28 19:51:54');
COMMIT;
-- ----------------------------
-- Table structure for xxl_job_info
-- ----------------------------
DROP TABLE IF EXISTS `xxl_job_info`;
CREATE TABLE `xxl_job_info` (
`id` int NOT NULL AUTO_INCREMENT,
`job_group` int NOT NULL COMMENT '执行器主键ID',
`job_desc` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NOT NULL,
`add_time` datetime NULL DEFAULT NULL,
`update_time` datetime NULL DEFAULT NULL,
`author` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL COMMENT '作者',
`alarm_email` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL COMMENT '报警邮件',
`schedule_type` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NOT NULL DEFAULT 'NONE' COMMENT '调度类型',
`schedule_conf` varchar(128) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL COMMENT '调度配置,值含义取决于调度类型',
`misfire_strategy` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NOT NULL DEFAULT 'DO_NOTHING' COMMENT '调度过期策略',
`executor_route_strategy` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL COMMENT '执行器路由策略',
`executor_handler` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL COMMENT '执行器任务handler',
`executor_param` varchar(512) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL COMMENT '执行器任务参数',
`executor_block_strategy` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL COMMENT '阻塞处理策略',
`executor_timeout` int NOT NULL DEFAULT 0 COMMENT '任务执行超时时间,单位秒',
`executor_fail_retry_count` int NOT NULL DEFAULT 0 COMMENT '失败重试次数',
`glue_type` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NOT NULL COMMENT 'GLUE类型',
`glue_source` mediumtext CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL COMMENT 'GLUE源代码',
`glue_remark` varchar(128) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL COMMENT 'GLUE备注',
`glue_updatetime` datetime NULL DEFAULT NULL COMMENT 'GLUE更新时间',
`child_jobid` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL COMMENT '子任务ID,多个逗号分隔',
`trigger_status` tinyint NOT NULL DEFAULT 0 COMMENT '调度状态:0-停止,1-运行',
`trigger_last_time` bigint NOT NULL DEFAULT 0 COMMENT '上次调度时间',
`trigger_next_time` bigint NOT NULL DEFAULT 0 COMMENT '下次调度时间',
PRIMARY KEY (`id`) USING BTREE
) ENGINE = InnoDB AUTO_INCREMENT = 30 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_0900_ai_ci;
-- ----------------------------
-- Table structure for xxl_job_lock
-- ----------------------------
DROP TABLE IF EXISTS `xxl_job_lock`;
CREATE TABLE `xxl_job_lock` (
`lock_name` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NOT NULL COMMENT '锁名称',
PRIMARY KEY (`lock_name`) USING BTREE
) ENGINE = InnoDB CHARACTER SET = utf8mb4 COLLATE = utf8mb4_0900_ai_ci;
-- ----------------------------
-- Records of xxl_job_lock
-- ----------------------------
BEGIN;
INSERT INTO `xxl_job_lock` (`lock_name`) VALUES ('schedule_lock');
COMMIT;
-- ----------------------------
-- Table structure for xxl_job_log_report
-- ----------------------------
DROP TABLE IF EXISTS `xxl_job_log_report`;
CREATE TABLE `xxl_job_log_report` (
`id` int NOT NULL AUTO_INCREMENT,
`trigger_day` datetime NULL DEFAULT NULL COMMENT '调度-时间',
`running_count` int NOT NULL DEFAULT 0 COMMENT '运行中-日志数量',
`suc_count` int NOT NULL DEFAULT 0 COMMENT '执行成功-日志数量',
`fail_count` int NOT NULL DEFAULT 0 COMMENT '执行失败-日志数量',
`update_time` datetime NULL DEFAULT NULL,
PRIMARY KEY (`id`) USING BTREE,
UNIQUE INDEX `i_trigger_day`(`trigger_day` ASC) USING BTREE
) ENGINE = InnoDB AUTO_INCREMENT = 72 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_0900_ai_ci;
-- ----------------------------
-- Records of xxl_job_log_report
-- ----------------------------
BEGIN;
INSERT INTO `xxl_job_log_report` (`id`, `trigger_day`, `running_count`, `suc_count`, `fail_count`, `update_time`) VALUES (1, '2022-09-21 00:00:00', 0, 0, 0, NULL), (2, '2022-09-20 00:00:00', 0, 0, 0, NULL), (3, '2022-09-19 00:00:00', 0, 0, 0, NULL), (4, '2022-09-22 00:00:00', 0, 0, 0, NULL), (5, '2022-09-23 00:00:00', 0, 0, 0, NULL), (6, '2022-09-24 00:00:00', 0, 7071, 7, NULL), (7, '2022-09-25 00:00:00', 0, 8897, 28, NULL), (8, '2022-09-26 00:00:00', 0, 14564, 0, NULL), (9, '2022-09-27 00:00:00', 0, 26208, 0, NULL), (10, '2022-09-28 00:00:00', 0, 26208, 0, NULL), (11, '2022-09-29 00:00:00', 0, 29611, 0, NULL), (12, '2022-09-30 00:00:00', 0, 34848, 0, NULL), (13, '2022-10-01 00:00:00', 0, 34848, 0, NULL), (14, '2022-10-02 00:00:00', 0, 34848, 0, NULL), (15, '2022-10-03 00:00:00', 0, 34848, 0, NULL), (16, '2022-10-04 00:00:00', 0, 34848, 0, NULL), (17, '2022-10-05 00:00:00', 0, 34848, 0, NULL), (18, '2022-10-06 00:00:00', 0, 34848, 0, NULL), (19, '2022-10-07 00:00:00', 0, 34848, 0, NULL), (20, '2022-10-08 00:00:00', 0, 34848, 0, NULL), (21, '2022-10-09 00:00:00', 0, 22853, 11997, NULL), (22, '2022-10-10 00:00:00', 0, 24517, 10331, NULL), (23, '2022-10-11 00:00:00', 0, 34848, 0, NULL), (24, '2022-10-12 00:00:00', 0, 34848, 0, NULL), (25, '2022-10-13 00:00:00', 0, 34848, 0, NULL), (26, '2022-10-14 00:00:00', 0, 34848, 0, NULL), (27, '2022-10-15 00:00:00', 0, 34848, 0, NULL), (28, '2022-10-16 00:00:00', 0, 39029, 0, NULL), (29, '2022-10-17 00:00:00', 0, 39168, 0, NULL), (30, '2022-10-18 00:00:00', 0, 39168, 0, NULL), (31, '2022-10-19 00:00:00', 0, 39168, 0, NULL), (32, '2022-10-20 00:00:00', 0, 38117, 0, NULL), (33, '2022-10-21 00:00:00', 0, 30240, 0, NULL), (34, '2022-10-22 00:00:00', 0, 30240, 0, NULL), (35, '2022-10-23 00:00:00', 0, 30240, 0, NULL), (36, '2022-10-24 00:00:00', 0, 30240, 0, NULL), (37, '2022-10-25 00:00:00', 0, 30240, 0, NULL), (38, '2022-10-26 00:00:00', 1253, 28987, 0, NULL), (39, '2022-10-27 00:00:00', 8640, 21600, 0, NULL), (40, '2022-10-28 00:00:00', 8640, 21600, 0, NULL), (41, '2022-10-29 00:00:00', 8640, 21600, 0, NULL), (42, '2022-10-30 00:00:00', 8640, 21600, 0, NULL), (43, '2022-10-31 00:00:00', 0, 21600, 0, NULL), (44, '2022-11-01 00:00:00', 0, 21600, 0, NULL), (45, '2022-11-02 00:00:00', 0, 22447, 0, NULL), (46, '2022-11-03 00:00:00', 0, 24480, 0, NULL), (47, '2022-11-04 00:00:00', 0, 24480, 0, NULL), (48, '2022-11-05 00:00:00', 0, 24480, 0, NULL), (49, '2022-11-06 00:00:00', 0, 24480, 0, NULL), (50, '2022-11-07 00:00:00', 3, 24450, 27, NULL), (51, '2022-11-08 00:00:00', 0, 24480, 0, NULL), (52, '2022-11-09 00:00:00', 0, 24480, 0, NULL), (53, '2022-11-10 00:00:00', 0, 24480, 0, NULL), (54, '2022-11-11 00:00:00', 0, 24480, 0, NULL), (55, '2022-11-12 00:00:00', 0, 30087, 0, NULL), (56, '2022-11-13 00:00:00', 0, 37440, 0, NULL), (57, '2022-11-14 00:00:00', 0, 37440, 0, NULL), (58, '2022-11-15 00:00:00', 0, 36956, 0, NULL), (59, '2022-11-16 00:00:00', 0, 38501, 0, NULL), (60, '2022-11-17 00:00:00', 0, 38880, 0, NULL), (61, '2022-11-18 00:00:00', 0, 38822, 58, NULL), (62, '2022-11-19 00:00:00', 0, 38880, 0, NULL), (63, '2022-11-20 00:00:00', 0, 38880, 0, NULL), (64, '2022-11-21 00:00:00', 0, 38880, 0, NULL), (65, '2022-11-22 00:00:00', 0, 38880, 0, NULL), (66, '2022-11-23 00:00:00', 0, 38880, 0, NULL), (67, '2022-11-24 00:00:00', 0, 38880, 0, NULL), (68, '2022-11-25 00:00:00', 0, 38880, 0, NULL), (69, '2022-11-26 00:00:00', 0, 38880, 0, NULL), (70, '2022-11-27 00:00:00', 0, 38880, 0, NULL), (71, '2022-11-28 00:00:00', 0, 32191, 0, NULL);
COMMIT;
-- ----------------------------
-- Table structure for xxl_job_logglue
-- ----------------------------
DROP TABLE IF EXISTS `xxl_job_logglue`;
CREATE TABLE `xxl_job_logglue` (
`id` int NOT NULL AUTO_INCREMENT,
`job_id` int NOT NULL COMMENT '任务,主键ID',
`glue_type` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL COMMENT 'GLUE类型',
`glue_source` mediumtext CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL COMMENT 'GLUE源代码',
`glue_remark` varchar(128) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NOT NULL COMMENT 'GLUE备注',
`add_time` datetime NULL DEFAULT NULL,
`update_time` datetime NULL DEFAULT NULL,
PRIMARY KEY (`id`) USING BTREE
) ENGINE = InnoDB AUTO_INCREMENT = 1 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_0900_ai_ci;
-- ----------------------------
-- Records of xxl_job_logglue
-- ----------------------------
BEGIN;
COMMIT;
-- ----------------------------
-- Table structure for xxl_job_registry
-- ----------------------------
DROP TABLE IF EXISTS `xxl_job_registry`;
CREATE TABLE `xxl_job_registry` (
`id` int NOT NULL AUTO_INCREMENT,
`registry_group` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NOT NULL,
`registry_key` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NOT NULL,
`registry_value` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NOT NULL,
`update_time` datetime NULL DEFAULT NULL,
PRIMARY KEY (`id`) USING BTREE,
INDEX `i_g_k_v`(`registry_group` ASC, `registry_key` ASC, `registry_value` ASC) USING BTREE
) ENGINE = InnoDB AUTO_INCREMENT = 14 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_0900_ai_ci;
-- ----------------------------
-- Records of xxl_job_registry
-- ----------------------------
BEGIN;
INSERT INTO `xxl_job_registry` (`id`, `registry_group`, `registry_key`, `registry_value`, `update_time`) VALUES (13, 'EXECUTOR', 'dbapi-job-executor', 'http://10.227.8.243:8888/', '2022-11-28 19:51:51');
COMMIT;
-- ----------------------------
-- Table structure for xxl_job_user
-- ----------------------------
DROP TABLE IF EXISTS `xxl_job_user`;
CREATE TABLE `xxl_job_user` (
`id` int NOT NULL AUTO_INCREMENT,
`username` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NOT NULL COMMENT '账号',
`password` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NOT NULL COMMENT '密码',
`role` tinyint NOT NULL COMMENT '角色:0-普通用户、1-管理员',
`permission` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL COMMENT '权限:执行器ID列表,多个逗号分割',
PRIMARY KEY (`id`) USING BTREE,
UNIQUE INDEX `i_username`(`username` ASC) USING BTREE
) ENGINE = InnoDB AUTO_INCREMENT = 2 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_0900_ai_ci;
-- ----------------------------
-- Records of xxl_job_user
-- ----------------------------
BEGIN;
INSERT INTO `xxl_job_user` (`id`, `username`, `password`, `role`, `permission`) VALUES (1, 'admin', 'e10adc3949ba59abbe56e057f20f883e', 1, NULL);
COMMIT;
SET FOREIGN_KEY_CHECKS = 1;
ALTER TABLE "public"."hs_board_manage" ADD COLUMN "sort" int4 DEFAULT 0;
COMMENT ON COLUMN "public"."hs_board_manage"."sort" IS '排序值';
ALTER TABLE "public"."hs_last_expand_extension" ALTER COLUMN "volume_on_history" SET NOT NULL;
COMMENT ON COLUMN "public"."hs_last_expand_extension"."volume_on_history" IS '';
ALTER TABLE "public"."hs_user_extension" ALTER COLUMN "registrate_applet" DROP DEFAULT;
CREATE TABLE "public"."tb_tenant_menu_role" (
"id" uuid NOT NULL,
"created_time" int8,
"created_user" uuid,
"tenant_id" uuid,
"updated_time" int8,
"updated_user" uuid,
"remark" varchar(255) COLLATE "pg_catalog"."default",
"tenant_menu_id" uuid,
"tenant_sys_role_id" uuid,
"flg" varchar(255) COLLATE "pg_catalog"."default",
CONSTRAINT "tb_tenant_menu_role_pkey" PRIMARY KEY ("id")
)
;
ALTER TABLE "public"."tb_tenant_menu_role" OWNER TO "postgres";
ALTER TABLE "public"."tcode_base" ALTER COLUMN "created_time" SET DEFAULT 0;
ALTER TABLE "public"."tcode_base" ALTER COLUMN "updated_time" SET DEFAULT 0;
ALTER TABLE "public"."tcode_device" DROP CONSTRAINT "tcode_device_did_mcode_tenant_id_key";
ALTER TABLE "public"."tcode_device" ADD CONSTRAINT "tcode_device_mcode_tenant_id_did_key" UNIQUE ("mcode", "tenant_id", "did");
ALTER TABLE "public"."tcode_group" ADD CONSTRAINT "tcode_group_pkey" PRIMARY KEY ("tid", "code");
CREATE TABLE "public"."tcode_group_electric" (
"tid" uuid NOT NULL,
"code" varchar(255) COLLATE "pg_catalog"."default" NOT NULL,
"arr" time(6),
"dep" time(6),
"tdays" int4,
CONSTRAINT "tcode_group_electric_pkey" PRIMARY KEY ("tid", "code")
)
;
ALTER TABLE "public"."tcode_group_electric" OWNER TO "postgres";
COMMENT ON COLUMN "public"."tcode_group_electric"."tid" IS '租户ID';
COMMENT ON COLUMN "public"."tcode_group_electric"."code" IS '峰电peak,谷电valley';
COMMENT ON COLUMN "public"."tcode_group_electric"."arr" IS '开始时间';
COMMENT ON COLUMN "public"."tcode_group_electric"."dep" IS '结束时间';
COMMENT ON COLUMN "public"."tcode_group_electric"."tdays" IS '是否跨日,1为跨日';
ALTER TABLE "public"."tcode_model" ADD COLUMN "credential" varchar(255) COLLATE "pg_catalog"."default";
COMMENT ON COLUMN "public"."tcode_model"."credential" IS '网关令牌';
ALTER TABLE "public"."tcode_model_detail" ADD COLUMN "credential" varchar(255) COLLATE "pg_catalog"."default";
COMMENT ON COLUMN "public"."tcode_model_detail"."credential" IS '网关令牌';
ALTER TABLE "public"."tcode_model_detail_ex" ALTER COLUMN "gid" SET NOT NULL;
ALTER TABLE "public"."tcode_model_detail_ex" ADD CONSTRAINT "tcode_model_detail_ex_pkey" PRIMARY KEY ("tid", "gid", "code", "key");
CREATE TABLE "public"."tcode_model_ex" (
"tid" uuid NOT NULL,
"gid" uuid,
"code" varchar(255) COLLATE "pg_catalog"."default" NOT NULL,
"name" varchar(255) COLLATE "pg_catalog"."default",
"ctime" timestamp(6) DEFAULT CURRENT_TIMESTAMP,
"mtime" timestamp(6) DEFAULT CURRENT_TIMESTAMP
)
;
ALTER TABLE "public"."tcode_model_ex" OWNER TO "postgres";
ALTER TABLE "public"."trep_dkey_detail" DROP CONSTRAINT "trep_dkey_detail_pkey";
COMMENT ON COLUMN "public"."trep_dkey_detail"."tid" IS '租户ID';
COMMENT ON COLUMN "public"."trep_dkey_detail"."did" IS '设备ID';
COMMENT ON COLUMN "public"."trep_dkey_detail"."key" IS '属性';
ALTER TABLE "public"."trep_dkey_detail" ALTER COLUMN "bdate" SET NOT NULL;
COMMENT ON COLUMN "public"."trep_dkey_detail"."bdate" IS '营业日期';
COMMENT ON COLUMN "public"."trep_dkey_detail"."val" IS '最新遥测值-废弃';
COMMENT ON COLUMN "public"."trep_dkey_detail"."ctime" IS '创建时间';
COMMENT ON COLUMN "public"."trep_dkey_detail"."mtime" IS '修改时间';
COMMENT ON COLUMN "public"."trep_dkey_detail"."val_arr" IS '遥测值开始';
COMMENT ON COLUMN "public"."trep_dkey_detail"."val_dep" IS '遥测值结束';
COMMENT ON COLUMN "public"."trep_dkey_detail"."peak" IS '峰电-电能属性有效';
COMMENT ON COLUMN "public"."trep_dkey_detail"."valley" IS '谷电-电能属性有效';
ALTER TABLE "public"."trep_dkey_detail" ADD CONSTRAINT "trep_dkey_detail_pkey" PRIMARY KEY ("tid", "did", "key", "bdate");
COMMENT ON COLUMN "public"."trep_hkey_detail"."peak" IS '峰电';
COMMENT ON COLUMN "public"."trep_hkey_detail"."valley" IS '谷电';
ALTER TABLE "public"."trep_hsta_detail" ALTER COLUMN "aid" SET DEFAULT nextval('trep_sta_hdetail_aid_seq'::regclass);
CREATE TABLE "public"."trep_htotal_detail" (
"id" uuid NOT NULL,
"tid" uuid NOT NULL,
"did" uuid NOT NULL,
"key" varchar(255) COLLATE "pg_catalog"."default" NOT NULL,
"bdate" date DEFAULT date(now()),
"val_arr" varchar(255) COLLATE "pg_catalog"."default",
"val_dep" varchar(255) COLLATE "pg_catalog"."default",
"ctime" timestamp(6) DEFAULT now(),
"mtime" timestamp(6) DEFAULT now(),
CONSTRAINT "trep_htotal_detail_pkey" PRIMARY KEY ("id")
)
;
ALTER TABLE "public"."trep_htotal_detail" OWNER TO "postgres";
COMMENT ON COLUMN "public"."trep_htotal_detail"."id" IS '主键ID';
COMMENT ON COLUMN "public"."trep_htotal_detail"."tid" IS '租户id';
COMMENT ON COLUMN "public"."trep_htotal_detail"."did" IS '设备id';
COMMENT ON COLUMN "public"."trep_htotal_detail"."key" IS '属性key';
COMMENT ON COLUMN "public"."trep_htotal_detail"."bdate" IS '营业日期';
COMMENT ON COLUMN "public"."trep_htotal_detail"."val_arr" IS '首次统计属性值';
COMMENT ON COLUMN "public"."trep_htotal_detail"."val_dep" IS '最后统计属性值';
COMMENT ON COLUMN "public"."trep_htotal_detail"."ctime" IS '创建时间';
COMMENT ON COLUMN "public"."trep_htotal_detail"."mtime" IS '修改时间';
CREATE TABLE "public"."trep_total_detail" (
"tid" uuid NOT NULL,
"did" uuid NOT NULL,
"key" varchar(255) COLLATE "pg_catalog"."default" NOT NULL,
"val_arr" varchar(255) COLLATE "pg_catalog"."default",
"val_dep" varchar(255) COLLATE "pg_catalog"."default",
"ctime" timestamp(6) DEFAULT now(),
"mtime" timestamp(6) DEFAULT now(),
CONSTRAINT "trep_total_detail_pkey" PRIMARY KEY ("tid", "did", "key")
)
;
ALTER TABLE "public"."trep_total_detail" OWNER TO "postgres";
COMMENT ON COLUMN "public"."trep_total_detail"."tid" IS '租户id';
COMMENT ON COLUMN "public"."trep_total_detail"."did" IS '设备id';
COMMENT ON COLUMN "public"."trep_total_detail"."key" IS '属性key';
COMMENT ON COLUMN "public"."trep_total_detail"."val_arr" IS '首次统计属性值';
COMMENT ON COLUMN "public"."trep_total_detail"."val_dep" IS '最后统计属性值';
COMMENT ON COLUMN "public"."trep_total_detail"."ctime" IS '创建时间';
COMMENT ON COLUMN "public"."trep_total_detail"."mtime" IS '修改时间';
CREATE TABLE "public"."trep_yield_detail" (
"tid" uuid NOT NULL,
"did" uuid NOT NULL,
"bdate" date NOT NULL,
"key" varchar(255) COLLATE "pg_catalog"."default" NOT NULL,
"key_yield" varchar(255) COLLATE "pg_catalog"."default" NOT NULL,
"val_arr" varchar(255) COLLATE "pg_catalog"."default",
"val_dep" varchar(255) COLLATE "pg_catalog"."default",
"val_yield" varchar(255) COLLATE "pg_catalog"."default",
"ctime" timestamp(6),
"mtime" timestamp(6),
CONSTRAINT "trep_yield_detail_pkey" PRIMARY KEY ("tid", "did", "bdate", "key", "key_yield")
)
;
ALTER TABLE "public"."trep_yield_detail" OWNER TO "postgres";
COMMENT ON COLUMN "public"."trep_yield_detail"."tid" IS '租户ID';
COMMENT ON COLUMN "public"."trep_yield_detail"."did" IS '设备ID';
COMMENT ON COLUMN "public"."trep_yield_detail"."bdate" IS '营业日期';
COMMENT ON COLUMN "public"."trep_yield_detail"."key" IS '能耗属性名称key';
COMMENT ON COLUMN "public"."trep_yield_detail"."key_yield" IS '对应产量key';
COMMENT ON COLUMN "public"."trep_yield_detail"."val_arr" IS '开始值';
COMMENT ON COLUMN "public"."trep_yield_detail"."val_dep" IS '能耗结束值';
COMMENT ON COLUMN "public"."trep_yield_detail"."val_yield" IS '产量数据';
COMMENT ON COLUMN "public"."trep_yield_detail"."ctime" IS '开始时间';
COMMENT ON COLUMN "public"."trep_yield_detail"."mtime" IS '结束时间';
DROP FUNCTION "public"."trep_group_detail_function"();
CREATE OR REPLACE FUNCTION "public"."trep_group_detail_function"()
RETURNS "pg_catalog"."int4" AS $BODY$
declare
total integer;
BEGIN
INSERT into trep_group_detail(tid,did,key,bdate,grpcode,val_arr,val_dep,ctime,mtime)
SELECT t.tid,t.did, t.key,c.tarr::date as bdate,
c.code,t.val ,t.val,
CURRENT_TIMESTAMP ,CURRENT_TIMESTAMP
from vcode_key_detail t,tcode_model_detail_ex b ,(
SELECT a.* from
(
SELECT CONCAT((CURRENT_DATE)::TEXT,' ',t.arr)::TIMESTAMP as tarr,
CONCAT((CURRENT_DATE)::TEXT,' ',t.dep)::TIMESTAMP as tdep,
t.* from tcode_group t
where t.dep >= t.arr
union
SELECT CONCAT((CURRENT_DATE)::TEXT,' ',t.arr)::TIMESTAMP as tarr,
CONCAT((CURRENT_DATE+1)::TEXT,' ',t.dep)::TIMESTAMP as tdep,
t.* from tcode_group t
where t.dep < t.arr
union
SELECT CONCAT((CURRENT_DATE-1)::TEXT,' ',t.arr)::TIMESTAMP as tarr,
CONCAT((CURRENT_DATE)::TEXT,' ',t.dep)::TIMESTAMP as tdep,
t.* from tcode_group t
where t.dep < t.arr
) a
where CURRENT_TIMESTAMP >= a.tarr and
CURRENT_TIMESTAMP <= a.tdep
limit 1
) c
where t.tid = b.tid and t.tid = c.tid and b.code = 'all' and t.key = b.key and substr(b.ex_s1,3,1) = '1'
ON CONFLICT (tid,did,key,bdate,grpcode)
DO UPDATE SET
val_dep = EXCLUDED.val_dep,
mtime = CURRENT_TIMESTAMP;
RETURN total;
END;
$BODY$
LANGUAGE plpgsql VOLATILE
COST 100;
ALTER FUNCTION "public"."trep_group_detail_function"() OWNER TO "postgres";
\ No newline at end of file
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