处理打印信息
This commit is contained in:
37
business/model/dao/dao_print.go
Normal file
37
business/model/dao/dao_print.go
Normal file
@@ -0,0 +1,37 @@
|
||||
package dao
|
||||
|
||||
import (
|
||||
"git.rosy.net.cn/jx-callback/business/model"
|
||||
)
|
||||
|
||||
func GetPrintMsg(db *DaoDB, printNo string, orderNo int64) (prints *model.PrintMsg, err error) {
|
||||
sql := `
|
||||
SELECT *
|
||||
FROM print_msg
|
||||
WHERE 1 = 1
|
||||
`
|
||||
sqlParams := []interface{}{}
|
||||
if printNo != "" {
|
||||
sql += ` AND print_no = ?`
|
||||
sqlParams = append(sqlParams, printNo)
|
||||
}
|
||||
if orderNo != 0 {
|
||||
sql += ` AND order_no = ?`
|
||||
sqlParams = append(sqlParams, orderNo)
|
||||
}
|
||||
err = GetRow(db, &prints, sql, sqlParams)
|
||||
return prints, err
|
||||
}
|
||||
|
||||
func GetPrintMsgs(db *DaoDB, status, offset, pageSize int) (prints []*model.PrintMsg, err error) {
|
||||
sql := `
|
||||
SELECT *
|
||||
FROM print_msg
|
||||
WHERE 1 = 1
|
||||
AND status = ?
|
||||
LIMIT ? OFFSET
|
||||
`
|
||||
sqlParams := []interface{}{status, pageSize, offset}
|
||||
err = GetRows(db, &prints, sql, sqlParams)
|
||||
return prints, err
|
||||
}
|
||||
11
business/model/print.go
Normal file
11
business/model/print.go
Normal file
@@ -0,0 +1,11 @@
|
||||
package model
|
||||
|
||||
type PrintMsg struct {
|
||||
ModelIDCULD
|
||||
|
||||
PrintNo string `json:"print_no"` //打印机编号
|
||||
Content string `orm:"type(text)" json:"content"` //订单内容
|
||||
OrderNo int `json:"order_no"` //订单序号
|
||||
Status int `json:"status"` //打印状态
|
||||
Comment string `json:"comment"` //失败原因
|
||||
}
|
||||
Reference in New Issue
Block a user