system

package
v0.0.0-...-497d345 Latest Latest
Warning

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

Go to latest
Published: Apr 23, 2019 License: MIT Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CreateDep

func CreateDep(deps ...*Dep) (int64, error)

CreateDep 建立部门

func CreateDepUser

func CreateDepUser(depUser ...*DepUser) (int64, error)

CreateDepUser 建立部门用户

func CreateRoleMenu

func CreateRoleMenu(roleMenu ...*RoleMenu) (int64, error)

CreateRoleMenu 建立角色菜单

func CreateUser

func CreateUser(user ...*User) (int64, error)

CreateUser 建立用户

func DelDepByID

func DelDepByID(id int64) (int64, error)

DelDepByID 删除部门

func DeleteByRoles

func DeleteByRoles(rids []int64) (effect int64, err error)

DeleteByRoles 批量删除角色

func DeleteByUsers

func DeleteByUsers(uids []int64) (effect int64, err error)

DeleteByUsers 批量删除用户

func GetUserByUsername

func GetUserByUsername(user *User) (bool, error)

GetUserByUsername 通过用户名获得用户

func UpdateDepByID

func UpdateDepByID(dep *Dep) (int64, error)

UpdateDepByID 更新部门

func UpdateRoleByID

func UpdateRoleByID(role *CasbinRule) (int64, error)

UpdateRoleByID 更新角色

func UpdateUserByID

func UpdateUserByID(user *User) (int64, error)

UpdateUserByID 更新用户

Types

type CasbinRule

type CasbinRule struct {
	models.Model `xorm:"extends"`
	PType        string `xorm:"varchar(100) index" json:"p_type"`
	V0           string `xorm:"varchar(100) index" json:"v0"`
	V1           string `xorm:"varchar(100) index" json:"v1"`
	V2           string `xorm:"varchar(100) index" json:"v2"`
	V3           string `xorm:"varchar(100) index" json:"v3"`
	V4           string `xorm:"varchar(100) index" json:"v4"`
	V5           string `xorm:"varchar(100) index" json:"v5"`
}

CasbinRule 权限

func GetPaginationRoles

func GetPaginationRoles(page *supports.Pagination) ([]*CasbinRule, int64, error)

GetPaginationRoles 角色分页

type Dep

type Dep struct {
	models.Model `xorm:"extends"`
	DepName      string `xorm:"varchar(64) notnull" json:"depName" form:"depName"`
	Leader       string `xorm:"varchar(64) notnull" json:"leader" form:""leader`
	Phone        string `xorm:"varchar(64) notnull" json:"phone" form:"phone"`
	Email        string `xorm:"varchar(64) notnull" json:"email" form:"email"`
	Disabled     bool   `xorm:"notnull tinyint(0)" json:"disabled" form:"disabled"` //0:可用 否则:不可用
	ParentID     int64  `xorm:"INT(10) notnull" json:"parentId" form:"parentId"`
	DepDesc      string `xorm:"varchar(255) notnull" json:"depDesc" form:"depDesc"`
}

Dep 部门表

func GetAllDep

func GetAllDep() ([]*Dep, error)

查询所有部门列表

type DepUser

type DepUser struct {
	ID  int64 `xorm:"pk autoincr INT(10) notnull" json:"id"`
	Rid int64 `xorm:"pk autoincr INT(10) notnull" json:"rid"`
	Mid int64 `xorm:"pk autoincr INT(10) notnull" json:"mid"`
}

DepUser 部门-用户关联表

type Menu struct {
	models.Model `xorm:"extends"`
	Path         string `xorm:"varchar(64) notnull" json:"path"`
	Modular      string `xorm:"varchar(64) notnull" json:"modular"`
	Component    string `xorm:"varchar(64) notnull" json:"component"`
	Name         string `xorm:"varchar(64) notnull" json:"name"`
	ParentID     int64  `xorm:"INT(10) notnull" json:"parentId"`
	IsSub        bool   `xorm:"tinyint(1) notnull" json:"isSub"`
	Meta         Meta   `xorm:"json" json:"meta"`
}

Menu 菜单表

func DynamicMenuTree

func DynamicMenuTree(uid int64) []*Menu

DynamicMenuTree 获取用户的菜单列表

func GetMenusByRoleid

func GetMenusByRoleid(rid int64, page *supports.Pagination) ([]*Menu, int64, error)

GetMenusByRoleid 获得菜单角色

func GetPaginationMenus

func GetPaginationMenus(page *supports.Pagination) ([]*Menu, int64, error)

GetPaginationMenus 分页

type Meta

type Meta struct {
	// 设为true后在左侧菜单不会显示该页面选项
	HideInMenu bool `json:"hideInMenu"`
	// 设为true后如果该路由只有一个子路由,在菜单中也会显示该父级菜单
	ShowAlways bool `json:"showAlways"`
	// 设为true后页面不会缓存
	NotCache bool `json:"notCache"`
	// 可访问该页面的权限数组,当前路由设置的权限会影响子路由
	Access []string `json:"access"`
	// (default: -) 该页面在左侧菜单、面包屑和标签导航处显示的图标,如果是自定义图标,需要在图标名称前加下划线'_'
	Icon string `json:"icon"`
	// default: null 用于跳转到外部连接
	Href string `json:"href"`
	// 菜单显示的名称
	Title string `json:"title"`
}

Meta 路由可配项

type RoleMenu

type RoleMenu struct {
	ID  int64 `xorm:"pk autoincr INT(10) notnull" json:"id"`
	Rid int64 `xorm:"pk autoincr INT(10) notnull" json:"rid"`
	Mid int64 `xorm:"pk autoincr INT(10) notnull" json:"mid"`
}

RoleMenu 角色-菜单关联表

type User

type User struct {
	models.Model `xorm:"extends"`
	Username     string `xorm:"notnull" json:"username" form:"username"`
	Password     string `xorm:"notnull" json:"password" form:"password"`
	Gender       string `xorm:"notnull" json:"gender" form:"gender"`
	Enable       bool   `xorm:"notnull tinyint(1)" json:"enable" form:"enable"`
	Name         string `xorm:"notnull" json:"name" form:"name"`
	Phone        string `xorm:"notnull" json:"phone" form:"phone"`
	Email        string `xorm:"notnull" json:"email" form:"email"`
	Userface     string `xorm:"notnull" json:"userface" form:"userface"`
}

User mysql user table

func GetPaginationUsers

func GetPaginationUsers(page *supports.Pagination) ([]*User, int64, error)

GetPaginationUsers 分页查询user

func GetUsersByUids

func GetUsersByUids(uids []int64, page *supports.Pagination) ([]*User, int64, error)

GetUsersByUids 获得用户

Jump to

Keyboard shortcuts

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