1
This commit is contained in:
32
business/model/dao/freight_template.go
Normal file
32
business/model/dao/freight_template.go
Normal file
@@ -0,0 +1,32 @@
|
||||
package dao
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
|
||||
"git.rosy.net.cn/jx-callback/business/model"
|
||||
)
|
||||
|
||||
func ReplaceInsertFreight2(storeID, templateID, warehouseID, tradeLimitID int, vendorStoreID, fenceID string) error {
|
||||
if storeID == 0 || len(vendorStoreID) == 0 {
|
||||
return fmt.Errorf("storeID或vendorStoreID不允许为空")
|
||||
}
|
||||
sqlStr := `REPLACE INTO freight_template (store_id, vendor_store_id, template_id, warehouse_id, fence_id, trade_limit_id)
|
||||
SELECT ?,?,?,?,?,? FROM DUAL WHERE NOT EXISTS(SELECT COUNT(store_id) FROM freight_template WHERE store_id = ?)=0`
|
||||
sqlParam := []interface{}{storeID, vendorStoreID, templateID, warehouseID, fenceID, tradeLimitID, storeID}
|
||||
_, err := ExecuteSQL(GetDB(), sqlStr, sqlParam)
|
||||
return err
|
||||
}
|
||||
func ReplaceInsertFreight(tem *model.FreightTemplate) error {
|
||||
if tem.StoreID == 0 || len(tem.VendorStoreID) == 0 {
|
||||
return fmt.Errorf("storeID或vendorStoreID不允许为空")
|
||||
}
|
||||
sqlStr := `REPLACE INTO freight_template (store_id, vendor_store_id, template_id, warehouse_id, fence_id, trade_limit_id)
|
||||
SELECT ?,?,?,?,?,? FROM DUAL WHERE NOT EXISTS(SELECT COUNT(store_id) FROM freight_template WHERE store_id = ?)=0`
|
||||
sqlParam := []interface{}{tem.StoreID, tem.VendorStoreID, tem.TemplateID, tem.WarehouseID, tem.FenceID, tem.TradeLimitID, tem.StoreID}
|
||||
_, err := ExecuteSQL(GetDB(), sqlStr, sqlParam)
|
||||
return err
|
||||
}
|
||||
|
||||
func InsertItemFreight() {
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user