etrade_order.sql
26.1 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
USE dili_etrade;
-- ----------------------------
-- Table structure for order
-- ----------------------------
DROP TABLE IF EXISTS `order`;
CREATE TABLE `order` (
`id` bigint NOT NULL AUTO_INCREMENT COMMENT '自增id',
`code` varchar(40) DEFAULT NULL COMMENT '订单编码',
`mapping_code` varchar(10) DEFAULT NULL COMMENT '核销码',
`market_id` bigint NOT NULL COMMENT '市场ID',
`buyer_code` varchar(20) DEFAULT NULL COMMENT '买方编号,对应用户表customer_code',
`buyer_id` bigint DEFAULT NULL COMMENT '买方ID,客户id',
`buyer_store_customer_id` bigint DEFAULT NULL COMMENT '买方,常客id',
`buyer_name` varchar(50) DEFAULT NULL COMMENT '买方姓名',
`buyer_account_id` bigint DEFAULT NULL COMMENT '买方账户ID',
`buyer_card_no` varchar(20) DEFAULT NULL COMMENT '买方卡号',
`buyer_phone` varchar(20) DEFAULT NULL COMMENT '买方联系电话',
`seller_id` bigint DEFAULT NULL COMMENT '卖方员工ID',
`seller_name` varchar(50) DEFAULT NULL COMMENT '卖方员工姓名',
`shop_id` bigint NOT NULL COMMENT '店铺id',
`shop_name` varchar(50) NOT NULL COMMENT '店铺名称',
`shop_customer_id` bigint NOT NULL COMMENT '店铺客户id',
`shop_customer_name` varchar(50) NOT NULL COMMENT '店铺所属用户主键',
`shop_card_no` varchar(20) DEFAULT NULL COMMENT '店铺收款园区卡号',
`shop_contact_phone` varchar(30) DEFAULT NULL COMMENT '店铺联系人电话',
`shop_contact_name` varchar(50) DEFAULT NULL COMMENT '店铺联系人',
`totle_amount` bigint NOT NULL COMMENT '总金额',
`totle_pay_amount` bigint NOT NULL COMMENT '总付款金额',
`totle_paid_amount` bigint NOT NULL COMMENT '总已付款金额',
`totle_discount` bigint NOT NULL COMMENT '总优惠金额',
`totle_weight` bigint NOT NULL COMMENT '订单总重量',
`order_type` int NOT NULL COMMENT '订单类型(1买方订单,2卖方订单)',
`pay_state` int DEFAULT NULL COMMENT '支付状态(1待支付,2部分支付,3已完成支付)',
`pay_time` datetime DEFAULT NULL COMMENT '支付完成时间',
`order_state` int DEFAULT NULL COMMENT '订单操作状态(1买方创建,2卖方创建,3卖方修改,4卖方核销,5买方取消,6卖方取消,7超时取消,8挂单)',
`state` int DEFAULT NULL COMMENT '订单状态(1待确认,2待支付,3已完成,4已取消)',
`version` int NOT NULL COMMENT '乐观锁,版本号',
`creater_id` bigint DEFAULT NULL COMMENT '创建人id',
`creater` varchar(50) DEFAULT NULL COMMENT '创建人名称',
`created_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
`modifier_id` bigint DEFAULT NULL COMMENT '更新人id(卖方店员)',
`modifier` varchar(50) DEFAULT NULL COMMENT '更新人名称',
`modified_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '更新时间',
`verify_state` tinyint DEFAULT NULL COMMENT '核销状态',
`verify_ids` bigint DEFAULT NULL COMMENT '确认人id(卖方店员)',
`verifier` varchar(50) DEFAULT NULL COMMENT '确认人名称',
`verifier_time` datetime DEFAULT NULL COMMENT '核销时间',
`cancel_id` bigint DEFAULT NULL COMMENT '取消人id(买方订单存客户id,卖方订单存卖方店员id)',
`cancel_name` varchar(50) DEFAULT NULL COMMENT '取消订单人员名称',
`cancel_time` datetime DEFAULT NULL COMMENT '取消时间',
`out_time` datetime DEFAULT NULL COMMENT '超时取消时间',
`source` tinyint NOT NULL COMMENT '数据应用平台,来源',
`totle_seller_fee` bigint DEFAULT NULL COMMENT '卖方手续费总计',
`district_id` bigint DEFAULT NULL COMMENT '区域id',
`district_name` varchar(100) DEFAULT NULL COMMENT '区域名称',
`sub_district_id` bigint DEFAULT NULL COMMENT '二级区域id',
`sub_district_name` varchar(100) DEFAULT NULL COMMENT '二级区域名称',
`location` varchar(100) DEFAULT NULL COMMENT '店铺位置',
`order_status` tinyint DEFAULT NULL COMMENT '单据类型',
`relation_id` bigint DEFAULT NULL COMMENT '关联订单id',
`achieve_type` tinyint NOT NULL DEFAULT '1' COMMENT '下单提货方式(1自提,2配送)',
`achieve_address` varchar(200) DEFAULT NULL COMMENT '订单配送地址',
`achieve_state` tinyint DEFAULT NULL COMMENT '订单配送状态',
PRIMARY KEY (`id`) USING BTREE,
UNIQUE KEY `code` (`code`,`order_status`) USING BTREE COMMENT '编号',
KEY `shop` (`shop_id`,`seller_id`) USING BTREE COMMENT '店铺组合查询',
KEY `seller` (`shop_customer_id`) USING BTREE COMMENT '卖家查询',
KEY `buyer` (`buyer_id`,`pay_time`) USING BTREE COMMENT '买家查询'
) ENGINE = InnoDB COMMENT = '电子交易订单';
-- ----------------------------
-- Table structure for order_coupon
-- ----------------------------
DROP TABLE IF EXISTS `order_coupon`;
CREATE TABLE `order_coupon` (
`id` bigint NOT NULL AUTO_INCREMENT COMMENT '自增主键',
`order_id` bigint NOT NULL COMMENT '订单自增主键',
`order_code` varchar(40) NOT NULL COMMENT '订单编号',
`market_id` bigint DEFAULT NULL COMMENT '市场id',
`coupon_id` bigint NOT NULL COMMENT '优惠券id',
`coupon_code` varchar(40) NOT NULL COMMENT '优惠券编码',
`fund_item` bigint DEFAULT NULL COMMENT '资金项id',
`fund_item_name` varchar(40) DEFAULT NULL COMMENT '资金项名称',
`item_id` bigint DEFAULT NULL COMMENT '费用项id',
`item_name` varchar(40) DEFAULT NULL COMMENT '费用项名称',
`amount` bigint NOT NULL COMMENT '优惠金额',
`create_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '创建时间',
`modified_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '更新时间',
`state` tinyint NOT NULL COMMENT '状态',
`relation_id` bigint DEFAULT NULL COMMENT '红冲关联id',
`order_status` tinyint DEFAULT NULL COMMENT '单据类型',
PRIMARY KEY (`id`) USING BTREE,
KEY `orderId` (`order_id`,`order_code`) USING BTREE
) ENGINE = InnoDB COMMENT = '电子交易订单-优惠券';
-- ----------------------------
-- Table structure for order_delivery 订单配送单
-- ----------------------------
DROP TABLE IF EXISTS `order_delivery`;
CREATE TABLE `order_delivery` (
`id` bigint NOT NULL AUTO_INCREMENT,
`order_id` bigint NOT NULL COMMENT '订单主键',
`order_code` varchar(40) NOT NULL COMMENT '订单编码',
`market_id` bigint DEFAULT NULL COMMENT '订单市场id',
`way_state` tinyint NOT NULL COMMENT '订单配送状态(1待配送,2已配送,3配送中)',
`state` tinyint DEFAULT '1' COMMENT '配送单状态',
`address` varchar(150) NOT NULL COMMENT '配送地址',
`way_type` tinyint DEFAULT NULL COMMENT '配送方式',
`receiver_phone` varchar(25) DEFAULT NULL COMMENT '收货人电话',
`receiver_name` varchar(50) DEFAULT NULL COMMENT '收货人名称',
`created_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
`modified_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '更新时间',
`province_id` bigint DEFAULT NULL COMMENT '省id',
`province_name` varchar(10) DEFAULT NULL COMMENT '省',
`city_id` bigint DEFAULT NULL COMMENT '城市id',
`city_name` varchar(30) DEFAULT NULL COMMENT '城市',
`district_id` bigint DEFAULT NULL COMMENT '区县id',
`district_name` varchar(30) DEFAULT NULL COMMENT '区县',
`version` int unsigned DEFAULT '1' COMMENT '乐观锁',
`modifier_id` bigint DEFAULT NULL COMMENT '更新人id',
`modifier` varchar(50) DEFAULT NULL COMMENT '更新人名称',
PRIMARY KEY (`id`),
UNIQUE KEY `orderCode` (`order_code`,`state`) USING BTREE
) ENGINE = InnoDB COMMENT = '电子交易订单-配送单';
-- ----------------------------
-- Table structure for order_delivery 订单附加信息
-- ----------------------------
DROP TABLE IF EXISTS `order_extra`;
CREATE TABLE `order_extra` (
`id` bigint NOT NULL AUTO_INCREMENT,
`order_id` bigint DEFAULT NULL COMMENT '订单主键',
`order_code` varchar(40) DEFAULT NULL COMMENT '订单编码',
`market_id` bigint DEFAULT NULL COMMENT '订单市场id',
`user_mark` varchar(64) DEFAULT NULL COMMENT '创建订单标识 小程序openId,app是安卓id',
`source` tinyint DEFAULT NULL COMMENT '订单来源',
`created_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
`modified_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '更新时间',
PRIMARY KEY (`id`)
) ENGINE=InnoDB COMMENT = '电子交易订单-附加信息';
-- ----------------------------
-- Table structure for order_goods 订单商品
-- ----------------------------
DROP TABLE IF EXISTS `order_goods`;
CREATE TABLE `order_goods` (
`id` bigint NOT NULL AUTO_INCREMENT COMMENT '自增id',
`market_id` bigint NOT NULL COMMENT '市场自增id',
`order_id` bigint NOT NULL COMMENT '交易订单自增id',
`order_code` varchar(60) NOT NULL COMMENT '交易订单号',
`product_id` bigint NOT NULL COMMENT '商品自增id',
`product_code` varchar(60) DEFAULT NULL COMMENT '商品编码',
`product_category_id` bigint DEFAULT NULL COMMENT '商品品类',
`product_name` varchar(64) DEFAULT NULL COMMENT '商品名称',
`product_price` bigint DEFAULT NULL COMMENT '商品单价 分/千克',
`product_total_price` bigint DEFAULT NULL COMMENT '商品总价 分',
`product_weight` bigint NOT NULL COMMENT '重量,单位克',
`product_pieces` bigint DEFAULT NULL COMMENT '10倍件数,真实件数为该数值的1/10',
`product_piece_weight` bigint DEFAULT NULL COMMENT '件重,单位克',
`product_piece_price` bigint DEFAULT NULL COMMENT '件价,分/件',
`product_coupon_amount` bigint DEFAULT NULL COMMENT '订单商品分摊优惠金额',
`product_trade_type` tinyint NOT NULL COMMENT '商品交易类型 按重交易1 ,按件交易2',
`product_img_url` varchar(200) DEFAULT NULL COMMENT '商品图片地址',
`state` tinyint DEFAULT NULL COMMENT '状态(0已作废,1正常)',
`created_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
`modified_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '更新时间',
`version` int DEFAULT NULL COMMENT '版本号',
`product_seller_fee` bigint DEFAULT NULL COMMENT '商品卖方手续费',
`product_seller_fee_state` tinyint DEFAULT NULL COMMENT '商品卖方手续费缴费状态',
`code` varchar(40) DEFAULT NULL COMMENT '子单号',
`relation_id` bigint DEFAULT NULL COMMENT '红冲关联id',
`order_status` tinyint DEFAULT NULL COMMENT '单据类型',
`sales_mode` tinyint unsigned NOT NULL DEFAULT '1' COMMENT '销售类型(1单价,2总价)',
PRIMARY KEY (`id`) USING BTREE,
KEY `productid` (`product_id`) USING BTREE,
KEY `orderId` (`order_id`,`market_id`) USING BTREE,
KEY `orderCode` (`order_code`) USING BTREE
) ENGINE = InnoDB COMMENT = '电子交易订单-商品';
-- ----------------------------
-- Table structure for order_payment
-- ----------------------------
DROP TABLE IF EXISTS `order_payment`;
CREATE TABLE `order_payment` (
`id` bigint NOT NULL AUTO_INCREMENT COMMENT '自增id',
`code` varchar(60) NOT NULL COMMENT '付款单编号',
`order_id` bigint NOT NULL COMMENT '交易订单自增id',
`order_code` varchar(60) NOT NULL COMMENT '交易订单编号',
`market_id` bigint NOT NULL COMMENT '市场id',
`pay_amount` bigint NOT NULL COMMENT '本次付款总额(应付款,非实际付款)',
`pay_discount` bigint NOT NULL COMMENT '本次付款优惠总额',
`payer_customer_id` bigint DEFAULT NULL COMMENT '付款方客户id',
`payer_store_customer_id` bigint DEFAULT NULL COMMENT '付款方常客id',
`payer_customer_name` varchar(50) DEFAULT NULL COMMENT '付款方名称',
`payer_card_no` varchar(20) DEFAULT NULL COMMENT '付款方卡号',
`payer_account_id` bigint DEFAULT NULL COMMENT '付款方卡账户id',
`payer_fund_account_id` bigint DEFAULT NULL COMMENT '付款方资金账户id',
`payee_shop_id` bigint DEFAULT NULL COMMENT '收款店铺id',
`payee_shop_name` varchar(50) DEFAULT NULL COMMENT '收款店铺名称',
`payee_card_no` varchar(20) DEFAULT NULL COMMENT '收款卡号',
`payee_account_id` bigint DEFAULT NULL COMMENT '收款卡账户id',
`payee_fund_account_id` bigint DEFAULT NULL COMMENT '收款卡资金账户id',
`payee_seller_id` bigint DEFAULT NULL COMMENT '收款店员id',
`payee_seller_name` varchar(50) DEFAULT NULL COMMENT '收款店员',
`pay_time` datetime DEFAULT NULL COMMENT '付款时间',
`pay_mode` int DEFAULT NULL COMMENT '支付模型(1支付,2赊销)',
`pay_channel` int DEFAULT NULL COMMENT '记账支付类型(1现金,2微信,3支付宝,4园区卡,5二维码赊销,6常客赊销)',
`version` int DEFAULT NULL COMMENT '乐观锁',
`created_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
`modified_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '更新时间',
`state` tinyint DEFAULT NULL COMMENT '状态(0已作废,1待支付,2支付完成,3已取消)',
`trade_id` varchar(40) DEFAULT NULL COMMENT '内部交易流水号',
`totle_seller_fee` bigint DEFAULT NULL COMMENT '卖方手续费总计',
`seller_fee_state` tinyint DEFAULT NULL COMMENT '卖方手续费缴费状态',
`order_status` tinyint DEFAULT NULL COMMENT '单据类型',
`relation_id` bigint DEFAULT NULL COMMENT '关联id',
PRIMARY KEY (`id`) USING BTREE,
KEY `orderId` (`order_id`,`market_id`) USING BTREE,
KEY `shop` (`payee_shop_id`,`pay_channel`) USING BTREE,
KEY `sellerId` (`payee_seller_id`) USING BTREE
) ENGINE = InnoDB COMMENT = '电子交易订单-结算单';
-- ----------------------------
-- Table structure for order_payment_fee
-- ----------------------------
DROP TABLE IF EXISTS `order_payment_fee`;
CREATE TABLE `order_payment_fee` (
`id` bigint NOT NULL AUTO_INCREMENT COMMENT '自增id',
`payment_id` bigint DEFAULT NULL COMMENT '订单结算单自增id',
`payment_code` varchar(40) DEFAULT NULL COMMENT '订单结算单号',
`order_id` bigint NOT NULL COMMENT '订单主键',
`order_code` varchar(50) NOT NULL COMMENT '订单编码',
`item_id` bigint DEFAULT NULL COMMENT '费用项id',
`item_name` varchar(50) DEFAULT NULL COMMENT '费用项名称',
`market_id` bigint DEFAULT NULL COMMENT '市场主键',
`amount` bigint NOT NULL COMMENT '金额',
`fund_item` bigint DEFAULT NULL COMMENT '资金项id',
`fund_item_name` varchar(50) DEFAULT NULL COMMENT '资金项名称',
`fee_type` int NOT NULL COMMENT '费用类型(1费用,2优惠)',
`order_good_id` bigint DEFAULT NULL COMMENT '商品id',
`create_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
`modified_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '更新时间',
`rule_id` bigint DEFAULT NULL COMMENT '规则id',
`rule_name` varchar(100) DEFAULT NULL COMMENT '规则名称',
`his_rule_id` bigint DEFAULT NULL COMMENT '历史规则id',
PRIMARY KEY (`id`) USING BTREE,
KEY `ordergoods` (`order_good_id`) USING BTREE,
KEY `orderid` (`order_id`) USING BTREE
) ENGINE = InnoDB COMMENT = '电子交易订单-结算单费用项';
DROP TABLE IF EXISTS `ledger`;
CREATE TABLE `ledger` (
`id` bigint(0) NOT NULL AUTO_INCREMENT COMMENT '主键id',
`created_time` datetime(0) NOT NULL ON UPDATE CURRENT_TIMESTAMP(0) COMMENT '创建时间',
`modified_time` datetime(0) NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP(0) COMMENT '更新时间',
`state` tinyint(0) NOT NULL COMMENT '状态(未回款1,部分回款2,已回款3)',
`version` tinyint(0) NULL DEFAULT 1 COMMENT '版本号',
`shop_id` bigint(0) NOT NULL COMMENT '店铺ID',
`amount` bigint(0) NULL DEFAULT 0 COMMENT '待付金额',
`pay_amount` bigint(0) NULL DEFAULT 0 COMMENT '已付金额',
`total_amount` bigint(0) NOT NULL COMMENT '应付总金额',
`customer_id` bigint(0) NULL DEFAULT NULL COMMENT '客户id(买家)',
`customer_name` varchar(40) DEFAULT NULL COMMENT '客户名称',
`customer_cellphone` varchar(20) DEFAULT NULL COMMENT '客户电话',
`market_id` bigint(0) NULL DEFAULT NULL COMMENT '市场id',
`store_customer_id` bigint(0) NULL DEFAULT NULL COMMENT '常客id',
`order_type` tinyint(0) NOT NULL COMMENT '订单类型(1买方订单,2卖方订单)',
PRIMARY KEY (`id`) USING BTREE
) ENGINE = InnoDB AUTO_INCREMENT = 3 COMMENT = '应收-应付主表' ROW_FORMAT = Dynamic;
DROP TABLE IF EXISTS `ledger_log`;
CREATE TABLE `ledger_log` (
`id` bigint(0) NOT NULL AUTO_INCREMENT COMMENT '主键',
`created_time` datetime(0) NOT NULL ON UPDATE CURRENT_TIMESTAMP(0) COMMENT '创建时间',
`modified_time` datetime(0) NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP(0) COMMENT '更新时间',
`code` varchar(50) NOT NULL COMMENT '编号',
`ledger_id` bigint(0) NOT NULL COMMENT '应付-应收主表Id',
`type` tinyint(0) NOT NULL COMMENT '回款方式(回款记账:1 , 地利通回款:2)',
`amount` bigint(0) NOT NULL COMMENT '回款金额',
`trade_id` varchar(40) DEFAULT NULL COMMENT '交易订单号',
`creater` varchar(40) DEFAULT NULL COMMENT '创建人名称',
`creater_id` bigint(0) NULL DEFAULT NULL COMMENT '创建人id',
`payable_time` datetime(0) NULL DEFAULT NULL COMMENT '回款时间',
`customer_card_no` varchar(40) DEFAULT NULL COMMENT '客户(买家)园区卡号',
`customer_name` varchar(40) DEFAULT NULL COMMENT '客户名称',
`customer_id` bigint(0) NULL DEFAULT NULL COMMENT '客户Id',
`shop_id` bigint(0) NOT NULL COMMENT '店铺id',
`shop_name` varchar(40) DEFAULT NULL COMMENT '店铺名称',
`contact_name` varchar(40) DEFAULT NULL COMMENT '店铺联系人名称',
`contact_id` bigint(0) NULL DEFAULT NULL COMMENT '店铺联系人id',
`contact_cellphone` varchar(20) DEFAULT NULL COMMENT '店铺联系人电话',
`card_no` varchar(40) DEFAULT NULL COMMENT '店铺收款园区卡号',
`note` varchar(255) DEFAULT NULL COMMENT '备注',
`market_id` bigint(0) NOT NULL COMMENT '市场id',
`version` tinyint(0) NULL DEFAULT 1 COMMENT '版本号',
`state` tinyint(0) NOT NULL COMMENT '状态:未完成回款:1 ,完成回款:2,作废:3',
`store_customer_id` bigint(0) NULL DEFAULT NULL COMMENT '常客id',
`store_customer_name` varchar(40) DEFAULT NULL COMMENT '常客名称',
PRIMARY KEY (`id`) USING BTREE
) ENGINE = InnoDB AUTO_INCREMENT = 33 COMMENT = '应收应付-回款记录表' ROW_FORMAT = Dynamic;
DROP TABLE IF EXISTS `ledger_message`;
CREATE TABLE `ledger_message` (
`id` bigint(0) NOT NULL AUTO_INCREMENT COMMENT '主键id',
`ledger_id` bigint(0) NOT NULL COMMENT '应付-应收主表Id',
`created_time` datetime(0) NOT NULL ON UPDATE CURRENT_TIMESTAMP(0) COMMENT '创建时间',
`modified_time` datetime(0) NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP(0) COMMENT '更新时间',
`state` tinyint(0) NULL DEFAULT NULL COMMENT '状态(目前无法判断状态是否已回款,为二期做预留)',
`version` tinyint(0) NULL DEFAULT 1 COMMENT '版本号',
`business_code` varchar(40) DEFAULT NULL COMMENT '赊销单号',
`amount` bigint(0) NULL DEFAULT NULL COMMENT '赊销金额',
`code_created` datetime(0) NULL DEFAULT NULL COMMENT '赊销单创建时间',
`market_id` bigint(0) NULL DEFAULT NULL COMMENT '市场id',
`customer_id` bigint(0) NULL DEFAULT NULL COMMENT '客户id',
`store_customer_id` bigint(0) NULL DEFAULT NULL COMMENT '常客id',
`shop_id` bigint(0) NULL DEFAULT NULL COMMENT '店铺id',
PRIMARY KEY (`id`) USING BTREE
) ENGINE = InnoDB AUTO_INCREMENT = 1 COMMENT = '应收应付-赊销单记录表' ROW_FORMAT = Dynamic;
-- v1.0.7
DROP TABLE IF EXISTS `order_leave_out`;
CREATE TABLE `order_leave_out` (
`id` bigint NOT NULL AUTO_INCREMENT,
`code` varchar(50) NOT NULL DEFAULT '' COMMENT '出门单编码',
`customer_id` bigint NOT NULL COMMENT '客户id',
`market_id` bigint NOT NULL COMMENT '市场id',
`state` tinyint unsigned NOT NULL DEFAULT '1' COMMENT '状态(0:撤销 1:未验票 2:已验票 3:已过期)',
`deleted` tinyint unsigned NOT NULL DEFAULT '1' COMMENT '删除(0已删除 1未删除)',
`version` int unsigned NOT NULL DEFAULT '1' COMMENT '版本号',
`auditor_id` bigint DEFAULT NULL COMMENT '审核人id',
`audit_result` varchar(255) DEFAULT '' COMMENT '审核结果',
`auditor_name` varchar(50) DEFAULT NULL COMMENT '审核人名称',
`audit_time` datetime DEFAULT NULL COMMENT '审核时间',
`expire_time` datetime DEFAULT NULL COMMENT '过期时间',
`creator_id` bigint NOT NULL COMMENT '创建人id',
`creator_name` varchar(50) NOT NULL DEFAULT '' COMMENT '创建人名称',
`created_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
`modifier_name` varchar(50) DEFAULT '' COMMENT '修改人名称',
`modified_time` datetime DEFAULT NULL ON UPDATE CURRENT_TIMESTAMP COMMENT '修改时间',
PRIMARY KEY (`id`),
KEY `idx_code` (`code`) USING BTREE COMMENT '出门单号',
KEY `idx_create_time` (`created_time`) USING BTREE COMMENT '创建时间',
KEY `idx_autime` (`audit_time`) USING BTREE COMMENT '审核时间',
KEY `idx_customer` (`customer_id`) USING BTREE COMMENT '客户id'
) ENGINE=InnoDB COMMENT='订单-出门单基本信息';
DROP TABLE IF EXISTS `order_leave_out_detail`;
CREATE TABLE `order_leave_out_detail` (
`id` bigint unsigned NOT NULL AUTO_INCREMENT,
`leave_out_id` bigint NOT NULL COMMENT '出门单主键id',
`order_id` bigint NOT NULL COMMENT '订单id',
`order_code` varchar(50) NOT NULL DEFAULT '' COMMENT '订单编码',
`order_goods_id` bigint NOT NULL COMMENT '订单商品主键id',
`order_project_id` bigint NOT NULL COMMENT '关联商品主键id',
`repeal` bigint unsigned NOT NULL DEFAULT '0' COMMENT '撤销(0正常 1...撤销)',
PRIMARY KEY (`id`),
UNIQUE KEY `unq_order_good` (`order_id`,`order_goods_id`,`repeal`) USING BTREE COMMENT '订单+商品唯一索引',
KEY `idx_out_id` (`leave_out_id`) USING BTREE COMMENT '出门单id'
) ENGINE=InnoDB COMMENT='订单-出门单关联订单(1:N)';
DROP TABLE IF EXISTS `order_goods_mark`;
CREATE TABLE `order_goods_mark` (
`id` bigint NOT NULL AUTO_INCREMENT COMMENT '自增id',
`market_id` bigint DEFAULT NULL COMMENT '市场自增id',
`order_id` bigint DEFAULT NULL COMMENT '交易订单自增id',
`order_code` varchar(60) DEFAULT NULL COMMENT '交易订单号',
`order_state` tinyint DEFAULT NULL COMMENT '订单状态',
`product_id` bigint DEFAULT NULL COMMENT '商品自增id',
`order_goods_id` bigint NOT NULL COMMENT '订单商品id',
`product_code` varchar(60) DEFAULT NULL COMMENT '商品编码',
`product_category_id` bigint DEFAULT NULL COMMENT '商品品类',
`product_name` varchar(64) DEFAULT NULL COMMENT '商品名称',
`product_price` decimal(20,2) DEFAULT NULL COMMENT '商品单价',
`product_total_price` decimal(20,2) DEFAULT NULL COMMENT '商品总价',
`product_weight` decimal(20,2) DEFAULT NULL COMMENT '商品重量',
`version` int DEFAULT NULL COMMENT '版本号',
`shop_id` bigint DEFAULT NULL COMMENT '店铺id',
`shop_name` varchar(50) DEFAULT NULL COMMENT '店铺名称',
`shop_customer_id` bigint DEFAULT NULL COMMENT '店铺所属用户id',
`shop_customer` varchar(50) DEFAULT NULL COMMENT '店铺商户名称',
`category_first` bigint DEFAULT NULL COMMENT '一级品类',
`category_first_name` varchar(32) DEFAULT NULL COMMENT '一级品类名称',
`category_second` bigint DEFAULT NULL COMMENT '二级品类',
`category_second_name` varchar(32) DEFAULT NULL COMMENT '二级品类名称',
`category_third` bigint DEFAULT NULL COMMENT '三级品类',
`category_third_name` varchar(32) DEFAULT NULL COMMENT '三级品类名称',
`category_json` json DEFAULT NULL COMMENT '品类路径',
`category_json_name` json DEFAULT NULL COMMENT '品类路径名称',
`mark` varchar(40) DEFAULT NULL COMMENT '异常提示',
`pay_time` datetime DEFAULT NULL COMMENT '支付时间',
`price_low_limit` decimal(20,2) DEFAULT NULL COMMENT '单价下限',
`price_up_limit` decimal(20,2) DEFAULT NULL COMMENT '单价上限',
`totle_low_limit` decimal(20,2) DEFAULT NULL COMMENT '总价下限',
`totle_up_limit` decimal(20,2) DEFAULT NULL COMMENT '总价上限',
`weight_low_limit` decimal(20,2) DEFAULT NULL COMMENT '重量下限',
`weight_up_limit` decimal(20,2) DEFAULT NULL COMMENT '重量上限',
`price_error` tinyint DEFAULT NULL COMMENT '1单价异常',
`weight_error` tinyint DEFAULT NULL COMMENT '1重量异常',
`totle_error` tinyint DEFAULT NULL COMMENT '1金额异常',
`state` tinyint DEFAULT NULL COMMENT '2原始单据,3人工处理',
`operator` varchar(50) DEFAULT NULL COMMENT '操作人',
`operator_id` bigint DEFAULT NULL COMMENT '操作人id',
`operate_time` datetime DEFAULT NULL COMMENT '操作时间',
`operate_type` tinyint DEFAULT NULL COMMENT '操作类型(1正常销售,2零售(小批),3精品加工,4特价促销,5尾货(次品),6其他)',
`notice` varchar(100) DEFAULT NULL COMMENT '备注',
`create_time` datetime DEFAULT NULL COMMENT '拉取时间',
PRIMARY KEY (`id`) USING BTREE,
KEY `productid` (`product_id`) USING BTREE,
KEY `orderCode` (`order_code`) USING BTREE,
KEY `categoryId` (`product_category_id`),
KEY `thirdid` (`category_third`)
) ENGINE=InnoDB COMMENT='电子交易订单-商品-异常标记';