This commit is contained in:
苏尹岚
2021-01-27 17:58:50 +08:00
parent e38ab5104d
commit 61c44e257d

View File

@@ -29,6 +29,7 @@ func GetMenu(db *DaoDB, name string, level int, userID string) (menus []*model.M
sql += " AND a.level = ?"
sqlParams = append(sqlParams, level)
}
sql += " ORDER BY a.id"
err = GetRows(db, &menus, sql, sqlParams)
return menus, err
}
@@ -42,6 +43,7 @@ func GetMenuWithUser(db *DaoDB, name string, level int, userID string) (menus []
JOIN role_menu c ON c.menu_id = a.id AND c.role_id = b.role_id AND c.deleted_at = ?
WHERE a.deleted_at = ?)a
JOIN menu b ON (b.id = a.id OR b.id = a.parent_id)
ORDER BY b.id
`
sqlParams := []interface{}{userID, utils.DefaultTimeValue, utils.DefaultTimeValue, utils.DefaultTimeValue}
err = GetRows(db, &menus, sql, sqlParams)