Merge remote-tracking branch 'origin/mark' into yonghui
This commit is contained in:
@@ -13,6 +13,11 @@ type tStoreSkuSyncInfo2 struct {
|
||||
VendorPlaceCode string
|
||||
}
|
||||
|
||||
type SkuCategoryWithVendor struct {
|
||||
*model.SkuCategory
|
||||
MapList []*model.ThingMap `json:"mapList"`
|
||||
}
|
||||
|
||||
func GetSellCities(db *DaoDB, nameID int, vendorID int) (cities []*model.Place, err error) {
|
||||
cities = []*model.Place{}
|
||||
sql := `
|
||||
@@ -44,6 +49,26 @@ func DeleteSkuNamePlace(db *DaoDB, nameID int, placeCodes []int) (num int64, err
|
||||
return ExecuteSQL(db, sql, sqlParams...)
|
||||
}
|
||||
|
||||
func GetCategories(db *DaoDB, parentID int, catIDs []int) (cats []*model.SkuCategory, err error) {
|
||||
sql := `
|
||||
SELECT t1.*
|
||||
FROM sku_category t1
|
||||
WHERE t1.deleted_at = ?`
|
||||
params := []interface{}{
|
||||
utils.DefaultTimeValue,
|
||||
}
|
||||
if parentID != -1 {
|
||||
sql += " AND t1.parent_id = ?"
|
||||
params = append(params, parentID)
|
||||
}
|
||||
if len(catIDs) > 0 {
|
||||
sql += " AND t1.id (" + GenQuestionMarks(len(catIDs)) + ")"
|
||||
params = append(params, catIDs)
|
||||
}
|
||||
sql += " ORDER BY t1.level, t1.seq"
|
||||
return cats, GetRows(db, &cats, sql, params)
|
||||
}
|
||||
|
||||
func GetSkus(db *DaoDB, skuIDs, nameIDs, statuss, catIDs []int) (skuList []*model.SkuAndName, err error) {
|
||||
sql := `
|
||||
SELECT t1.*, t2.name, t2.unit, t2.prefix, t2.is_spu
|
||||
|
||||
34
business/model/dao/thing_map.go
Normal file
34
business/model/dao/thing_map.go
Normal file
@@ -0,0 +1,34 @@
|
||||
package dao
|
||||
|
||||
import "git.rosy.net.cn/jx-callback/business/model"
|
||||
|
||||
import "git.rosy.net.cn/baseapi/utils"
|
||||
|
||||
func GetThingMapList(db *DaoDB, thingType int, vendorIDs, thingIDs []int) (cats []*model.ThingMap, err error) {
|
||||
sql := `
|
||||
SELECT t1.*
|
||||
FROM thing_map t1
|
||||
WHERE t1.deleted_at = ? AND t1.thing_type = ?
|
||||
`
|
||||
sqlParams := []interface{}{
|
||||
utils.DefaultTimeValue,
|
||||
thingType,
|
||||
}
|
||||
if len(thingIDs) > 0 { // 必须要指定ID
|
||||
sql += " AND t1.thing_id IN (" + GenQuestionMarks(len(thingIDs)) + ")"
|
||||
sqlParams = append(sqlParams, thingIDs)
|
||||
err = GetRows(db, &cats, sql, sqlParams...)
|
||||
}
|
||||
return cats, err
|
||||
}
|
||||
|
||||
func GetThingMapMap(db *DaoDB, thingType int, vendorIDs, thingIDs []int) (thingMapMap map[int64][]*model.ThingMap, err error) {
|
||||
thingMapList, err := GetThingMapList(db, thingType, vendorIDs, thingIDs)
|
||||
if err == nil {
|
||||
thingMapMap = make(map[int64][]*model.ThingMap)
|
||||
for _, thingMap := range thingMapList {
|
||||
thingMapMap[thingMap.ThingID] = append(thingMapMap[thingMap.ThingID], thingMap)
|
||||
}
|
||||
}
|
||||
return thingMapMap, err
|
||||
}
|
||||
@@ -100,6 +100,7 @@ type GoodsOrder struct {
|
||||
InvoiceTitle string `orm:"size(64)" json:"invoiceTitle"` // 发票抬头
|
||||
InvoiceTaxerID string `orm:"size(32);column(invoice_taxer_id)" json:"invoiceTaxerID"` // 发票纳税人识别码
|
||||
InvoiceEmail string `orm:"size(64)" json:"invoiceEmail"` // 发票邮箱
|
||||
VendorOrgCode string `orm:"size(64)" json:"vendorOrgCode"` // 同一平台下不同的商户代码,如果只有一个,可以为空
|
||||
|
||||
// 以下只是用于传递数据
|
||||
OriginalData string `orm:"-" json:"-"`
|
||||
@@ -179,6 +180,8 @@ type Waybill struct {
|
||||
ModelTimeInfo `json:"-"`
|
||||
OriginalData string `orm:"type(text)" json:"-"`
|
||||
Remark string `orm:"-" json:"-"` // 用于传递remark
|
||||
|
||||
VendorOrgCode string `orm:"size(64)" json:"vendorOrgCode"` // 同一平台下不同的商户代码,如果只有一个,可以为空
|
||||
}
|
||||
|
||||
func (w *Waybill) TableUnique() [][]string {
|
||||
|
||||
@@ -105,7 +105,8 @@ type AfsOrder struct {
|
||||
RefundMoney int64 `json:"refundMoney"` // 平台扣款总额 1
|
||||
RefundMoneyByCal int64 `json:"refundMoneyByCal"` // 平台扣款总额-通过公式计算平台扣除京西的金额M
|
||||
// JxSkuMoney int64 `json:"jxSkuMoney"` // 京西补贴金额,现阶段是平台扣京西多少钱,京西扣商家多少钱,暂不考虑撤回京西补贴
|
||||
Skus []*OrderSkuFinancial `orm:"-" json:"skus"`
|
||||
Skus []*OrderSkuFinancial `orm:"-" json:"skus"`
|
||||
VendorOrgCode string `orm:"size(64)" json:"vendorOrgCode"` // 同一平台下不同的商户代码,如果只有一个,可以为空
|
||||
}
|
||||
|
||||
func (o *AfsOrder) TableUnique() [][]string {
|
||||
|
||||
@@ -248,10 +248,15 @@ func (*SkuNamePlaceBind) TableUnique() [][]string {
|
||||
}
|
||||
}
|
||||
|
||||
type SkuWithVendor struct {
|
||||
*Sku
|
||||
MapList []*ThingMap `json:"mapList"`
|
||||
}
|
||||
|
||||
type SkuNameExt struct {
|
||||
SkuName
|
||||
Skus []*Sku `orm:"-" json:"skus"`
|
||||
SkusStr string `json:"-"`
|
||||
Skus []*SkuWithVendor `orm:"-" json:"skus"`
|
||||
SkusStr string `json:"-"`
|
||||
|
||||
Places []int `orm:"-" json:"places"`
|
||||
PlacesStr string `json:"-"`
|
||||
|
||||
@@ -15,7 +15,7 @@ type ThingMap struct {
|
||||
VendorOrgCode string `orm:"size(32)" json:"vendorOrgCode"` // 同一平台下不同的商户代码,如果只有一个,可以为空
|
||||
|
||||
VendorThingID string `orm:"size(32);column(vendor_thing_id);index" json:"vendorThingID"`
|
||||
SyncStatus int8 `orm:"default(2)"`
|
||||
SyncStatus int8 `orm:"default(2)" json:"syncStatus"`
|
||||
|
||||
Remark string `orm:"size(255)" json:"remark"`
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user