From a7232b6d3bc7f7cc3dd961eefa11552366b1a31f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=82=B9=E5=AE=97=E6=A5=A0?= Date: Mon, 8 Jan 2024 09:09:37 +0800 Subject: [PATCH] 1 --- business/model/dao/print_bind_store.go | 42 ++++++++++++++++++++++++++ 1 file changed, 42 insertions(+) create mode 100644 business/model/dao/print_bind_store.go diff --git a/business/model/dao/print_bind_store.go b/business/model/dao/print_bind_store.go new file mode 100644 index 000000000..e04fb73a8 --- /dev/null +++ b/business/model/dao/print_bind_store.go @@ -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 +}