app
This commit is contained in:
23
dao/app_dao.go
Normal file
23
dao/app_dao.go
Normal file
@@ -0,0 +1,23 @@
|
||||
package dao
|
||||
|
||||
import (
|
||||
"git.rosy.net.cn/jx-print/model"
|
||||
"github.com/jmoiron/sqlx"
|
||||
)
|
||||
|
||||
func GetApps(db *sqlx.DB, userID string) (apps []*model.Apps, err error) {
|
||||
var sqlParams []interface{}
|
||||
sql := `
|
||||
SELECT *
|
||||
FROM apps
|
||||
WHERE 1 = 1
|
||||
`
|
||||
if userID != "" {
|
||||
sql += " AND user_id = ?"
|
||||
sqlParams = append(sqlParams, userID)
|
||||
}
|
||||
if err = db.Select(&apps, sql, sqlParams...); err == nil {
|
||||
return apps, err
|
||||
}
|
||||
return apps, err
|
||||
}
|
||||
Reference in New Issue
Block a user