1
This commit is contained in:
42
business/model/dao/print_bind_store.go
Normal file
42
business/model/dao/print_bind_store.go
Normal file
@@ -0,0 +1,42 @@
|
|||||||
|
package dao
|
||||||
|
|
||||||
|
import (
|
||||||
|
"git.rosy.net.cn/jx-callback/business/model"
|
||||||
|
"time"
|
||||||
|
)
|
||||||
|
|
||||||
|
// QueryPrintBindStore 查询绑定门店
|
||||||
|
func QueryPrintBindStore(printNo string) ([]*model.PrintBindStore, error) {
|
||||||
|
var data []*model.PrintBindStore
|
||||||
|
if err := GetRows(GetDB(), &data, `SELECT * FROM print_bind_store WHERE print_no = ?`, []interface{}{printNo}...); err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
return data, nil
|
||||||
|
}
|
||||||
|
|
||||||
|
// BindStoreList 绑定门店信息
|
||||||
|
func BindStoreList(req *model.AddPrinterParam, userId string) error {
|
||||||
|
param := &model.PrintBindStore{
|
||||||
|
CreatedAt: time.Now(),
|
||||||
|
UpdatedAt: time.Now(),
|
||||||
|
StoreID: req.StoreId,
|
||||||
|
StoreName: req.Name,
|
||||||
|
StoreVendor: 9, // 绑定平台,全平台
|
||||||
|
PrintNo: req.PrintNo,
|
||||||
|
StoreStatus: 1, // 门店开启
|
||||||
|
BindStatus: 1, // 绑定状态
|
||||||
|
}
|
||||||
|
if userId != "" {
|
||||||
|
param.UserId = userId
|
||||||
|
} else {
|
||||||
|
param.UserId = "system"
|
||||||
|
}
|
||||||
|
return CreateEntity(GetDB(), param)
|
||||||
|
}
|
||||||
|
|
||||||
|
// DeleteStoreList 删除绑定门店
|
||||||
|
func DeleteStoreList(printNo string, storeId string) error {
|
||||||
|
sql := ` DELETE FROM print_bind_store WHERE print_no = ? AND store_id = ? `
|
||||||
|
_, err := ExecuteSQL(GetDB(), sql, []interface{}{printNo, storeId}...)
|
||||||
|
return err
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user