mirror of
https://github.com/flipped-aurora/gin-vue-admin.git
synced 2026-09-21 20:35:16 +00:00
menu和authority修改父级变为选择模式
This commit is contained in:
@@ -19,6 +19,18 @@ func CreateAuthority(auth model.SysAuthority) (err error, authority model.SysAut
|
||||
return err, auth
|
||||
}
|
||||
|
||||
// @title UpdateAuthority
|
||||
// @description 更改一个角色
|
||||
// @auth (2020/04/05 20:22)
|
||||
// @param auth model.SysAuthority
|
||||
// @return error
|
||||
// @return authority model.SysAuthority
|
||||
|
||||
func UpdateAuthority(auth model.SysAuthority) (err error, authority model.SysAuthority) {
|
||||
err = global.GVA_DB.Where("authority_id = ?", auth.AuthorityId).First(&model.SysAuthority{}).Updates(&auth).Error
|
||||
return err, auth
|
||||
}
|
||||
|
||||
// @title DeleteAuthority
|
||||
// @description 删除角色
|
||||
// @auth (2020/04/05 20:22)
|
||||
|
||||
@@ -32,7 +32,7 @@ func DeleteBaseMenu(id float64) (err error) {
|
||||
// @description 更新路由
|
||||
// @auth (2020/04/05 20:22)
|
||||
// @param menu model.SysBaseMenu
|
||||
// @return err error
|
||||
// @return err errorgetMenu
|
||||
|
||||
func UpdateBaseMenu(menu model.SysBaseMenu) (err error) {
|
||||
upDateMap := make(map[string]interface{})
|
||||
|
||||
@@ -15,7 +15,7 @@ import (
|
||||
// @return menus []model.SysMenu
|
||||
|
||||
func GetMenuTree(authorityId string) (err error, menus []model.SysMenu) {
|
||||
sql := "SELECT authority_menu.created_at,authority_menu.updated_at,authority_menu.deleted_at,authority_menu.menu_level,authority_menu.parent_id,authority_menu.path,authority_menu.`name`,authority_menu.hidden,authority_menu.component,authority_menu.title,authority_menu.icon,authority_menu.sort,authority_menu.menu_id,authority_menu.authority_id FROM authority_menu WHERE authority_menu.authority_id = ? AND authority_menu.parent_id = ?"
|
||||
sql := "SELECT authority_menu.created_at,authority_menu.updated_at,authority_menu.deleted_at,authority_menu.menu_level,authority_menu.parent_id,authority_menu.path,authority_menu.`name`,authority_menu.hidden,authority_menu.component,authority_menu.title,authority_menu.icon,authority_menu.sort,authority_menu.menu_id,authority_menu.authority_id FROM authority_menu WHERE authority_menu.authority_id = ? AND authority_menu.parent_id = ? ORDER BY authority_menu.sort ASC"
|
||||
|
||||
err = global.GVA_DB.Raw(sql, authorityId, 0).Scan(&menus).Error
|
||||
for i := 0; i < len(menus); i++ {
|
||||
@@ -127,7 +127,7 @@ func AddMenuAuthority(menus []model.SysBaseMenu, authorityId string) (err error)
|
||||
// @return menus []SysBaseMenu
|
||||
|
||||
func GetMenuAuthority(authorityId string) (err error, menus []model.SysMenu) {
|
||||
sql := "SELECT authority_menu.created_at,authority_menu.updated_at,authority_menu.deleted_at,authority_menu.menu_level,authority_menu.parent_id,authority_menu.path,authority_menu.`name`,authority_menu.hidden,authority_menu.component,authority_menu.title,authority_menu.icon,authority_menu.sort,authority_menu.menu_id,authority_menu.authority_id FROM authority_menu WHERE authority_menu.authority_id = ?"
|
||||
sql := "SELECT authority_menu.created_at,authority_menu.updated_at,authority_menu.deleted_at,authority_menu.menu_level,authority_menu.parent_id,authority_menu.path,authority_menu.`name`,authority_menu.hidden,authority_menu.component,authority_menu.title,authority_menu.icon,authority_menu.sort,authority_menu.menu_id,authority_menu.authority_id FROM authority_menu WHERE authority_menu.authority_id = ? ORDER BY authority_menu.sort ASC"
|
||||
err = global.GVA_DB.Raw(sql, authorityId).Scan(&menus).Error
|
||||
return err, menus
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user