1b8b41c29453d18171abba04442a22a5e589b07d.svn-base 14 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357
  1. /*
  2. SQLyog Ultimate v12.3.1 (64 bit)
  3. MySQL - 10.3.12-MariaDB : Database - heatwatch
  4. *********************************************************************
  5. */
  6. /*!40101 SET NAMES utf8 */;
  7. /*!40101 SET SQL_MODE=''*/;
  8. /*!40014 SET @OLD_UNIQUE_CHECKS=@@UNIQUE_CHECKS, UNIQUE_CHECKS=0 */;
  9. /*!40014 SET @OLD_FOREIGN_KEY_CHECKS=@@FOREIGN_KEY_CHECKS, FOREIGN_KEY_CHECKS=0 */;
  10. /*!40101 SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE='NO_AUTO_VALUE_ON_ZERO' */;
  11. /*!40111 SET @OLD_SQL_NOTES=@@SQL_NOTES, SQL_NOTES=0 */;
  12. /*Table structure for table `apisql` */
  13. DROP TABLE IF EXISTS `apisql`;
  14. CREATE TABLE `apisql` (
  15. `id` int(11) NOT NULL AUTO_INCREMENT,
  16. `sqlstr` text DEFAULT NULL,
  17. `sqlname` varchar(50) DEFAULT NULL,
  18. `returetype` varchar(50) DEFAULT 'map',
  19. `method` varchar(50) DEFAULT 'query',
  20. `created_on` int(11) DEFAULT 0,
  21. `modified_on` int(11) DEFAULT 0,
  22. `deleted_on` int(11) DEFAULT 0,
  23. PRIMARY KEY (`id`)
  24. ) ENGINE=InnoDB AUTO_INCREMENT=39 DEFAULT CHARSET=utf8;
  25. /*Data for the table `apisql` */
  26. insert into `apisql`(`id`,`sqlstr`,`sqlname`,`returetype`,`method`,`created_on`,`modified_on`,`deleted_on`) values
  27. (1,'SELECT `temp`,`humi`,`thi` ,CASE WHEN thi<68 THEN \'无应激\' \r\n WHEN thi<72 THEN \'轻度应激\' WHEN thi<80 THEN \'中度应激\' \r\n WHEN thi<90 THEN \'重度应激\' ELSE \'严重应激\' END AS title \r\nFROM `temphumi` \r\nWHERE id = (SELECT MAX(id) FROM `temphumi` ) ','GetTempHumi','map','query',0,0,0),
  28. (2,'SELECT MAX(`temp`) max_temp,MIN(`temp`) min_temp,round(AVG(`temp`),2) avg_temp, \r\n MAX(`humi`) max_humi,MIN(`humi`) min_humi,round(AVG(`humi`),2) avg_humi, \r\n MAX(`thi`) max_thi,MIN(`thi`) min_thi,round(AVG(`thi`),2) avg_thi, \r\n (SELECT MAX(t1.`receivetime`) FROM `temphumi` t1 \r\n WHERE thi=(SELECT MAX(`thi`) FROM `temphumi` \r\n WHERE `receivetime` > DATE_ADD(NOW(), INTERVAL -24 HOUR))) AS maxtime, \r\n (SELECT MAX(t2.`receivetime`) FROM `temphumi` t2 \r\n WHERE thi= (SELECT MIN(`thi`) FROM `temphumi` \r\n WHERE `receivetime` > DATE_ADD(NOW(), INTERVAL -324 HOUR))) AS mintime \r\n FROM `temphumi` WHERE `receivetime` > DATE_ADD(NOW(), INTERVAL -324 HOUR)','GetTempHumi24MinMax','map','query',0,0,0),
  29. (3,'SELECT no, MAX(`temp`) max_temp, MAX(`humi`) max_humi, MAX(`thi`) max_thi, \r\n (SELECT DATE_FORMAT(MAX(t1.`receivetime`),\'%H:%i:%s\') FROM `temphumi` t1 \r\n WHERE thi= (SELECT MAX(`thi`) FROM `temphumi` \r\n WHERE `receivetime` > DATE_ADD(NOW(), INTERVAL -324 HOUR))) AS maxtime \r\n FROM `temphumi` WHERE `receivetime` > DATE_ADD(NOW(), INTERVAL -324 HOUR) group by no ','GetTempHumi24MinMaxByNo','map','query',0,0,0),
  30. (4,'SELECT DATE_FORMAT(`receivetime`,\'%m-%d %H:%i:%s\') AS `receivetime`,`temp`,`humi`,`thi`\r\n FROM `temphumi` WHERE `receivetime` > DATE_ADD(NOW(), INTERVAL -30 DAY) ORDER BY id','GetTempHumi30dayByNo','map','query',0,0,0),
  31. (5,'SELECT (h_time+1)*2 hours,ROUND(SUM(`opens`)/6) openmins FROM KPTAdmin \r\nWHERE `createtime` > DATE_ADD(NOW(), INTERVAL -324 HOUR) \r\nGROUP BY `h_time`','GetPriByHour','map','query',0,0,0),
  32. (6,'SELECT `eqcode`,ROUND(SUM(`opens`)/6) openmins FROM KPTAdmin \r\nWHERE `createtime` > DATE_ADD(NOW(), INTERVAL -224 HOUR) \r\nGROUP BY `eqcode`','GetPriByEQ','map','query',0,0,0),
  33. (7,'SELECT `eqcode`,ROUND(SUM(`opens`)/6) openmins FROM KPTAdmin \r\nWHERE `createtime` > DATE_ADD(NOW(), INTERVAL -324 HOUR) \r\nGROUP BY `eqcode` ','GetFutureMonthTemp','map','query',0,0,0),
  34. (8,'select intbarid,varbarname as \'爱妃\' from bar','getbar','map','query',0,0,0),
  35. (9,'select intcowid,varcowcode from cow','getcow','map','query',0,0,0),
  36. (10,'insert into applog(varcowcode,objcode,createtime) values(?,?,?)','setapplog','map','insert',0,0,0),
  37. (11,'call aaa','callaaa','map','query',0,0,0),
  38. (12,'select id,deptname,parentid,remark from dept','getdeptall','map','query',0,0,0),
  39. (13,'insert into dept(parentid, deptname, remark) values(?,?,?)','createdept','map','query',0,0,0),
  40. (14,'update dept set parentid= ? , deptname = ? , remark= ? where id = ?','updatedept','map','query',0,0,0),
  41. (15,'delete from dept where id = ?','deletedept','map','query',0,0,0),
  42. (16,'SELECT menu.id, menu.`path`, menu.`redirect`, menu.`component`, \nmenu.`title`,menu.`icon`,menu.`parentId`,menu.`name` FROM `user`,`user_role`,`role_menu`,`menu` \nWHERE user.`username`=? AND user_role.`user_id`=user.`id` AND role_menu.`role_id`=user_role.`role_id` \nAND menu.`id`=role_menu.`menu_id` AND menu.`menutype`=\'menu\' AND menu.`parentId`=? \norder by sort','getmenu','map','query',0,0,0),
  43. (17,'select id value,deptname label,parentid,remark from dept where parentid=?','getdeptrecu','map','query',0,0,0),
  44. (18,'select id,deptname,parentid,remark from dept where parentid=?','getdeptlistrecu','map','query',0,0,0),
  45. (19,'select id,sqlstr,sqlname from apisql','getapisqlall','map','query',0,0,0),
  46. (20,'update apisql set sqlstr= ? , sqlname = ? where id = ?','updateapisql','map','query',0,0,0),
  47. (21,'delete from apisql where id = ?','deleteapisql','map','query',0,0,0),
  48. (22,'insert into apisql(sqlstr,sqlname) values(?,?)','createapisql','map','query',0,0,0),
  49. (23,'select id,title,parentid from menu where parentid=? and redirect =\'noredirect\'','getMenuListRecu','map','query',0,0,0),
  50. (24,'SELECT id,name,menutype,path,method,icon,redirect,title,parentid,component,sort FROM menu WHERE menutype=\'menu\' AND parentid=? order by sort','getMenuRecu','map','query',0,0,0),
  51. (25,'insert into menu(parentid,name,title,path,component,icon,redirect,sort,menutype,method) values(?,?,?,?,?,?,?,?,\'menu\',\'post\')','createMenu','map','query',0,0,0),
  52. (26,'delete from menu where id=?','deleteMenu','map','query',0,0,0),
  53. (27,'update menu\nset parentid=?,name=?,title=?,\npath=?,component=?,icon=?,redirect=?,sort=? \nwhere id =?','updateMenu','map','query',0,0,0),
  54. (28,'SELECT user.id ,user.username,user.fullname,dept.deptname FROM USER LEFT JOIN dept ON dept.id=user.deptid','getUserAll','map','query',0,0,0),
  55. (29,'insert into user(username, fullname, deptid) values(?,?,?)','createUser','map','query',0,0,0),
  56. (30,'update user set username=? ,fullname=? ,deptid=? where id=?','updateUser','map','query',0,0,0),
  57. (31,'delete from user where id = ?','deleteUser','map','query',0,0,0),
  58. (32,'select id,name from role','getRoleAll','map','query',0,0,0),
  59. (33,'insert into role(name) values(?)','createRole','map','query',0,0,0),
  60. (34,'update role set `name`=? where `id` =?','updateRole','map','query',0,0,0),
  61. (35,'delete from role where id = ?','deleteRole','map','query',0,0,0),
  62. (36,'select role_id from user_role where user_id = ?','getRoleByUser','map','query',0,0,0),
  63. (37,'select menu_id from role_menu where role_id = ?','getMenuByRole','map','query',0,0,0);
  64. /*Table structure for table `dept` */
  65. DROP TABLE IF EXISTS `dept`;
  66. CREATE TABLE `dept` (
  67. `id` int(11) NOT NULL AUTO_INCREMENT,
  68. `deptname` varchar(50) DEFAULT NULL,
  69. `parentid` int(11) DEFAULT -1,
  70. `remark` varchar(50) DEFAULT NULL,
  71. `createon` int(11) DEFAULT NULL,
  72. PRIMARY KEY (`id`)
  73. ) ENGINE=InnoDB AUTO_INCREMENT=68 DEFAULT CHARSET=utf8;
  74. /*Data for the table `dept` */
  75. insert into `dept`(`id`,`deptname`,`parentid`,`remark`,`createon`) values
  76. (39,'总公司',-1,'',NULL),
  77. (40,'销售部',39,'',NULL),
  78. (41,'行政部',39,'',NULL),
  79. (63,'士大夫',39,'',NULL),
  80. (66,'爱上',39,'是',NULL),
  81. (67,'是第三个',39,' ',NULL);
  82. /*Table structure for table `menu` */
  83. DROP TABLE IF EXISTS `menu`;
  84. CREATE TABLE `menu` (
  85. `id` int(10) unsigned NOT NULL AUTO_INCREMENT,
  86. `name` varchar(50) DEFAULT '' COMMENT '名字',
  87. `menutype` varchar(50) DEFAULT 'api',
  88. `path` varchar(50) DEFAULT '' COMMENT '访问路径',
  89. `method` varchar(50) DEFAULT 'post' COMMENT '资源请求方式',
  90. `icon` varchar(50) DEFAULT '',
  91. `redirect` varchar(50) DEFAULT 'noredirect',
  92. `title` varchar(50) DEFAULT '',
  93. `parentId` int(11) DEFAULT -1,
  94. `component` varchar(50) DEFAULT 'Layout',
  95. `sort` int(11) DEFAULT 0,
  96. `created_on` int(11) unsigned DEFAULT 0 COMMENT '创建时间',
  97. `modified_on` int(11) unsigned DEFAULT 0 COMMENT '更新时间',
  98. `deleted_on` int(11) unsigned DEFAULT 0 COMMENT '删除时间戳',
  99. PRIMARY KEY (`id`)
  100. ) ENGINE=InnoDB AUTO_INCREMENT=32 DEFAULT CHARSET=utf8;
  101. /*Data for the table `menu` */
  102. insert into `menu`(`id`,`name`,`menutype`,`path`,`method`,`icon`,`redirect`,`title`,`parentId`,`component`,`sort`,`created_on`,`modified_on`,`deleted_on`) values
  103. (1,'查询所有菜单','api','/api/v1/menus','GET','','noredirect','查询所有菜单',25,'Layout',0,0,0,0),
  104. (2,'查询单个菜单','api','/api/v1/menus/:id','GET','','noredirect','查询单个菜单',25,'Layout',0,0,0,0),
  105. (3,'创建单个菜单','api','/api/v1/menus','POST','','noredirect','创建单个菜单',25,'Layout',0,0,0,0),
  106. (4,'更新单个菜单','api','/api/v1/menus/:id','PUT','','noredirect','更新单个菜单',25,'Layout',0,0,0,0),
  107. (5,'删除单个菜单','api','/api/v1/menus/:id','DELETE','','noredirect','删除单个菜单',25,'Layout',0,0,0,0),
  108. (6,'查询所有用户','api','/api/v1/users','GET','','noredirect','查询所有用户',25,'Layout',0,0,0,0),
  109. (7,'查询单个用户','api','/api/v1/users/:id','GET','','noredirect','查询单个用户',25,'Layout',0,0,0,0),
  110. (8,'创建单个用户','api','/api/v1/users','POST','','noredirect','创建单个用户',25,'Layout',0,0,0,0),
  111. (9,'更新单个用户','api','/api/v1/users/:id','PUT','','noredirect','更新单个用户',25,'Layout',0,0,0,0),
  112. (10,'删除单个用户','api','/api/v1/users/:id','DELETE','','noredirect','删除单个用户',25,'Layout',0,0,0,0),
  113. (11,'查询所有角色','api','/api/v1/roles','GET','','noredirect','查询所有角色',25,'Layout',0,0,0,0),
  114. (12,'查询单个角色','api','/api/v1/roles/:id','GET','','noredirect','查询单个角色',25,'Layout',0,0,0,0),
  115. (13,'创建单个角色','api','/api/v1/roles','POST','','noredirect','创建单个角色',25,'Layout',0,0,0,0),
  116. (14,'更新单个角色','api','/api/v1/roles/:id','PUT','','noredirect','更新单个角色',25,'Layout',0,0,0,0),
  117. (15,'删除单个角色','api','/api/v1/roles/:id','DELETE','','noredirect','删除单个角色',25,'Layout',0,0,0,0),
  118. (16,'登录','api','/auth','GET','','noredirect','登录',25,'Layout',0,0,0,0),
  119. (19,'console','menu','/console','POST','form','noredirect','系统管理',-1,'Layout',0,0,0,0),
  120. (21,'user','menu','user','POST','user','','用户管理',19,'console/user/index',3,0,0,0),
  121. (22,'menu','menu','menu','POST','table','','菜单管理',19,'console/menu/index',1,0,0,0),
  122. (23,'role','menu','role','POST','table','','角色管理',19,'console/role/index',2,0,0,0),
  123. (24,'dict','menu','dict','POST','table','','字典管理',19,'console/dict/index',3,0,0,0),
  124. (26,'dept','menu','dept','POST','user','','部门管理',19,'console/dept/index',4,0,0,0),
  125. (27,'apisql','menu','apisql','post','table','','SQL管理',19,'console/apisql/index',5,0,0,0),
  126. (30,'adf','menu','ad','post','','noredirect','adf',-1,'Layout',0,0,0,0),
  127. (31,'测试','menu','simple','post','form','','测试',19,'customviews/TableView',0,0,0,0);
  128. /*Table structure for table `role` */
  129. DROP TABLE IF EXISTS `role`;
  130. CREATE TABLE `role` (
  131. `id` int(10) unsigned NOT NULL AUTO_INCREMENT,
  132. `name` varchar(50) DEFAULT '' COMMENT '名字',
  133. `created_on` int(11) unsigned DEFAULT NULL COMMENT '创建时间',
  134. `modified_on` int(11) unsigned DEFAULT NULL COMMENT '更新时间',
  135. `deleted_on` int(11) unsigned DEFAULT 0 COMMENT '删除时间戳',
  136. PRIMARY KEY (`id`)
  137. ) ENGINE=InnoDB AUTO_INCREMENT=19 DEFAULT CHARSET=utf8;
  138. /*Data for the table `role` */
  139. insert into `role`(`id`,`name`,`created_on`,`modified_on`,`deleted_on`) values
  140. (1,'朱红宾',NULL,NULL,0),
  141. (11,'管理员',NULL,NULL,0),
  142. (12,'测试',NULL,NULL,0),
  143. (13,'adsf',NULL,NULL,0),
  144. (18,'舒服的',NULL,NULL,0);
  145. /*Table structure for table `role_menu` */
  146. DROP TABLE IF EXISTS `role_menu`;
  147. CREATE TABLE `role_menu` (
  148. `id` int(10) unsigned NOT NULL AUTO_INCREMENT,
  149. `role_id` int(11) unsigned DEFAULT NULL COMMENT '角色ID',
  150. `menu_id` int(11) unsigned DEFAULT NULL COMMENT '菜单ID',
  151. `deleted_on` int(11) unsigned DEFAULT 0 COMMENT '删除时间戳',
  152. PRIMARY KEY (`id`)
  153. ) ENGINE=InnoDB AUTO_INCREMENT=26 DEFAULT CHARSET=utf8 COMMENT='用户_角色ID_管理';
  154. /*Data for the table `role_menu` */
  155. insert into `role_menu`(`id`,`role_id`,`menu_id`,`deleted_on`) values
  156. (1,1,1,0),
  157. (2,1,2,0),
  158. (3,1,3,0),
  159. (4,1,4,0),
  160. (5,1,5,0),
  161. (6,1,6,0),
  162. (7,1,7,0),
  163. (8,1,8,0),
  164. (9,1,9,0),
  165. (10,1,10,0),
  166. (11,1,11,0),
  167. (12,1,12,0),
  168. (13,1,13,0),
  169. (14,1,14,0),
  170. (15,1,15,0),
  171. (17,1,19,0),
  172. (18,1,21,0),
  173. (19,1,22,0),
  174. (20,1,23,0),
  175. (21,1,24,0),
  176. (22,1,25,0),
  177. (23,1,26,0),
  178. (24,1,27,0),
  179. (25,1,31,0);
  180. /*Table structure for table `user` */
  181. DROP TABLE IF EXISTS `user`;
  182. CREATE TABLE `user` (
  183. `id` int(10) unsigned NOT NULL AUTO_INCREMENT,
  184. `username` varchar(50) DEFAULT '' COMMENT '账号',
  185. `fullname` varchar(50) DEFAULT '',
  186. `deptid` int(11) DEFAULT -1,
  187. `password` varchar(50) DEFAULT '' COMMENT '密码',
  188. `created_on` int(11) unsigned DEFAULT NULL COMMENT '创建时间',
  189. `modified_on` int(11) unsigned DEFAULT NULL COMMENT '更新时间',
  190. `deleted_on` int(11) unsigned DEFAULT 0 COMMENT '删除时间戳',
  191. PRIMARY KEY (`id`)
  192. ) ENGINE=InnoDB AUTO_INCREMENT=16 DEFAULT CHARSET=utf8 COMMENT='用户管理';
  193. /*Data for the table `user` */
  194. insert into `user`(`id`,`username`,`fullname`,`deptid`,`password`,`created_on`,`modified_on`,`deleted_on`) values
  195. (1,'admin','管理员',39,'e10adc3949ba59abbe56e057f20f883e',NULL,NULL,0),
  196. (2,'zhuhongbin','',39,'e10adc3949ba59abbe56e057f20f883e',1550642309,1550642309,0);
  197. /*Table structure for table `user_role` */
  198. DROP TABLE IF EXISTS `user_role`;
  199. CREATE TABLE `user_role` (
  200. `id` int(10) unsigned NOT NULL AUTO_INCREMENT,
  201. `user_id` int(11) unsigned DEFAULT NULL COMMENT '用户ID',
  202. `role_id` int(11) unsigned DEFAULT NULL COMMENT '角色ID',
  203. `deleted_on` int(11) unsigned DEFAULT 0 COMMENT '删除时间戳',
  204. PRIMARY KEY (`id`)
  205. ) ENGINE=InnoDB AUTO_INCREMENT=29 DEFAULT CHARSET=utf8 COMMENT='用户_角色ID_管理';
  206. /*Data for the table `user_role` */
  207. insert into `user_role`(`id`,`user_id`,`role_id`,`deleted_on`) values
  208. (1,1,1,0),
  209. (8,2,1,0),
  210. (26,2,11,0);
  211. /*!40101 SET SQL_MODE=@OLD_SQL_MODE */;
  212. /*!40014 SET FOREIGN_KEY_CHECKS=@OLD_FOREIGN_KEY_CHECKS */;
  213. /*!40014 SET UNIQUE_CHECKS=@OLD_UNIQUE_CHECKS */;
  214. /*!40111 SET SQL_NOTES=@OLD_SQL_NOTES */;