up.sql 4.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127
  1. update apisql set
  2. sqlstr =" update user set username=? ,empid=?,sort=?,enable=?,maintenancePerson=?,keeper=?,deviceId=? where id=?"
  3. where sqlname ='updateUser';
  4. alter table user
  5. add column deviceId varchar(50) not null default '' after device;
  6. CREATE TABLE `video` (
  7. `id` int(11) NOT NULL AUTO_INCREMENT,
  8. `empId` int(11) DEFAULT NULL COMMENT '使用人id',
  9. `deviceId` varchar(50) DEFAULT NULL COMMENT '设备id',
  10. `location` varchar(200) DEFAULT NULL COMMENT '视屏地址',
  11. `createTime` datetime DEFAULT NULL COMMENT '创建时间',
  12. `upkeepId` int(11) DEFAULT NULL COMMENT '保养单Id',
  13. `newCreateTime` datetime DEFAULT '0000-00-00 00:00:00',
  14. `endRecord` int(11) NOT NULL DEFAULT 0,
  15. PRIMARY KEY (`id`) USING BTREE,
  16. UNIQUE KEY `upkeepId` (`upkeepId`)
  17. ) ENGINE=InnoDB AUTO_INCREMENT=74 DEFAULT CHARSET=utf8;
  18. -- alter table video
  19. -- add column endRecord int(11) not null default 0,
  20. -- add unique key `upkeepId` (`upkeepId`),
  21. -- add column newCreateTime datetime default '0000-00-00 00:00:00';
  22. insert into apisql
  23. (sqlstr,sqlname,method,enable) values
  24. ('select * from mcsAccount','getMcsAccounts','GetDataByName','1');
  25. CREATE TABLE `mcsaccount` (
  26. `id` int(11) NOT NULL AUTO_INCREMENT,
  27. `deviceId` varchar(64) NOT NULL,
  28. `uId` varchar(64) NOT NULL,
  29. `pwd` varchar(64) NOT NULL,
  30. PRIMARY KEY (`id`)
  31. ) ENGINE=InnoDB AUTO_INCREMENT=2 DEFAULT CHARSET=utf8;
  32. insert into mcsaccount(deviceId,uId,pwd)
  33. values('apptest2','PC','mcs8@666');
  34. CREATE TABLE `device_information` (
  35. `id` int(11) NOT NULL AUTO_INCREMENT,
  36. `empId` int(11) DEFAULT NULL COMMENT '系统用户的id',
  37. `uId` varchar(20) DEFAULT NULL COMMENT '第三用户id',
  38. `deviceId` varchar(50) DEFAULT NULL COMMENT '绑定的设备id',
  39. `password` varchar(50) DEFAULT NULL,
  40. PRIMARY KEY (`id`) USING BTREE,
  41. UNIQUE KEY `deviceId` (`deviceId`) USING BTREE
  42. ) ENGINE=InnoDB AUTO_INCREMENT=22 DEFAULT CHARSET=utf8;
  43. update apisql set sqlstr="" where sqlname ='getBigupkeepList'
  44. update apisql set params="loginId,loginId,loginId,menu,loginpastureId,loginId,menu,loginpastureId,logindeptId,loginId,loginId,loginId,menu,loginpastureId,loginId,menu,pastureName,pastureName,upkeepCode ,upkeepCode ,eqName,eqName,eqCode,eqCode,departmentId,departmentId,startTime,stopTime,startTime,SHStatue,SHStatue,SHStatue,statue,statue" where sqlname ='getBigupkeepList'
  45. update apisql set sqlstr="" where sqlname ='getBigupkeepListAPP'
  46. update apisql set params="loginId,loginId,loginId,loginId,loginId,loginpastureId,statue" where sqlname ='getBigupkeepListAPP'
  47. update apisql set sqlstr="" where sqlname ='getuserallL'
  48. procedure
  49. update_device
  50. insert into apisql
  51. (sqlstr,params,sqlname,method,enable) values
  52. ('INSERT INTO device_information(empId,uId,deviceId,`password`) VALUES(?,?,?,?)','empId,uId,deviceId,pwd','addDeviceInformation','GetDataByName','1');
  53. insert into apisql
  54. (sqlstr,params,sqlname,method,enable) values
  55. ("select if((select id from device_information where deviceId = ?)is null,'','已被绑定') vmsg",'deviceId','checkDeviceId','GetDataByName','1');
  56. insert into apisql
  57. (sqlstr,params,sqlname,method,enable) values
  58. ('update `user` set device = 1 where empid = ?','empId','updateUserDevice','GetDataByName','1');
  59. select * from device_information;
  60. select * from user where deviceId <>'';
  61. select * from mcsaccount;
  62. update appversion set version ='v1.7.0';
  63. updateDeviceInformation | empId,deviceId | call update_device(?,?)
  64. insert into apisql
  65. (sqlstr,params,sqlname,method,enable) values
  66. ('call update_device(?,?)','empId,deviceId','updateDeviceInformation','GetDataByName','1');
  67. update contract c join parts p on c.partid =p.id set c.partcode = p.new_partcode
  68. update part_repertory c join parts p on c.partid =p.id set c.partcode = p.new_partcode
  69. update parts set old_partcode = partcode
  70. update parts set partcode = new_partcode
  71. update parts set old_partcode = partcode ;
  72. update contract c join parts p on c.partid =p.id set c.partcode = p.new_partcode ;
  73. update part_repertory c join parts p on c.partid =p.id set c.partcode = p.new_partcode ;
  74. update part_class
  75. set pname ='电料'
  76. where partname in
  77. (
  78. '配电',
  79. '电气元件',
  80. '电缆、电线',
  81. '照明',
  82. '自控仪表'
  83. )
  84. update part_class p1 join part_class p2 on p1.pname =p2.partname set p1.pid =p2.id
  85. select * from partpurchase limit 10;
  86. update partpurchase pu join parts p on pu.partcode =p.old_partcode set pu.partid =p.id
  87. select disctint unit from parts