- create entity one by one in saveJdOrderList

This commit is contained in:
gazebo
2019-01-12 14:07:57 +08:00
parent 7902af7057
commit 3aeff73db0
2 changed files with 14 additions and 2 deletions

View File

@@ -145,10 +145,16 @@ func saveJdOrderList(existJdIDMap map[string]int, jdOrderList []interface{}, jdS
if len(orderDetailList) > 0 || len(storeOrderList) > 0 {
db := dao.GetDB()
if len(orderDetailList) > 0 {
err = dao.CreateMultiEntities(db, orderDetailList)
// err = dao.CreateMultiEntities(db, orderDetailList)
for _, v := range orderDetailList {
dao.CreateEntity(db, v)
}
}
if len(storeOrderList) > 0 {
err = dao.CreateMultiEntities(db, storeOrderList)
// err = dao.CreateMultiEntities(db, storeOrderList)
for _, v := range storeOrderList {
dao.CreateEntity(db, v)
}
}
}
return err

View File

@@ -11,3 +11,9 @@ type TempGoodsOrderMobile struct {
CreatedAt time.Time `orm:"auto_now_add;type(datetime)" json:"createdAt"`
Mobile string `orm:"size(32);index" json:"mobile"`
}
func (o *TempGoodsOrderMobile) TableUnique() [][]string {
return [][]string{
[]string{"VendorOrderID", "VendorID"},
}
}