方法添加注释,中文版注释
This commit is contained in:
@@ -5,7 +5,6 @@ import (
|
||||
"gin-vue-admin/global"
|
||||
)
|
||||
|
||||
// menu需要构建的点有点多 这里关联关系表直接把所有数据拿过来 用代码实现关联 后期实现主外键模式
|
||||
type SysMenu struct {
|
||||
SysBaseMenu
|
||||
MenuId string `json:"menuId"`
|
||||
@@ -13,7 +12,13 @@ type SysMenu struct {
|
||||
Children []SysMenu `json:"children"`
|
||||
}
|
||||
|
||||
// 为角色增加menu树
|
||||
// @title AddMenuAuthority
|
||||
// @description 为角色增加menu树
|
||||
// @auth (2020/04/05 20:22 )
|
||||
// @param FileMd5 string
|
||||
// @param FileName string
|
||||
// @param FilePath string
|
||||
// @return error
|
||||
func (m *SysMenu) AddMenuAuthority(menus []SysBaseMenu, authorityId string) (err error) {
|
||||
var menu SysMenu
|
||||
global.GVA_DB.Where("authority_id = ? ", authorityId).Unscoped().Delete(&SysMenu{})
|
||||
@@ -34,13 +39,23 @@ func (m *SysMenu) AddMenuAuthority(menus []SysBaseMenu, authorityId string) (err
|
||||
return nil
|
||||
}
|
||||
|
||||
// 查看当前角色树
|
||||
// @title GetMenuAuthority
|
||||
// @description 查看当前角色树
|
||||
// @auth (2020/04/05 20:22 )
|
||||
// @param FileMd5 string
|
||||
// @param FileName string
|
||||
// @param FilePath string
|
||||
// @return error
|
||||
func (m *SysMenu) GetMenuAuthority(authorityId string) (err error, menus []SysMenu) {
|
||||
err = global.GVA_DB.Where("authority_id = ?", authorityId).Find(&menus).Error
|
||||
return err, menus
|
||||
}
|
||||
|
||||
//获取动态路由树
|
||||
// @title GetMenuTree
|
||||
// @description 获取动态菜单树
|
||||
// @auth (2020/04/05 20:22 )
|
||||
// @param newPassword string
|
||||
// @return err error
|
||||
func (m *SysMenu) GetMenuTree(authorityId string) (err error, menus []SysMenu) {
|
||||
err = global.GVA_DB.Where("authority_id = ? AND parent_id = ?", authorityId, 0).Order("sort", true).Find(&menus).Error
|
||||
for i := 0; i < len(menus); i++ {
|
||||
@@ -49,6 +64,11 @@ func (m *SysMenu) GetMenuTree(authorityId string) (err error, menus []SysMenu) {
|
||||
return err, menus
|
||||
}
|
||||
|
||||
// @title getChildrenList
|
||||
// @description 获取子菜单
|
||||
// @auth (2020/04/05 20:22 )
|
||||
// @param newPassword string
|
||||
// @return err error
|
||||
func getChildrenList(menu *SysMenu) (err error) {
|
||||
err = global.GVA_DB.Where("authority_id = ? AND parent_id = ?", menu.AuthorityId, menu.MenuId).Order("sort", true).Find(&menu.Children).Error
|
||||
for i := 0; i < len(menu.Children); i++ {
|
||||
|
Reference in New Issue
Block a user