This commit is contained in:
suyl
2021-07-07 18:07:12 +08:00
parent 4453ed80f5
commit ecbded38dc
9 changed files with 180 additions and 76 deletions

23
dao/app_dao.go Normal file
View 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
}