Files
lone-services/services/order/internal/dao/order.go
T
2026-08-27 17:12:00 +08:00

227 lines
21 KiB
Go

package dao
import (
"lone-services/pkg/utils"
)
const (
OrderPayTypeWechat = 1 //微信
OrderPayTypeAlipay = 2 //支付宝
OrderPayTypeRemaining = 3 //余额
OrderPayStatusOk = 1 //为已支付
OrderPayStatusWait = 2 //为未支付
OrderPayStatusIn = 3 //为支付中
OrderPayStatusFail = 4 //支付失败
OrderPayStatusLose = 5 //已失效
OrderTypeSale = 1 //销售
OrderTypeStore = 2 //为门店
OrderTypePersonal = 3 //为个人
OrderTypeHome = 4 //为个人家庭试用
)
type OrderCreate struct {
Id int64 `gorm:"column:id;type:bigint(20);primary_key;AUTO_INCREMENT" json:"id"`
OrderSn string `gorm:"column:order_sn;type:varchar(100);comment:订单号;NOT NULL" json:"order_sn"`
StoreId int `gorm:"column:store_id;type:int(11);comment:美容院关联ID号" json:"store_id"`
StoreName string `gorm:"column:store_name;type:varchar(50);comment:门店名" json:"store_name"`
SaleName string `gorm:"column:sale_name;type:varchar(50);comment:销售姓名" json:"sale_name"`
SaleMobile string `gorm:"column:sale_mobile;type:char(60);comment:销售电话" json:"sale_mobile"`
SaleProvince int `gorm:"column:sale_province;type:int(11);default:0;comment:销售到的地域" json:"sale_province"`
UserId int `gorm:"column:user_id;type:int(11);comment:用户ID" json:"user_id"`
UserName string `gorm:"column:user_name;type:varchar(255);comment:用户名" json:"user_name"`
SaleId int `gorm:"column:sale_id;type:int(11);comment:销售员ID号" json:"sale_id"`
Mobile string `gorm:"column:mobile;type:char(60);comment:收货人手机号;NOT NULL" json:"mobile"`
Address string `gorm:"column:address;type:varchar(255);comment:收货人地址;NOT NULL" json:"address"`
Addressee string `gorm:"column:addressee;type:varchar(50);comment:收货人姓名;NOT NULL" json:"addressee"`
DistrictIds string `gorm:"column:district_ids;type:varchar(255);comment:地区IDS;NOT NULL" json:"district_ids"`
TotalPrice float64 `gorm:"column:total_price;type:decimal(10,2);comment:总价;NOT NULL" json:"total_price"`
GroupId int `gorm:"column:group_id;type:int(11);default:0" json:"group_id"`
PayPrice float64 `gorm:"column:pay_price;type:decimal(10,2);comment:实际支付金额" json:"pay_price"`
PayType uint8 `gorm:"column:pay_type;type:tinyint(1);default:1;comment:支付类型,1为微信,2为支付宝,3为余额支付" json:"pay_type"`
Status uint8 `gorm:"column:status;type:tinyint(1);default:2;comment:支付状态,1为已支付,2为未支付,3为支付中,4支付失败,5已失效;NOT NULL" json:"status"`
IsSupply uint8 `gorm:"column:is_supply;type:tinyint(1);default:1;comment:是否补过货,1为没有,2为补过" json:"is_supply"`
Note string `gorm:"column:note;type:varchar(255);comment:备注" json:"note"`
VerifyStatus uint8 `gorm:"column:verify_status;type:tinyint(1);default:0;comment:审核状态,1为通过,2为失败,3为待审核,0为正常订单不需要审核" json:"verify_status"`
ExpiredTime utils.CustomTime `json:"expired_time" gorm:"expired_time"` // 过期时间
ProductIds string `gorm:"column:product_ids;type:varchar(150);comment:产品IDs" json:"product_ids"`
CreateType uint8 `gorm:"column:create_type;type:tinyint(1);default:1;comment:下单人类型,1为销售,2为门店,3为个人;NOT NULL" json:"create_type"`
Type uint8 `gorm:"column:type;type:tinyint(1);default:0;comment:类型 1 销售,2为门店,3为个人,4为个人家庭试用,5为个人门店试用" json:"type"`
}
type OrderInfo struct {
Id int64 `gorm:"column:id;type:bigint(20);primary_key;AUTO_INCREMENT" json:"id"`
OrderSn string `gorm:"column:ordersn;type:varchar(100);comment:订单号;NOT NULL" json:"ordersn"`
StoreId int `gorm:"column:store_id;type:int(11);comment:美容院关联ID号" json:"store_id"`
StoreName string `gorm:"column:store_name;type:varchar(50);comment:门店名" json:"store_name"`
SaleName string `gorm:"column:sale_name;type:varchar(50);comment:销售姓名" json:"sale_name"`
SaleMobile string `gorm:"column:sale_mobile;type:char(60);comment:销售电话" json:"sale_mobile"`
UserId int `gorm:"column:user_id;type:int(11);comment:用户ID" json:"user_id"`
UserName string `gorm:"column:user_name;type:varchar(255);comment:用户名" json:"user_name"`
SaleId int `gorm:"column:sale_id;type:int(11);comment:销售员ID号" json:"sale_id"`
Mobile string `gorm:"column:mobile;type:char(60);comment:收货人手机号;NOT NULL" json:"mobile"`
Address string `gorm:"column:address;type:varchar(255);comment:收货人地址;NOT NULL" json:"address"`
Addressee string `gorm:"column:addressee;type:varchar(50);comment:收货人姓名;NOT NULL" json:"addressee"`
DistrictIds string `gorm:"column:district_ids;type:varchar(255);comment:地区IDS;NOT NULL" json:"district_ids"`
TotalPrice float64 `gorm:"column:total_price;type:decimal(10,2);comment:总价;NOT NULL" json:"total_price"`
PayPrice float64 `gorm:"column:pay_price;type:decimal(10,2);comment:实际支付金额" json:"pay_price"`
PayType uint8 `gorm:"column:pay_type;type:tinyint(1);default:1;comment:支付类型,1为微信,2为支付宝,3为余额支付" json:"pay_type"`
DeliverStatus uint8 `gorm:"column:deliver_status;type:tinyint(1);default:2;comment:发货状态,1为已签收,2为待发货,3为发货中,4为已发货" json:"deliver_status"`
Status uint8 `gorm:"column:status;type:tinyint(1);default:2;comment:支付状态,1为已支付,2为未支付,3为支付中,4支付失败,5已失效;NOT NULL" json:"status"`
IsSupply uint8 `gorm:"column:is_supply;type:tinyint(1);default:1;comment:是否补过货,1为没有,2为补过" json:"is_supply"`
Note string `gorm:"column:note;type:varchar(255);comment:备注" json:"note"`
ProductIds string `gorm:"column:product_ids;type:varchar(150);comment:产品IDs" json:"product_ids"`
OutTradeNo string `gorm:"column:out_trade_no;type:varchar(50);comment:支付订单号" json:"out_trade_no"`
OldAddress string `gorm:"column:old_address;type:varchar(255);comment:老的收发货信息,如果有这个就表明是修改过收货地址" json:"old_address"`
Type uint8 `gorm:"column:type;type:tinyint(1);default:0;comment:类型 1 销售,2为门店,3为个人,4为个人家庭试用,5为个人门店试用" json:"type"`
SignTime utils.CustomTime `gorm:"column:sign_time;type:datetime;comment:签收时间" json:"sign_time"`
CreateType uint8 `gorm:"column:create_type;type:tinyint(1);default:1;comment:下单人类型,1为销售,2为门店,3为个人;NOT NULL" json:"create_type"`
CreateTime utils.CustomTime `gorm:"column:create_time;type:datetime;default:CURRENT_TIMESTAMP;comment:订单创建时间" json:"create_time"`
ProductItems []OrderProducts `gorm:"-" json:"product_items"`
RefundStatus uint8 `gorm:"column:refund_status" json:"refund_status"`
AesMobile string `gorm:"-" json:"aes_mobile"`
OriginalMobile string `gorm:"-" json:"original_mobile,omitempty"`
}
type OrderPay struct {
Id int64 `gorm:"column:id;type:bigint(20);primary_key;AUTO_INCREMENT" json:"id"`
TotalPrice float64 `gorm:"column:total_price;type:decimal(10,2);comment:总价;NOT NULL" json:"total_price"`
OrderSn string `gorm:"column:ordersn;type:varchar(100);comment:订单号;NOT NULL" json:"ordersn"`
PayPrice float64 `gorm:"column:pay_price;type:decimal(10,2);comment:实际支付金额" json:"pay_price"`
PayType uint8 `gorm:"column:pay_type;type:tinyint(1);default:1;comment:支付类型,1为微信,2为支付宝,3为余额支付" json:"pay_type"`
DistrictIds string `gorm:"column:district_ids;type:varchar(255);comment:地区IDS;NOT NULL" json:"district_ids"`
GroupId int `gorm:"column:group_id;type:int(11);default:0;comment:分组ID" json:"group_id"`
Status uint8 `gorm:"column:status;type:tinyint(1);default:2;comment:支付状态,1为已支付,2为未支付,3为支付中,4支付失败,5已失效;NOT NULL" json:"status"`
Mobile string `gorm:"column:mobile;type:char(60);comment:收货人手机号;NOT NULL" json:"mobile"`
Address string `gorm:"column:address;type:varchar(255);comment:收货人地址;NOT NULL" json:"address"`
Addressee string `gorm:"column:addressee;type:varchar(50);comment:收货人姓名;NOT NULL" json:"addressee"`
OutTradeNo string `gorm:"column:out_trade_no;type:varchar(50);comment:支付订单号;NOT NULL" json:"out_trade_no"`
}
type OrderDown struct {
Id int64 `gorm:"column:id;type:bigint(20);primary_key;AUTO_INCREMENT" json:"id"`
OrderSn string `gorm:"column:ordersn;type:varchar(100);comment:订单号;NOT NULL" json:"ordersn"`
StoreId int `gorm:"column:store_id;type:int(11);comment:美容院关联ID号" json:"store_id"`
StoreName string `gorm:"column:store_name;type:varchar(50);comment:门店名" json:"store_name"`
SaleName string `gorm:"column:sale_name;type:varchar(50);comment:销售姓名" json:"sale_name"`
SaleMobile string `gorm:"column:sale_mobile;type:char(60);comment:销售电话" json:"sale_mobile"`
SaleId int `gorm:"column:sale_id;type:int(11);comment:销售员ID号" json:"sale_id"`
Mobile string `gorm:"column:mobile;type:char(60);comment:收货人手机号;NOT NULL" json:"mobile"`
Address string `gorm:"column:address;type:varchar(255);comment:收货人地址;NOT NULL" json:"address"`
Addressee string `gorm:"column:addressee;type:varchar(50);comment:收货人姓名;NOT NULL" json:"addressee"`
DistrictIds string `gorm:"column:district_ids;type:varchar(255);comment:地区IDS;NOT NULL" json:"district_ids"`
TotalPrice float64 `gorm:"column:total_price;type:decimal(10,2);comment:总价;NOT NULL" json:"total_price"`
PayPrice float64 `gorm:"column:pay_price;type:decimal(10,2);comment:实际支付金额" json:"pay_price"`
PayType uint8 `gorm:"column:pay_type;type:tinyint(1);default:1;comment:支付类型,1为微信,2为支付宝,3为余额支付" json:"pay_type"`
Status uint8 `gorm:"column:status;type:tinyint(1);default:2;comment:支付状态,1为已支付,2为未支付,3为支付中,4支付失败,5已失效;NOT NULL" json:"status"`
ProductIds string `gorm:"column:product_ids;type:varchar(150);comment:产品IDs" json:"product_ids"`
SignTime utils.CustomTime `gorm:"column:sign_time;type:datetime;comment:签收时间" json:"sign_time"`
CreateType uint8 `gorm:"column:create_type;type:tinyint(1);default:1;comment:下单人类型,1为销售,2为门店,3为个人;NOT NULL" json:"create_type"`
CreateTime utils.CustomTime `gorm:"column:create_time;type:datetime;default:CURRENT_TIMESTAMP;comment:订单创建时间" json:"create_time"`
ProductName string `gorm:"-" json:"product_name"`
TypeName string `gorm:"-" json:"type_name"`
BankInfo string `gorm:"-" json:"bank_info"`
OriginalMobile string `gorm:"-" json:"original_mobile"`
OriginalSaleMobile string `gorm:"-" json:"original_sale_mobile"`
}
type OrderSaleItems struct {
Id int64 `gorm:"column:id;type:bigint(20);primary_key;AUTO_INCREMENT" json:"id"`
OrderSn string `gorm:"column:ordersn;type:varchar(100);comment:订单号;NOT NULL" json:"ordersn"`
StoreName string `gorm:"column:store_name;type:varchar(50);comment:门店名" json:"store_name"`
TotalPrice float64 `gorm:"column:total_price;type:decimal(10,2);comment:总价;NOT NULL" json:"total_price"`
PayPrice float64 `gorm:"column:pay_price;type:decimal(10,2);comment:实际支付金额" json:"pay_price"`
ProductIds string `gorm:"column:product_ids;type:varchar(150);comment:产品IDs" json:"product_ids"`
SignTime utils.CustomTime `gorm:"column:sign_time;type:datetime;comment:签收时间" json:"sign_time"`
CreateTime utils.CustomTime `gorm:"column:create_time;type:datetime;default:CURRENT_TIMESTAMP;comment:订单创建时间" json:"create_time"`
ProductItems []OrderProducts `gorm:"-" json:"product_items"`
}
type OrderAccount struct {
Id int `gorm:"column:id;type:bigint(20);primary_key;AUTO_INCREMENT" json:"id"`
OrderSn string `gorm:"column:ordersn;type:varchar(100);comment:订单号;NOT NULL" json:"ordersn"`
StoreId int `gorm:"column:store_id;type:int(11);comment:美容院关联ID号" json:"store_id"`
UserId int `gorm:"column:user_id;type:int(11);comment:用户ID" json:"user_id"`
SaleId int `gorm:"column:sale_id;type:int(11);comment:销售员ID号" json:"sale_id"`
TotalPrice float64 `gorm:"column:total_price;type:decimal(10,2);comment:总价;NOT NULL" json:"total_price"`
PayPrice float64 `gorm:"column:pay_price;type:decimal(10,2);comment:实际支付金额" json:"pay_price"`
PayType uint8 `gorm:"column:pay_type;type:tinyint(1);default:1;comment:支付类型,1为微信,2为支付宝,3为余额支付" json:"pay_type"`
ProductIds string `gorm:"column:product_ids;type:varchar(150);comment:产品IDs" json:"product_ids"`
Type uint8 `gorm:"column:type;type:tinyint(1);default:0;comment:类型 1 销售,2为门店,3为个人,4为个人家庭试用,5为个人门店试用" json:"type"`
Products []OrderProducts `gorm:"-" json:"products"`
TaskAwardMonthStatus uint8 `gorm:"column:task_awark_month_status;type:tinyint(1);default:2;comment:结算任务与奖励月,1 为已结算,2为未结算" json:"task_awark_month_status"`
TaskAwardQuarterStatus uint8 `gorm:"column:task_awark_quarter_status;type:tinyint(1);default:2;comment:结算任务与奖励季度,1 为已结算,2为未结算" json:"task_awark_quarter_status"`
TaskAwardHalfYearStatus uint8 `gorm:"column:task_awark_half_year_status;type:tinyint(1);default:2;comment:结算任务与奖励半年,1 为已结算,2为未结算" json:"task_awark_half_year_status"`
TaskAwardYearStatus uint8 `gorm:"column:task_awark_year_status;type:tinyint(1);default:2;comment:结算任务与奖励年,1 为已结算,2为未结算" json:"task_awark_year_status"`
CreateTime utils.CustomTime `gorm:"column:create_time;type:datetime;default:CURRENT_TIMESTAMP;comment:订单创建时间" json:"create_time"`
}
type OrderAccountStatus struct {
AccountStatus uint8 `gorm:"column:account_status;type:tinyint(1);default:2;comment:结算订单状态,1为已结算,2为未结算,3为结算中" json:"account_status"`
}
type OrderShareStatus struct {
ShareStatus uint8 `gorm:"column:share_status;type:tinyint(1);default:2;comment:结算抽成状态,1为已结算,2为未结算,3为结算中" json:"share_status"`
}
type OrderDeliverGoodsStatus struct {
SignTime utils.CustomTime `gorm:"column:sign_time;type:datetime;comment:签收时间" json:"sign_time"`
DeliverStatus uint8 `gorm:"column:deliver_status;type:tinyint(1);default:2;comment:发货状态,1为已签收,2为待发货,3为发货中,4为已发货" json:"deliver_status"`
}
type OrderImitateInfo struct {
Id int64 `gorm:"column:id;type:bigint(20);primary_key;AUTO_INCREMENT" json:"id"`
OrderSn string `gorm:"column:ordersn;type:varchar(100);comment:订单号;NOT NULL" json:"ordersn"`
Mobile string `gorm:"column:mobile;type:char(60);comment:收货人手机号;NOT NULL" json:"mobile"`
Address string `gorm:"column:address;type:varchar(255);comment:收货人地址;NOT NULL" json:"address"`
Addressee string `gorm:"column:addressee;type:varchar(50);comment:收货人姓名;NOT NULL" json:"addressee"`
DistrictIds string `gorm:"column:district_ids;type:varchar(255);comment:地区IDS;NOT NULL" json:"district_ids"`
PayType uint8 `gorm:"column:pay_type;type:tinyint(1);default:1;comment:支付类型,1为微信,2为支付宝,3为余额支付" json:"pay_type"`
DeliverStatus uint8 `gorm:"column:deliver_status;type:tinyint(1);default:2;comment:发货状态,1为已签收,2为待发货,3为发货中,4为已发货" json:"deliver_status"`
Status uint8 `gorm:"column:status;type:tinyint(1);default:2;comment:支付状态,1为已支付,2为未支付,3为支付中,4支付失败,5已失效;NOT NULL" json:"status"`
VerifyStatus uint8 `gorm:"column:verify_status;type:tinyint(1);default:0;comment:审核状态,1为通过,2为失败,3为待审核,0为正常订单不需要审核" json:"verify_status"`
ProductIds string `gorm:"column:product_ids;type:varchar(150);comment:产品IDs" json:"product_ids"`
}
type OrderImitateItems struct {
OrderImitateInfo
ProductItems []OrderProducts `gorm:"-" json:"product_items"`
AesMobile string `gorm:"-" json:"aes_mobile"`
}
type OrderDownInfo struct {
Id int64 `gorm:"column:id;type:bigint(20);primary_key;AUTO_INCREMENT" json:"id"`
OrderSn string `gorm:"column:ordersn;type:varchar(100);comment:订单号;NOT NULL" json:"ordersn"`
StoreId int `gorm:"column:store_id;type:int(11);comment:美容院关联ID号" json:"store_id"`
StoreName string `gorm:"column:store_name;type:varchar(50);comment:门店名" json:"store_name"`
SaleName string `gorm:"column:sale_name;type:varchar(50);comment:销售姓名" json:"sale_name"`
UserId int `gorm:"column:user_id;type:int(11);comment:用户ID" json:"user_id"`
UserName string `gorm:"column:user_name;type:varchar(255);comment:用户名" json:"user_name"`
SaleId int `gorm:"column:sale_id;type:int(11);comment:销售员ID号" json:"sale_id"`
Mobile string `gorm:"column:mobile;type:char(60);comment:收货人手机号;NOT NULL" json:"mobile"`
Address string `gorm:"column:address;type:varchar(255);comment:收货人地址;NOT NULL" json:"address"`
Addressee string `gorm:"column:addressee;type:varchar(50);comment:收货人姓名;NOT NULL" json:"addressee"`
DistrictIds string `gorm:"column:district_ids;type:varchar(255);comment:地区IDS;NOT NULL" json:"district_ids"`
Status uint8 `gorm:"column:status;type:tinyint(1);default:2;comment:支付状态,1为已支付,2为未支付,3为支付中,4支付失败,5已失效;NOT NULL" json:"status"`
ProductIds string `gorm:"column:product_ids;type:varchar(150);comment:产品IDs" json:"product_ids"`
CreateTime utils.CustomTime `gorm:"column:create_time;type:datetime;default:CURRENT_TIMESTAMP;comment:订单创建时间" json:"create_time"`
CreateDate string `gorm:"-" json:"create_date"`
ProductName string `gorm:"-" json:"product_name"`
ProductNumber int `gorm:"-" json:"product_number"`
StoreBusinessLicense string `gorm:"-" json:"store_business_license"`
}
type OrderTaskAndAwardMonth struct {
TaskAwardMonthStatus uint8 `gorm:"column:task_award_month_status;type:tinyint(1);default:2;comment:结算任务与奖励月,1 为已结算,2为未结算" json:"task_awark_month_status"`
}
type OrderTaskAndAwardQuarter struct {
TaskAwardQuarterStatus uint8 `gorm:"column:task_award_quarter_status;type:tinyint(1);default:2;comment:结算任务与奖励季度,1 为已结算,2为未结算" json:"task_awark_quarter_status"`
}
type OrderTaskAndAwardHalfYear struct {
TaskAwardHalfYearStatus uint8 `gorm:"column:task_award_half_year_status;type:tinyint(1);default:2;comment:结算任务与奖励半年,1 为已结算,2为未结算" json:"task_awark_half_year_status"`
}
type OrderTaskAndAwardYear struct {
TaskAwardYearStatus uint8 `gorm:"column:task_award_year_status;type:tinyint(1);default:2;comment:结算任务与奖励年,1 为已结算,2为未结算" json:"task_awark_year_status"`
}