model

package
v1.10.1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 1, 2024 License: GPL-3.0 Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func StringToInt64Slice

func StringToInt64Slice(s string) []int64

字符串转换成int64的切片

func UpdateMenuCache

func UpdateMenuCache(tx *gorm.DB) error

UpdateMenuCache 将menu表的全量信息存入缓存

Types

type MenuEntity struct {
	app.SnowflakeIDModel
	ParentId    int64         `gorm:"column:parent_id" json:"ParentId,string" form:"ParentId" comment:"父Id"`
	Code        string        `gorm:"column:code" json:"Code" form:"Code" comment:"编号"`
	Name        string        `gorm:"column:name" json:"Name" form:"Name" comment:"名称"`
	Alias       string        `gorm:"column:alias" json:"Alias" form:"Alias" comment:"别名"`
	Path        string        `gorm:"column:path" json:"Path" form:"Path" comment:"路径"`
	Source      string        `gorm:"column:source" json:"Source" form:"Source" comment:"资源"`
	Category    int           `gorm:"column:category" json:"Category" form:"Category" comment:"菜单类型"`
	Action      int           `gorm:"column:action" json:"Action" form:"Action" comment:"按钮类型"`
	IsOpen      int           `gorm:"column:is_open" json:"IsOpen" form:"IsOpen" comment:"打开新页面"`
	Status      int           `gorm:"column:status;default:0" json:"Status" form:"Status" comment:"状态"`
	Sort        int           `gorm:"column:sort" json:"Sort" form:"Sort" comment:"排序"`
	HasChildren bool          `json:"hasChildren" form:"hasChildren" comment:"HasChildren"`
	Children    []*MenuEntity `gorm:"foreignKey:parent_id;references:parent_id" json:"children"`
}
func (menu *MenuEntity) AfterDelete(tx *gorm.DB) (err error)

AfterDelete GORM钩子,在删除记录后调用

func (menu *MenuEntity) AfterSave(tx *gorm.DB) (err error)

AfterSave GORM钩子,在保存记录后调用(包括创建和更新)

func (c MenuEntity) GetCode() string
func (c MenuEntity) GetId() int64
func (MenuEntity) TableName() string

type RoleEntity

type RoleEntity struct {
	app.SnowflakeIDModel
	ParentId  int64         `gorm:"column:parent_id" json:"ParentId,string" form:"ParentId" comment:"父Id"`
	RoleName  string        `gorm:"column:role_name" json:"RoleName" form:"RoleName" comment:"角色名"`
	RoleAlias string        `gorm:"column:role_alias" json:"RoleAlias" form:"RoleAlias" comment:"角色别名"`
	Sort      int           `gorm:"column:sort" json:"Sort" form:"Sort" comment:"排序"`
	MenuIds   string        `gorm:"column:menu_ids" json:"MenuIds" form:"MenuIds" comment:"MenuIds"`
	Children  []*RoleEntity `gorm:"-" json:"children"`
	Status    int           `gorm:"column:status;default:0" json:"Status" form:"Status" comment:"状态"`
}

func (RoleEntity) GetAlias

func (c RoleEntity) GetAlias() string

func (RoleEntity) GetId

func (c RoleEntity) GetId() int64

func (RoleEntity) GetPermitIds

func (c RoleEntity) GetPermitIds() []int64

func (RoleEntity) TableName

func (RoleEntity) TableName() string

type UserEntity

type UserEntity struct {
	app.IdTimeStampsModel
	app.SoftDeleteModel
	ParentId int64        `gorm:"column:parent_id" json:"ParentId,string" form:"ParentId" comment:"父Id"`
	Name     string       `gorm:"column:name" json:"Name" form:"Name" comment:"Name"`
	UserType int          `gorm:"column:user_type" json:"UserType" form:"UserType" comment:"UserType"`
	Account  string       `gorm:"column:account" json:"Account" form:"Account" comment:"Account"`
	Password string       `gorm:"column:password" json:"Password" form:"Password" comment:"Password"`
	RealName string       `gorm:"column:real_name" json:"RealName" form:"RealName" comment:"RealName"`
	Avatar   string       `gorm:"column:avatar" json:"Avatar" form:"Avatar" comment:"Avatar"`
	Email    string       `gorm:"column:email" json:"Email" form:"Email" comment:"Email"`
	Phone    string       `gorm:"column:phone" json:"Phone" form:"Phone" comment:"Phone"`
	Birthday string       `gorm:"column:birthday" json:"Birthday" form:"Birthday" comment:"Birthday"`
	Sex      int          `gorm:"column:sex" json:"Sex" form:"Sex" comment:"Sex"`
	RoleIds  string       `gorm:"column:role_ids" json:"RoleIds" form:"RoleIds" comment:"RoleIds"`
	DeptIds  string       `gorm:"column:dept_ids" json:"DeptIds" form:"DeptIds" comment:"DeptIds"`
	PostIds  string       `gorm:"column:post_ids" json:"PostIds" form:"PostIds" comment:"PostIds"`
	Tags     string       `gorm:"column:tags" json:"Tags" form:"Tags" comment:"Tags"`
	Status   int          `gorm:"column:status;default:0" json:"Status" form:"Status" comment:"状态"`
	Children []UserEntity `gorm:"-" json:"children"`
}

func (UserEntity) GetId

func (c UserEntity) GetId() int64

func (UserEntity) GetRoleIds

func (c UserEntity) GetRoleIds() []int64

func (UserEntity) TableName

func (c UserEntity) TableName() string

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL