400 lines
13 KiB
Plaintext
400 lines
13 KiB
Plaintext
generator client {
|
|
provider = "prisma-client-js"
|
|
}
|
|
|
|
datasource db {
|
|
provider = "mysql"
|
|
url = env("DATABASE_URL")
|
|
}
|
|
|
|
model User {
|
|
id Int @id @default(autoincrement())
|
|
mobile String @unique
|
|
nickname String?
|
|
avatarUrl String?
|
|
points Int @default(0)
|
|
createdAt DateTime @default(now())
|
|
updatedAt DateTime @updatedAt
|
|
|
|
carts CartItem[]
|
|
}
|
|
|
|
model SupplierProduct {
|
|
id Int @id @default(autoincrement())
|
|
sku String @unique
|
|
number Int @default(0)
|
|
price Decimal @db.Decimal(10, 2)
|
|
name String
|
|
taxRate Decimal @default(0.13) @db.Decimal(5, 4)
|
|
picInfo Json?
|
|
description String?
|
|
detail String?
|
|
originPrice Decimal? @db.Decimal(10, 2)
|
|
imageUrl String?
|
|
categoryId String?
|
|
category String?
|
|
tag String?
|
|
sales String?
|
|
stock Int @default(0)
|
|
sortOrder Int @default(0)
|
|
enabled Boolean @default(true)
|
|
deleted Int @default(0)
|
|
createdAt DateTime @default(now())
|
|
updatedAt DateTime @updatedAt
|
|
|
|
carts CartItem[]
|
|
|
|
@@map("supplier_product")
|
|
}
|
|
|
|
model SupplierInfo {
|
|
id Int @id @default(autoincrement())
|
|
supplierIdentification String @unique
|
|
supplierId String @unique
|
|
supplierName String
|
|
clientId String
|
|
clientSecret String
|
|
supplierApiUrl String?
|
|
sroNo String?
|
|
createTime DateTime @default(now())
|
|
updateTime DateTime @updatedAt
|
|
creator String?
|
|
updator String?
|
|
version Int @default(0)
|
|
deleted Int @default(0)
|
|
|
|
@@map("supplier_info")
|
|
}
|
|
|
|
model CartItem {
|
|
id Int @id @default(autoincrement())
|
|
userId Int
|
|
productId Int
|
|
skuText String?
|
|
quantity Int @default(1)
|
|
createdAt DateTime @default(now())
|
|
updatedAt DateTime @updatedAt
|
|
|
|
user User @relation(fields: [userId], references: [id], onDelete: Cascade)
|
|
product SupplierProduct @relation(fields: [productId], references: [id], onDelete: Cascade)
|
|
|
|
@@unique([userId, productId, skuText])
|
|
}
|
|
|
|
model SupplierOrderMain {
|
|
id Int @id @default(autoincrement())
|
|
orderId String @unique
|
|
orderNumberId String?
|
|
supplierId String
|
|
userId String?
|
|
aplName String?
|
|
addressId String?
|
|
remark String? @db.Text
|
|
createTime DateTime?
|
|
updateTime DateTime?
|
|
payTime DateTime?
|
|
deliveryTime DateTime?
|
|
orderFinishTime DateTime?
|
|
completeTime DateTime?
|
|
deliveryStatus String?
|
|
freightCost Decimal @default(0) @db.Decimal(10, 2)
|
|
wPayOrAPayFreightCost Decimal @default(0) @db.Decimal(10, 2)
|
|
refund Decimal @default(0) @db.Decimal(10, 2)
|
|
wPayOrAPayRefund Decimal @default(0) @db.Decimal(10, 2)
|
|
logisticsOrderId String?
|
|
crrgBsnNm String?
|
|
orderState Int @default(0)
|
|
isSplit Int @default(0)
|
|
splitTime DateTime?
|
|
totalPrice Decimal @default(0) @db.Decimal(10, 2)
|
|
wPayOrAPay Decimal @default(0) @db.Decimal(10, 2)
|
|
pointsPrice Decimal @default(0) @db.Decimal(10, 2)
|
|
invoiceCode String?
|
|
createAt DateTime @default(now())
|
|
updateAt DateTime @updatedAt
|
|
deleted Int @default(0)
|
|
|
|
subOrders SupplierOrderSub[]
|
|
|
|
@@map("supplier_order_main")
|
|
}
|
|
|
|
model SupplierOrderSub {
|
|
id Int @id @default(autoincrement())
|
|
orderId String @unique
|
|
orderNumberId String?
|
|
mainOrderId String
|
|
supplierId String
|
|
token String?
|
|
userId String?
|
|
aplName String?
|
|
addressId String?
|
|
remark String? @db.Text
|
|
createTime DateTime?
|
|
updateTime DateTime?
|
|
payTime DateTime?
|
|
deliveryTime DateTime?
|
|
orderFinishTime DateTime?
|
|
completeTime DateTime?
|
|
deliveryStatus String?
|
|
freightCost Decimal @default(0) @db.Decimal(10, 2)
|
|
wPayOrAPayFreightCost Decimal @default(0) @db.Decimal(10, 2)
|
|
refund Decimal @default(0) @db.Decimal(10, 2)
|
|
wPayOrAPayRefund Decimal @default(0) @db.Decimal(10, 2)
|
|
logisticsOrderId String?
|
|
crrgBsnNm String?
|
|
orderState Int @default(0)
|
|
totalPrice Decimal @default(0) @db.Decimal(10, 2)
|
|
wPayOrAPay Decimal @default(0) @db.Decimal(10, 2)
|
|
pointsPrice Decimal @default(0) @db.Decimal(10, 2)
|
|
invoiceCode String?
|
|
createAt DateTime @default(now())
|
|
updateAt DateTime @updatedAt
|
|
deleted Int @default(0)
|
|
|
|
mainOrder SupplierOrderMain @relation(fields: [mainOrderId], references: [orderId], onDelete: Cascade)
|
|
products SupplierOrderProduct[]
|
|
|
|
@@index([mainOrderId])
|
|
@@map("supplier_order_sub")
|
|
}
|
|
|
|
model SupplierReconciliationOrder {
|
|
id Int @id @default(autoincrement())
|
|
supplierId String
|
|
orderId String
|
|
mainOrderId String?
|
|
userId String?
|
|
reconciliationStatus Int @default(0)
|
|
diffType Int?
|
|
diffReason String? @db.Text
|
|
platformTotalPrice Decimal? @db.Decimal(12, 2)
|
|
platformCashAmount Decimal? @db.Decimal(12, 2)
|
|
platformPointsPrice Decimal? @db.Decimal(12, 2)
|
|
platformRefundPrice Decimal? @db.Decimal(12, 2)
|
|
supplierTotalPrice Decimal? @db.Decimal(12, 2)
|
|
supplierCashAmount Decimal? @db.Decimal(12, 2)
|
|
supplierPointsPrice Decimal? @db.Decimal(12, 2)
|
|
supplierRefundPrice Decimal? @db.Decimal(12, 2)
|
|
reconciliationBatchNo String?
|
|
reconciliationTime DateTime?
|
|
resultPayload Json?
|
|
createAt DateTime @default(now())
|
|
updateAt DateTime @updatedAt
|
|
deleted Int @default(0)
|
|
|
|
@@unique([supplierId, orderId])
|
|
@@index([supplierId, reconciliationStatus])
|
|
@@index([reconciliationBatchNo])
|
|
@@index([mainOrderId])
|
|
@@map("supplier_reconciliation_order")
|
|
}
|
|
|
|
model SupplierOrderProduct {
|
|
id Int @id @default(autoincrement())
|
|
subOrderId String
|
|
sku String
|
|
number Int
|
|
price Decimal @db.Decimal(10, 2)
|
|
name String
|
|
taxRate Decimal @default(0.13) @db.Decimal(5, 4)
|
|
productImgUrl String?
|
|
fileId String?
|
|
filePath String?
|
|
picInfo Json?
|
|
createAt DateTime @default(now())
|
|
updateAt DateTime @updatedAt
|
|
deleted Int @default(0)
|
|
|
|
subOrder SupplierOrderSub @relation(fields: [subOrderId], references: [orderId], onDelete: Cascade)
|
|
|
|
@@index([subOrderId])
|
|
@@map("supplier_order_product")
|
|
}
|
|
|
|
model SupplierUserAddress {
|
|
id Int @id @default(autoincrement())
|
|
addressId String @unique
|
|
supplierId String
|
|
userId String
|
|
name String
|
|
tel String
|
|
province String?
|
|
city String?
|
|
county String?
|
|
addressDetail String? @db.Text
|
|
areaCode String?
|
|
postalCode String?
|
|
isDefault Boolean @default(false)
|
|
createTime DateTime @default(now())
|
|
updateTime DateTime @updatedAt
|
|
deleted Int @default(0)
|
|
|
|
@@index([supplierId, userId])
|
|
@@index([supplierId, userId, isDefault])
|
|
@@map("supplier_user_address")
|
|
}
|
|
|
|
model SupplierPointsLedger {
|
|
id Int @id @default(autoincrement())
|
|
ledgerNo String @unique
|
|
supplierId String
|
|
userId String
|
|
mainOrderId String?
|
|
subOrderId String?
|
|
bizType Int
|
|
direction Int
|
|
points Decimal @db.Decimal(10, 2)
|
|
beforePoints Decimal? @db.Decimal(10, 2)
|
|
afterPoints Decimal? @db.Decimal(10, 2)
|
|
remark String? @db.Text
|
|
createTime DateTime @default(now())
|
|
updateTime DateTime @updatedAt
|
|
deleted Int @default(0)
|
|
|
|
@@index([supplierId, userId])
|
|
@@index([mainOrderId])
|
|
@@index([subOrderId])
|
|
@@map("supplier_points_ledger")
|
|
}
|
|
|
|
model SupplierOrderPushLog {
|
|
id Int @id @default(autoincrement())
|
|
supplierId String
|
|
userId String?
|
|
mainOrderId String?
|
|
orderId String? @db.VarChar(1000)
|
|
orderType Int?
|
|
apiPath String
|
|
requestBody Json?
|
|
responseBody Json?
|
|
httpStatus Int?
|
|
resultCode Int?
|
|
pushStatus Int @default(0)
|
|
retryCount Int @default(0)
|
|
errorMessage String? @db.Text
|
|
lastPushTime DateTime?
|
|
nextRetryTime DateTime?
|
|
createTime DateTime @default(now())
|
|
updateTime DateTime @updatedAt
|
|
deleted Int @default(0)
|
|
|
|
@@index([supplierId, mainOrderId])
|
|
@@index([orderType, pushStatus])
|
|
@@index([nextRetryTime])
|
|
@@map("supplier_order_push_log")
|
|
}
|
|
|
|
model SupplierOrderOperateLog {
|
|
id Int @id @default(autoincrement())
|
|
supplierId String
|
|
userId String?
|
|
mainOrderId String?
|
|
subOrderId String?
|
|
operateType Int
|
|
beforeState Int?
|
|
afterState Int?
|
|
beforeSplit Int?
|
|
afterSplit Int?
|
|
remark String? @db.Text
|
|
operator String?
|
|
createTime DateTime @default(now())
|
|
deleted Int @default(0)
|
|
|
|
@@index([supplierId, mainOrderId])
|
|
@@index([subOrderId])
|
|
@@index([operateType])
|
|
@@map("supplier_order_operate_log")
|
|
}
|
|
|
|
model SupplierRefundExchange {
|
|
id Int @id @default(autoincrement())
|
|
serviceOrderId String @unique
|
|
supplierId String
|
|
userId String?
|
|
mainOrderId String?
|
|
subOrderId String?
|
|
serviceType Int
|
|
serviceState Int @default(0)
|
|
amount Decimal @default(0) @db.Decimal(10, 2)
|
|
reason String? @db.Text
|
|
requestBody Json?
|
|
createTime DateTime @default(now())
|
|
updateTime DateTime @updatedAt
|
|
deleted Int @default(0)
|
|
|
|
@@index([supplierId, mainOrderId])
|
|
@@index([subOrderId])
|
|
@@index([serviceType, serviceState])
|
|
@@map("supplier_refund_exchange")
|
|
}
|
|
|
|
model SupplierAfterSale {
|
|
id Int @id @default(autoincrement())
|
|
serviceOrderId String @unique
|
|
supplierId String
|
|
userId String?
|
|
mainOrderId String?
|
|
subOrderId String?
|
|
serviceType Int
|
|
serviceState Int @default(0)
|
|
auditStatus Int @default(0)
|
|
logisticsState Int @default(0)
|
|
amount Decimal @default(0) @db.Decimal(10, 2)
|
|
reason String? @db.Text
|
|
reasonType String?
|
|
problemDescription String? @db.Text
|
|
pickupMethod String?
|
|
pickupName String?
|
|
pickupMobile String?
|
|
pickupAddress String? @db.Text
|
|
images Json?
|
|
auditRemark String? @db.Text
|
|
userLogisticsNo String?
|
|
userLogisticsCompany String?
|
|
merchantLogisticsNo String?
|
|
merchantLogisticsCompany String?
|
|
applyTime DateTime @default(now())
|
|
auditTime DateTime?
|
|
userShipTime DateTime?
|
|
merchantReceiveTime DateTime?
|
|
merchantShipTime DateTime?
|
|
finishTime DateTime?
|
|
requestBody Json?
|
|
createTime DateTime @default(now())
|
|
updateTime DateTime @updatedAt
|
|
deleted Int @default(0)
|
|
|
|
@@index([supplierId, mainOrderId])
|
|
@@index([supplierId, userId])
|
|
@@index([subOrderId])
|
|
@@index([serviceType, serviceState])
|
|
@@index([auditStatus, logisticsState])
|
|
@@map("supplier_after_sale")
|
|
}
|
|
|
|
model SupplierInvoiceInfo {
|
|
id Int @id @default(autoincrement())
|
|
invoiceBizId String @unique
|
|
supplierId String
|
|
userId String?
|
|
mainOrderId String?
|
|
subOrderId String?
|
|
settlementId String?
|
|
invoiceCode String?
|
|
invoiceIds String? @db.VarChar(1000)
|
|
orderIds String? @db.VarChar(1000)
|
|
invoiceStatus Int @default(0)
|
|
fileId String?
|
|
filePath String?
|
|
requestBody Json?
|
|
createTime DateTime @default(now())
|
|
updateTime DateTime @updatedAt
|
|
deleted Int @default(0)
|
|
|
|
@@index([supplierId, mainOrderId])
|
|
@@index([settlementId])
|
|
@@index([invoiceCode])
|
|
@@map("supplier_invoice_info")
|
|
}
|