打印机添加查询接口
This commit is contained in:
@@ -124,3 +124,33 @@ func DeletePrintMsg() {
|
||||
globals.SugarLogger.Debugf("定时删除超过一个月的打印信息:%d 条", num)
|
||||
return
|
||||
}
|
||||
|
||||
func QueryPrintList(db *DaoDB, printNo, printKey string, status, isOnline int, page, size int) (print []*model.Printer, err error) {
|
||||
sql := `
|
||||
SELECT * FROM printer WHERE 1=1
|
||||
`
|
||||
sqlParams := []interface{}{}
|
||||
if printNo != "" {
|
||||
sql += ` AND print_no = ?`
|
||||
sqlParams = append(sqlParams, printNo)
|
||||
}
|
||||
if printKey != "" {
|
||||
sql += ` AND print_key = ?`
|
||||
sqlParams = append(sqlParams, printKey)
|
||||
}
|
||||
if status != model.PrintMsgAll {
|
||||
sql += ` AND status = ?`
|
||||
sqlParams = append(sqlParams, status)
|
||||
}
|
||||
if status != model.PrintMsgAll {
|
||||
sql += ` AND is_online = ?`
|
||||
sqlParams = append(sqlParams, isOnline)
|
||||
}
|
||||
sql += ` AND deleted_at = ?`
|
||||
sqlParams = append(sqlParams, utils.DefaultTimeValue)
|
||||
sql += ` ORDER BY status desc,is_online desc LIMIT ? OFFSET ? `
|
||||
sqlParams = append(sqlParams, size, page)
|
||||
|
||||
err = GetRows(db, &print, sql, sqlParams...)
|
||||
return print, err
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user