- sku category man almost ok.

- mysql connect str add utf8mb4.
This commit is contained in:
gazebo
2018-09-09 20:43:48 +08:00
parent d71b0e6763
commit d8907cf010
14 changed files with 304 additions and 41 deletions

View File

@@ -69,11 +69,11 @@ func GetRows(db *DaoDB, inPtr interface{}, sql string, values ...interface{}) (e
return err
}
func GetEntity(db *DaoDB, item interface{}, cols ...string) error {
func GetEntity(db *DaoDB, item interface{}, cols ...string) (err error) {
if db == nil {
db = GetDB()
}
err := utils.CallFuncLogError(func() error {
err = utils.CallFuncLogError(func() error {
return db.db.Read(item, cols...)
}, reflect.TypeOf(item).Name())
return err
@@ -109,13 +109,13 @@ func UpdateEntityByKV(db *DaoDB, item interface{}, kvs map[string]interface{}, c
return num, err
}
func CreateEntity(db *DaoDB, item interface{}) error {
func CreateEntity(db *DaoDB, item interface{}) (err error) {
if db == nil {
db = GetDB()
}
err := utils.CallFuncLogError(func() error {
_, err2 := db.db.Insert(item) // todo 这里需要将ID赋值么
return err2
err = utils.CallFuncLogError(func() error {
_, err = db.db.Insert(item) // todo 这里需要将ID赋值么
return err
}, reflect.TypeOf(item).Name())
return err
}

View File

@@ -69,20 +69,19 @@ func (*SkuVendorCategory) TableUnique() [][]string {
type SkuCategory struct {
ModelIDCUL
Name string `orm:"size(255);unique"`
ParentID int `orm:"column(parent_id)"`
Level int8
Type int8 // 类别类型
Seq int
Name string `orm:"size(255);unique" json:"name"`
ParentID int `orm:"column(parent_id)" json:"parentID"`
Level int8 `json:"level"`
Type int8 `json:"type"` // 类别类型,即是普通类别还是特殊用于做活动的类别
Seq int `json:"seq"`
JdID int64 `orm:"column(jd_id);index"` // 这个是指商家自己的商品类别在京东平台上的ID
JdCategoryID int `orm:"column(jd_category_id)"` // 这个是指对应的京东商品类别
JdID int64 `orm:"column(jd_id);index" json:"jdID"` // 这个是指商家自己的商品类别在京东平台上的ID
JdCategoryID int `orm:"column(jd_category_id)" json:"jdCategoryID"` // 这个是指对应的京东商品类别
ElmCategoryID int64 `orm:"column(elm_category_id)"` // 这个是指对应的饿了么商品类别
EbaiCategoryID int64 `orm:"column(ebai_category_id)"` // 这个是指对应的饿百商品类别
ElmCategoryID int64 `orm:"column(elm_category_id)" json:"elmCategoryID"` // 这个是指对应的饿了么商品类别
EbaiCategoryID int64 `orm:"column(ebai_category_id)" json:"ebaiCategoryID"` // 这个是指对应的饿百商品类别
// MtID string `orm:"size(48);index"`
// DidiID string `orm:"size(48);index"`
JdSyncStatus int8 `orm:"default(2)" json:"jdSyncStatus"`
}
type SkuName struct {