refactor🎨: 缩减函数名称

This commit is contained in:
wenjianzhang committed 2021-06-07 20:37:01 +08:00
1 parent c96d9c35a7
commit 9a2c0729f6
22 files changed
+111 -126

No files matched your search

+6 -6
View File
@@ -10,8 +10,8 @@ import (
// SysMenuSearch 列表或者搜索使用结构体
type SysMenuSearch struct {
dto.Pagination `search:"-"`
Title string `form:"title" search:"type:contains;column:title;table:sys_menu" comment:"菜单名称"` // 菜单名称
Visible int `form:"visible" search:"type:exact;column:visible;table:sys_menu" comment:"显示状态"` // 显示状态
Title string `form:"title" search:"type:contains;column:title;table:sys_menu" comment:"菜单名称"` // 菜单名称
Visible int `form:"visible" search:"type:exact;column:visible;table:sys_menu" comment:"显示状态"` // 显示状态
}
func (m *SysMenuSearch) GetNeedSearch() interface{} {
@@ -108,9 +108,9 @@ func (s *SysMenuById) GenerateM() (*models.SysMenu, error) {
}
type MenuLabel struct {
Id int `json:"id" gorm:"-"`
Label string `json:"label" gorm:"-"`
Children []MenuLabel `json:"children" gorm:"-"`
Id int `json:"id,omitempty" gorm:"-"`
Label string `json:"label,omitempty" gorm:"-"`
Children []MenuLabel `json:"children,omitempty" gorm:"-"`
}
type MenuRole struct {
@@ -120,4 +120,4 @@ type MenuRole struct {
type SelectRole struct {
RoleId int `uri:"roleId"`
}
}
+3 -3
View File
@@ -150,7 +150,7 @@ func (e *SysMenu) Remove(d *dto.SysMenuById) *SysMenu {
return e
}
// GetSysMenuList 获取菜单数据
// GetList 获取菜单数据
func (e *SysMenu) GetList(c *dto.SysMenuSearch, list *[]models.SysMenu) error {
var err error
var data models.SysMenu
@@ -167,7 +167,7 @@ func (e *SysMenu) GetList(c *dto.SysMenuSearch, list *[]models.SysMenu) error {
return nil
}
// SetSysMenuLabel 设置菜单数据
// SetLabel 修改角色中 设置菜单基础数据
func (e *SysMenu) SetLabel() (m []dto.MenuLabel, err error) {
var list []models.SysMenu
err = e.GetList(&dto.SysMenuSearch{}, &list)
@@ -322,4 +322,4 @@ func (e *SysMenu) getByRoleName(roleName string) ([]models.SysMenu, error) {
e.Log.Errorf("db error:%s", err)
}
return MenuList, err
}
}