sql.sql 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188
  1. CREATE TABLE xhItem(
  2. id INT NOT NULL AUTO_INCREMENT PRIMARY KEY,
  3. `name` VARCHAR(50) NOT NULL DEFAULT '' COMMENT '花材名称',
  4. unitNum tinyint not null default 0 comment '每扎多少支',
  5. unitWeight decimal(9,2) NOT NULL DEFAULT '0.00' COMMENT '每扎多少公斤',
  6. unitCost decimal(9,2) NOT NULL DEFAULT '0.00' COMMENT '每扎成本价,采购价',
  7. unitAddPrice decimal(9,2) NOT NULL DEFAULT '0.00' COMMENT '每扎加价',
  8. unit int not null default 0 comment '单位名称ID',
  9. addTime int not null default 0 comment '添加时间',
  10. updateTime int not null default 0 comment '修改时间'
  11. )comment='花材,资材';
  12. create table if not exists xhItemClass(
  13. id INT NOT NULL AUTO_INCREMENT PRIMARY KEY,
  14. `name` varchar(50) not null default '' comment '名称',
  15. inTurn int not null default 0 comment '排序,越大越靠前',
  16. addTime int not null default 0 comment '添加时间',
  17. updateTime int not null default 0 comment '修改时间'
  18. )comment='花材分类';
  19. CREATE TABLE xhUnit(
  20. id INT NOT NULL AUTO_INCREMENT PRIMARY KEY,
  21. `name` VARCHAR(10) NOT NULL DEFAULT '' COMMENT '单位名称',
  22. addTime int not null default 0 comment '添加时间',
  23. updateTime int not null default 0 comment '修改时间'
  24. )COMMENT='花材单位';
  25. create table xhMerchantItemClass(
  26. id INT NOT NULL AUTO_INCREMENT PRIMARY KEY,
  27. merchantId int not null default 0 comment '商家id',
  28. `name` varchar(50) not null default '' comment '名称',
  29. inTurn int not null default 0 comment '排序,越大越靠前',
  30. addTime int not null default 0 comment '添加时间',
  31. updateTime int not null default 0 comment '修改时间'
  32. )comment='商家花材分类';
  33. create table xhMerchantItem(
  34. id INT NOT NULL AUTO_INCREMENT PRIMARY KEY,
  35. merchantId int not null default 0 comment '商家id',
  36. classId int not null default 0 comment '商家花材分类id',
  37. itemId int not null default 0 comment '花材id',
  38. unitCost decimal(9,2) NOT NULL DEFAULT '0.00' COMMENT '每扎成本价,采购价',
  39. unitAddPrice decimal(9,2) NOT NULL DEFAULT '0.00' COMMENT '每扎加价',
  40. addTime int not null default 0 comment '添加时间',
  41. updateTime int not null default 0 comment '修改时间'
  42. )comment='商家花材';
  43. CREATE TABLE `xhGhsOrder` (
  44. `id` int(11) NOT NULL AUTO_INCREMENT primary key COMMENT '自增id',
  45. `orderSn` char(40) NOT NULL DEFAULT '' COMMENT '订单编号',
  46. `goodsNum` tinyint(4) NOT NULL DEFAULT '0' COMMENT '商品数量',
  47. `payWay` tinyint(4) NOT NULL DEFAULT '0' COMMENT '支付方式 0微信 1支付宝 2余额',
  48. `wxPayType` tinyint(4) NOT NULL DEFAULT '0' COMMENT '0 H5支付 1 小程序支付',
  49. `payCode` varchar(1000) NOT NULL DEFAULT '' COMMENT '支付返回号',
  50. `fromType` tinyint(4) NOT NULL DEFAULT '0' COMMENT '来源:0门店 1商城 2朋友圈',
  51. `store` tinyint(4) NOT NULL DEFAULT '0' COMMENT '门店订单 0不是 1是',
  52. `capitalId` int(11) NOT NULL DEFAULT '0' COMMENT '流水id',
  53. `prePrice` decimal(9,2) NOT NULL DEFAULT '0.00' COMMENT '应付款,原价,未修改价格,打折前',
  54. `actPrice` decimal(9,2) NOT NULL DEFAULT '0.00' COMMENT '实际付款,实价,修改后价格,打折后',
  55. `userId` int(11) NOT NULL DEFAULT '0' COMMENT '用户id',
  56. `merchantId` int(11) NOT NULL DEFAULT '0' COMMENT '商户id',
  57. `shopId` int(11) NOT NULL DEFAULT '0' COMMENT '门店id',
  58. `sendType` tinyint(4) NOT NULL DEFAULT '0' COMMENT '0未确认配送方式 1免配送 2自己送 3别人送;快递送',
  59. `sendSide` tinyint(4) NOT NULL DEFAULT '0' COMMENT '配送方 0没有 1达达',
  60. `sendStatus` tinyint(4) NOT NULL DEFAULT '0' COMMENT '配送状态:0未发货,待接单 1已发货,已接单 2已送达',
  61. `refund` tinyint(4) NOT NULL DEFAULT '0' COMMENT '1已退款 0正常订单',
  62. `payStatus` tinyint(4) NOT NULL DEFAULT '0' COMMENT '0待付款 1已付款',
  63. `printStatus` tinyint(4) NOT NULL DEFAULT '0' COMMENT '0未打印 1已打印',
  64. `remark` varchar(1000) NOT NULL DEFAULT '' COMMENT '备注',
  65. `status` tinyint(4) NOT NULL DEFAULT '0' COMMENT '订单状态 0待付款 1待配送 2配送中 3待通知 4已取消 5已完成',
  66. `deadline` int(11) NOT NULL DEFAULT '0' COMMENT '订单有效期',
  67. `payTime` int(11) NOT NULL DEFAULT '0' COMMENT '付款时间',
  68. addTime int not null default 0 comment '添加时间',
  69. `updateTime` int not null default 0 comment '修改时间'
  70. ) COMMENT='供货商订单';
  71. create table xhGhsOrderItem(
  72. `id` int(11) unsigned NOT NULL AUTO_INCREMENT primary key COMMENT 'id',
  73. `orderId` int(11) NOT NULL DEFAULT '0' COMMENT '订单id',
  74. `userId` int(11) NOT NULL DEFAULT '0' COMMENT '用户id',
  75. `merchantId` int(11) NOT NULL DEFAULT '0' COMMENT '商户id',
  76. itemId int not null default 0 comment '商家花材id',
  77. `unitPrice` decimal(9,2) NOT NULL DEFAULT '0.00' COMMENT '每扎价格',
  78. unitNum int not null default 0 comment '每扎多少支',
  79. `num` decimal(9,2) NOT NULL DEFAULT '0.00' COMMENT '多少扎'
  80. )comment='供货商订单商品';
  81. ALTER TABLE xhItem ADD cover VARCHAR(500) NOT NULL DEFAULT '' COMMENT '封面图片' AFTER `name`;
  82. ALTER TABLE xhMerchantAccount RENAME TO xhMerchantApply
  83. == shish 2021.1.3
  84. DROP TABLE IF EXISTS `xhItemRank`;
  85. CREATE TABLE IF NOT EXISTS `xhItemRank` (
  86. `id` INT(11) NOT NULL AUTO_INCREMENT,
  87. `itemId` INT NOT NULL DEFAULT 0 COMMENT '花材id',
  88. `rank` CHAR(5) NOT NULL DEFAULT 'A' COMMENT '等级 A B C D E',
  89. `unitCost` DECIMAL(9,2) NOT NULL DEFAULT '0.00' COMMENT '每扎成本价,采购价',
  90. `unitAddPrice` DECIMAL(9,2) NOT NULL DEFAULT '0.00' COMMENT '每扎加价',
  91. `addTime` INT(11) NOT NULL DEFAULT '0' COMMENT '添加时间',
  92. `updateTime` INT(11) NOT NULL DEFAULT '0' COMMENT '修改时间',
  93. PRIMARY KEY (`id`)
  94. ) COMMENT='花材等级价格';
  95. ALTER TABLE xhMerchantItem ADD rank CHAR(5) NOT NULL DEFAULT 'A' COMMENT '花材级别' AFTER `itemId`;
  96. ALTER TABLE xhGhsOrderItem ADD rank CHAR(5) NOT NULL DEFAULT 'A' COMMENT '花材级别' AFTER `itemId`;
  97. ALTER TABLE xhItemRank RENAME TO xhMerchantItemRank;
  98. alter table xhMerchantItemRank add merchantId int not null default 0 comment '' after `id`;
  99. ALTER TABLE xhAdmin ADD identity TINYINT NOT NULL DEFAULT 0 COMMENT '身份 0未知 1花粉 2花店员工' AFTER `mobile`;
  100. ALTER TABLE xhMerchant ADD `style` TINYINT NOT NULL DEFAULT 0 COMMENT '商家类型 0普通 1零售商使用 2供货商使用' AFTER `id`;
  101. ==在开发环境,找到【花美玲】将style设置为1,找到【花掌柜】将style设置为2,如果找不到,则去走流程创建
  102. ==在线上环境,找到【花卉宝】将style设置为1,找到【销花宝】将style设置为2,如果找不到,则去走流程创建
  103. ==shish 20201.1.6
  104. ALTER TABLE xhWxOpen MODIFY wx_mini_base_id INT(11) NOT NULL DEFAULT '0' COMMENT '平台零售商小程序';
  105. ALTER TABLE xhWxOpen MODIFY wx_base_id INT(11) NOT NULL DEFAULT '0' COMMENT '平台零售商公众号';
  106. ALTER TABLE xhWxOpen ADD wxGhsMiniBaseId INT(11) NOT NULL DEFAULT '0' COMMENT '平台供货商小程序' AFTER wx_base_id;
  107. ALTER TABLE xhWxOpen ADD wxGhsBaseId INT(11) NOT NULL DEFAULT '0' COMMENT '平台供货商公众号' AFTER wxGhsMiniBaseId;
  108. DROP TABLE IF EXISTS `xhGhsAdmin`;
  109. CREATE TABLE IF NOT EXISTS `xhGhsAdmin` (
  110. `id` int(11) NOT NULL AUTO_INCREMENT,
  111. `mobile` varchar(15) DEFAULT NULL COMMENT '手机号',
  112. `identity` tinyint(4) NOT NULL DEFAULT '0' COMMENT '身份 0未知 1花粉 2花店员工',
  113. `adminName` varchar(50) NOT NULL DEFAULT '' COMMENT '管理员姓名',
  114. `nickName` varchar(50) NOT NULL DEFAULT '' COMMENT '昵称',
  115. `avatar` varchar(500) NOT NULL DEFAULT '' COMMENT '头像',
  116. `password` varchar(500) NOT NULL DEFAULT '' COMMENT '密码',
  117. `confirmPassword` varchar(500) NOT NULL DEFAULT '' COMMENT '确认密码',
  118. `sourceType` tinyint(4) NOT NULL DEFAULT '0' COMMENT '来源 0微信 1支付宝 2小程序 3朋友圈 4美团',
  119. `subscribeTime` int(11) NOT NULL DEFAULT '0' COMMENT '关注时间',
  120. `hasSubscribe` tinyint(4) NOT NULL DEFAULT '0' COMMENT '是否关注过 0没有 1是的',
  121. `subscribe` tinyint(4) NOT NULL DEFAULT '0' COMMENT '关注平台 0未关注 1关注',
  122. `unionId` varchar(100) NOT NULL DEFAULT '' COMMENT '微信平台唯一id',
  123. `miniOpenId` varchar(100) NOT NULL DEFAULT '' COMMENT '小程序openid',
  124. `openId` varchar(100) NOT NULL DEFAULT '' COMMENT '微信openid',
  125. `remark` varchar(500) NOT NULL DEFAULT '' COMMENT '员工备注',
  126. `sex` tinyint(4) NOT NULL DEFAULT '0' COMMENT '性别 0未知 1男性 2女性',
  127. `super` tinyint(4) NOT NULL DEFAULT '0' COMMENT '是否超级管理员 0不是 1是,超级员工不可删除',
  128. `delStatus` tinyint(4) NOT NULL DEFAULT '0' COMMENT '软删除标识 0未删除 1已删除',
  129. `accountStatus` tinyint(4) NOT NULL DEFAULT '1' COMMENT '帐号状态 0禁用 1正常',
  130. `loginTime` int(11) NOT NULL DEFAULT '0' COMMENT '最后登陆时间',
  131. `addTime` int(11) NOT NULL DEFAULT '0' COMMENT '添加时间',
  132. PRIMARY KEY (`id`)
  133. )COMMENT='供货商管理员表';
  134. drop table if exists `xhGhsShop`;
  135. CREATE TABLE `xhGhsShop` (
  136. `id` bigint(11) NOT NULL AUTO_INCREMENT,
  137. `avatar` varchar(500) NOT NULL DEFAULT '' COMMENT '门店照片;门店头像',
  138. `shopName` varchar(100) NOT NULL DEFAULT '' COMMENT '门店名称',
  139. `merchantName` varchar(100) NOT NULL DEFAULT '' COMMENT '商家名称',
  140. `merchantId` int(11) NOT NULL DEFAULT '0' COMMENT '商户id',
  141. `lat` varchar(20) NOT NULL DEFAULT '' COMMENT '纬度',
  142. `long` varchar(20) NOT NULL DEFAULT '' COMMENT '经度',
  143. `province` varchar(100) NOT NULL DEFAULT '' COMMENT '省',
  144. `city` varchar(100) NOT NULL DEFAULT '' COMMENT '市',
  145. `dist` varchar(100) NOT NULL DEFAULT '' COMMENT '区县',
  146. `address` varchar(500) NOT NULL DEFAULT '' COMMENT '街道地址',
  147. `floor` varchar(50) NOT NULL DEFAULT '' COMMENT '楼号门牌号',
  148. `fullAddress` varchar(500) NOT NULL DEFAULT '' COMMENT '完整地址',
  149. `telephone` varchar(20) NOT NULL DEFAULT '' COMMENT '电话',
  150. `openTime` varchar(30) NOT NULL DEFAULT '' COMMENT '营业时间',
  151. `introduction` varchar(800) DEFAULT '' COMMENT '简介',
  152. `gatheringCode` varchar(500) NOT NULL DEFAULT '' COMMENT '收款的二维码',
  153. `applyMemberCode` varchar(500) NOT NULL DEFAULT '' COMMENT '注册会员码',
  154. `totalIncome` decimal(9,2) NOT NULL DEFAULT '0.00' COMMENT '累计收入',
  155. `default` tinyint(4) NOT NULL DEFAULT '0' COMMENT '默认门店 0不是 1是,默认门店不能删除',
  156. `delStatus` tinyint(4) NOT NULL DEFAULT '0' COMMENT '删除状态 0没有删除 1已删除',
  157. `status` tinyint(4) NOT NULL DEFAULT '1' COMMENT '门店状态 0停用 1正常',
  158. `addTime` int(11) NOT NULL DEFAULT '0' COMMENT '添加时间,时间戳格式',
  159. `createTime` datetime NOT NULL COMMENT '创建时间',
  160. `updateTime` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
  161. PRIMARY KEY (`id`)
  162. ) comment='供货商门店';
  163. drop table if exists `xhGhsShopAdmin`;
  164. CREATE TABLE if not exists `xhGhsShopAdmin` (
  165. `id` int(11) NOT NULL AUTO_INCREMENT,
  166. `adminId` int(11) NOT NULL DEFAULT '0' COMMENT '管理员id',
  167. `merchantId` int(11) NOT NULL DEFAULT '0' COMMENT '商家id',
  168. `shopId` int(11) NOT NULL DEFAULT '0' COMMENT '门店id',
  169. `remind` tinyint(4) NOT NULL DEFAULT '0' COMMENT '动态提醒 0不需要 1需要',
  170. `roleId` int(11) NOT NULL DEFAULT '0' COMMENT '角色id',
  171. `default` tinyint(4) NOT NULL DEFAULT '0' COMMENT '默认管理的门店 1是 0否',
  172. `delStatus` tinyint(4) NOT NULL DEFAULT '0' COMMENT '删除状态 0正常 1已删除',
  173. `status` tinyint(4) NOT NULL DEFAULT '1' COMMENT '状态 0停用 1正常',
  174. `addTime` int(11) NOT NULL DEFAULT '0' COMMENT '添加时间',
  175. PRIMARY KEY (`id`)
  176. ) COMMENT='供货商员工';