Database design of electronic business platform

The following is a summary of experience in database design their own orders in the electronic commerce system design module, now published to share them, if inappropriate, welcomed the discussion thread ~

Orders table (the Order)
| - automatic numbering (order_id, an increase from the primary key)
| - Order a single number (order_no, unique value for customer inquiries)
| - Store ID (shop_id, store table automatic number)
| - Orders state (order_status, unpaid, paid, shipped, receipt, return the application, in return, has returned to cancel the transaction)
| - quantity (product_count, the number of commodity items, not a commodity)
| - total (product_amount_total)
| - order amount (order_amount_total, the actual payment amount)
| - freight amounts (logistics_fee)
| - whether box inspection (is_unpacking_inspection)
| - whether billing (if invoiced)
| - invoice number ( orders invoices table automatic number)
| - shipping address number (address_id, shipping address tables are automatically numbered)
| - Order logistics number (orderlogistics_id, Order logistics tables are automatically numbered)
| - Order payment channels (pay_channel)
| - orders to pay a single number (out_trade_no / escrow_trade_no, third-party payment serial number)
| - creation time (single time)
| - payment time
| - delivery time
| - customer ID (user_id, user tables are automatically numbered)
| - customer Note
| - order settlement status (order_settlement_status, cash on delivery, payment by installments will be used)
| - order settlement time (order_settlement_time)

Orders Invoices table (order_invoice)
| - automatic numbering (INVOICE_ID)
| - order number (order_id)
| - whether VAT invoice (is_vat, general invoices, value-added invoices)
| - Invoice name (invoice_title)
| - invoice contents (invoice_content)
| - invoice amount (INVOICE_AMOUNT)
| - invoice tax ID (invoice_tax_no)
| - billing taxes (invoice_tax)
| - company name [VAT] (vat_company_name)
| - address [value-added tax] (vat_company_address)
| - telephone [VAT] (vat_telphone)
| - Bank [VAT] (vat_bank_name)
| - Bank account [VAT] (vat_bank_account)
| - billing time (created_time)

Order Logistics table (order_logistics)
| - automatic numbering (orderlogistics_id)
| - order number (order_id, order form automatic number)
| - logistics a single number (express_no, delivery express a single number)
| - consignee name ( consignee_realname, shipping address table may be updated or deleted, and therefore recorded here)
| - telephone (consignee_telphone, shipping address table may be updated or deleted, and therefore recorded here)
| - standby phone (consignee_telphone2, income cargo address table may be updated or deleted, and therefore recorded here)
| - shipping address (consignee_address, shipping address table may be updated or deleted, and therefore recorded here)
| - zip code (consignee_zip, shipping address table may be updated or deleted, and therefore recorded here)
| - logistics methods (logistics_type, EMS, Express)
| - logistics business number (logistics_id, logistics and business tables are automatically numbered)
| - logistics shipping freight (logistics_fee, to show customer orders shipping)
| - express payment collection rates (agency_fee, courier collection of money rates, such as 2% -5% of the value, usually monthly)
| - gold logistics costs (delivery_amount, the amount actually paid to the logistics company)
| - Logistics state (orderlogistics_status)
| - Logistics settlement status (logistics_settlement_status, unsettled, settled, partial settlement)
| - Logistics last state description (logistics_result_last)
| - Logistics Description (logistics_result)
| - delivery time (logistics_create_time)
| - Logistics update time (logistics_update_time)
| - logistics settlement time (logistics_settlement_time)
| - logistics payment channels
| - logistics pay a single number
| - logistics company reconciled status (reconciliation_status, has been reconciled, unreconciled)
| - logistics company reconciliation date (reconciliation_time)
description: delivery address may be modified, deleted, etc., and therefore here to record the user's shipping address when shipped, so even if later delivery address is deleted, users in order to view the history of time We would still be able to see a snapshot of information shipping address.

Orders return form (order_returns)
| - automatic numbering (order_returns_id)
| - Returns number (returns_no, for customer inquiries)
| - order number (order_id, order form automatic number)
| - logistics a single number (express_no, return logistics single number)
| - the consignee's name (consignee_realname)
| - telephone (consignee_telphone)
| - standby phone (consignee_telphone2)
| - shipping address (consignee_address)
| - zip code (consignee_zip)
| - logistics mode (logistics_type, EMS, Express)
| - logistics business number
| - logistics shipping freight (logistics_fee, return shipping)
| - logistics state (orderlogistics_status)
| - logistics last state description
| - logistics description
| - - logistics updated
| - logistics and delivery time
| - return type (returns_type, all chargeback, chargeback part)
| - Return handling (handling_way, PUPAWAY: return storage; REDELIVERY: redeliver; RECLAIM- REDELIVERY: does not require the return and re-delivery; rEFUND: refund; cOMPENSATION: no return and compensation)
| - Refund Amount (returns_amount)
| - bear the cost of return salesman (seller_punish_fee)
| - Return Request Time (return_submit_time)
| - Return Processing Time (handling_time)
| - Reason for return
Design Description: Returns may be modify, delete, etc., so the return address information to be recorded here when businesses return,

Product Details Orders table (Order_Detail)
| - automatic numbering
| - order number
| - Product Code
| - product name (product_name, merchandise may be removed, so there is to be recorded, can not directly read product table)
| - Commodity prices (product_price, goods may be deleted, to be recorded here)
| - product model (product_marque, front desk to show to the customer)
| - product barcode (product_store_barcode, goods warehouse bar code)
| - product information model (product_mode_desc, record detailed product model such as color, size, packaging, etc.)
| - product model parameters (product_mode_params, JSON format, recording unit number, color number, size number, etc.)
| - a percentage off (discount_rate hit a few off)
| - discount amount (discount_amount )
| - quantity (number the)
| - Subtotal amount (the SUBTOTAL)
| - commodity is valid (is_product_exists)
| - customer goods remarks (remark)
design: product may be modified, deleted, etc., and therefore here record commodity trading summary information when single-user concerns, such as price, quantity, type, model parameters. So even if the goods were later deleted, the user viewing order history, also still be able to see a snapshot of information about the products.

Shipping address table (delivery_address)
| - automatic numbering (address_id)
| - User ID (user_id, user tables are automatically numbered)
| - recipient name (realname)
| - Phone (Cellphone)
| - spare telephone (telphone2)
| - national (country)
| - province (province)
| - urban (city)
| - area (area)
| - street / shipping address (street)
| - zip code (ZIP)
| - if default shipping address (is_default_address)
| - creation time (created_time)

Cart table (shoppingcart)
| - automatic numbering (the above mentioned id)
| - User ID (user_id)
| - Store ID (shop_id)
| - Product Number (product_id)
| - is valid (is_product_exists)
| - Buy number (number The)
| - creation time (created_time)
design Description: commodity prices and the subtotal amount is to be read and calculate in real time the related item table, since merchants may change in commodity prices, or merchandise has been sold, or merchandise off the shelf and so on, so here only need to record commodity id can, commodity prices and other real-time access to goods from the table.

=Orders expansion module designed for telemarketing========

Order business review process table (order_auditbiz)
| - automatic numbering (order_auditbiz_id)
| - order number (order_id)
| - Order Status (0: not audit or initiate a transaction; 1: completion of the transaction; 20: Nuclear single pass; 24 : nuclear single failure; 30: shipped; not to sign; 34: warehouse to return; 40: agent canceled; 41: buyers canceled; 42: late cancellations; 43: invalid orders canceled; 50: customer sign; 54: customer refused ; 55: customer Returns)
| - sales staff directly to confirm the order (the order does not require the auditor to confirm directly enforce approved, such as the customer returns the salesperson must bear the return shipping costs) (is_seller_risk_confirm)
| - order returns, whether salesman bear the freight (is_seller_punish
_logistics_fee)
| - whether the commission salesman (is_seller_commission)
| - salesperson commission percentage (seller_commission_rate, the non-commissioned fill 0)
| - salesman commission amount (seller_commission_amount)
| - salesman order notes ( seller_remark, to order the auditor to see Remarks)
| - orders auditor order notes (confirmer_remark, to the warehouse to see Remarks)
| - warehouse Remarks (storekeeper_returnback_remark, warehouse back to the order review See Remarks)
| - Financial Notes (cashier_remark, financial salespeople to see Remarks)
| - salesman user number (seller_uid)
| - Orders auditor user number (auditor_uid)
| - payee user number (cashier_uid, the recipient is not necessarily financial)
| - Financial user number (accountant_uid, financial officers user ID)
| - Order Source ( order_source, sales orders, purchase inside)
| - orders auditor audit time (auditor_audited_time)
| - warehouse workers audit time (storekeeper_audited_time)
| - financial audit time (accountant_audited_time)

Orders commission table (order_commission)
| - automatic numbering (order_commission_id)
| - order number (order_id)
| - salesman user number (seller_uid)
| - commission amount (commission_amount)
| - Settlement Status (settlement_status)
| - - settlement time (settlement_time)
| - financial officers user number (cashier_uid)

Orders schedule (order_dispatch)
| - automatic numbering
| - order number
| - scheduled marketers user number (from_seller_uid)
| - Marketers user number (to_seller_uid)
| - scheduling reasons (dispatch_reason)
| - scheduling administrator (diapatch_admin_uid)
| - scheduled date (created_time)

Database design principles are:

  1. To improve the performance of read, write as much as possible to split the operation into another table, because the table update operation will cause the lock table, can degrade performance data read table.
  2. Some related information may be modified or deleted at a later time of the transaction, such as trade, shipping address, etc., so the product information and shipping address at the time of the transaction to be recorded in the order, while later when goods or shipping address to be deleted, still be able to see a snapshot of information on the history of the order.
  3. Do not be afraid to split into many tables, reading time associated with multiple tables read, many will be higher than reading a large field of very large amounts of data tables efficiency.
Published an original article · won praise 0 · Views 531

Guess you like

Origin blog.csdn.net/qq_40522470/article/details/104776389