33 lines
1.3 KiB
Go
33 lines
1.3 KiB
Go
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() {
|
|
|
|
}
|