This commit is contained in:
苏尹岚
2021-03-19 10:45:27 +08:00
parent 8dba6fe19f
commit 2ba2ff5994
3 changed files with 49 additions and 39 deletions

View File

@@ -5,7 +5,7 @@ import (
"git.rosy.net.cn/jx-callback/business/model"
)
func GetMenu(db *DaoDB, name string, level int, userID string) (menus []*model.Menu, err error) {
func GetMenu(db *DaoDB, name string, level, menuType int, userID string) (menus []*model.Menu, err error) {
sqlParams := []interface{}{}
sql := `
SELECT DISTINCT a.*
@@ -29,6 +29,10 @@ func GetMenu(db *DaoDB, name string, level int, userID string) (menus []*model.M
sql += " AND a.level = ?"
sqlParams = append(sqlParams, level)
}
if menuType != 0 {
sql += " AND a.type = ?"
sqlParams = append(sqlParams, menuType)
}
sql += " ORDER BY a.id"
err = GetRows(db, &menus, sql, sqlParams)
return menus, err