models

package
v0.0.0-...-2b30400 Latest Latest
Warning

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

Go to latest
Published: Jul 1, 2019 License: Apache-2.0 Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func BackendUserTBName

func BackendUserTBName() string

BackendUserTBName 获取 BackendUser 对应的表名称

func CourseBatchDelete

func CourseBatchDelete(ids []int) (int64, error)

CourseBatchDelete 批量删除

func CourseTBName

func CourseTBName() string

func DataReset

func DataReset() (bool, error)

func ResourceTBName

func ResourceTBName() string

ResourceTBName 获取 Resource 对应的表名称

func RoleBackendUserRelTBName

func RoleBackendUserRelTBName() string

RoleBackendUserRelTBName 角色与用户多对多关系表

func RoleBatchDelete

func RoleBatchDelete(ids []int) (int64, error)

RoleBatchDelete 批量删除

func RoleResourceRelTBName

func RoleResourceRelTBName() string

RoleResourceRelTBName 角色与资源多对多关系表

func RoleTBName

func RoleTBName() string

RoleTBName 获取 Role 对应的表名称

func TableName

func TableName(name string) string

TableName 下面是统一的表名管理

Types

type BackendUser

type BackendUser struct {
	Id                 int
	RealName           string `orm:"size(32)"`
	UserName           string `orm:"size(24)"`
	UserPwd            string `json:"-"`
	IsSuper            bool
	Status             int
	Mobile             string                `orm:"size(16)"`
	Email              string                `orm:"size(256)"`
	Avatar             string                `orm:"size(256)"`
	RoleIds            []int                 `orm:"-" form:"RoleIds"`
	RoleBackendUserRel []*RoleBackendUserRel `orm:"reverse(many)"` // 设置一对多的反向关系
	ResourceUrlForList []string              `orm:"-"`
}

BackendUser 实体类

func BackendUserOne

func BackendUserOne(id int) (*BackendUser, error)

BackendUserOne 根据id获取单条

func BackendUserOneByUserName

func BackendUserOneByUserName(username, userpwd string) (*BackendUser, error)

BackendUserOneByUserName 根据用户名密码获取单条

func BackendUserPageList

func BackendUserPageList(params *BackendUserQueryParam) ([]*BackendUser, int64)

BackendUserPageList 获取分页数据

func (*BackendUser) TableName

func (a *BackendUser) TableName() string

TableName 设置BackendUser表名

type BackendUserQueryParam

type BackendUserQueryParam struct {
	BaseQueryParam
	UserNameLike string //模糊查询
	RealNameLike string //模糊查询
	Mobile       string //精确查询
	SearchStatus string //为空不查询,有值精确查询
}

BackendUserQueryParam 用于查询的类

type BaseQueryParam

type BaseQueryParam struct {
	Sort   string `json:"sort"`
	Order  string `json:"order"`
	Offset int64  `json:"offset"`
	Limit  int    `json:"limit"`
}

BaseQueryParam 用于查询的类

type Course

type Course struct {
	Id        int
	Name      string `orm:"size(32)"`
	ShortName string `orm:"size(8)"`
	Price     float32
	RealPrice float32
	Img       string `orm:"size(256)"`
	StartTime time.Time
	EndTime   time.Time
	Seq       int
	Creator   *BackendUser `orm:"rel(fk)"` //设置一对多关系
}

Course 实体类

func CourseOne

func CourseOne(id int) (*Course, error)

CourseOne 获取单条

func CoursePageList

func CoursePageList(params *CourseQueryParam) ([]*Course, int64)

CoursePageList 获取分页数据

func (*Course) TableName

func (a *Course) TableName() string

TableName 设置Course表名

type CourseQueryParam

type CourseQueryParam struct {
	BaseQueryParam
	NameLike string
}

CourseQueryParam 用于搜索的类

type JsonResult

type JsonResult struct {
	Code enums.JsonResultCode `json:"code"`
	Msg  string               `json:"msg"`
	Obj  interface{}          `json:"obj"`
}

JsonResult 用于返回ajax请求的基类

type Resource

type Resource struct {
	Id              int
	Name            string    `orm:"size(64)"`
	Parent          *Resource `orm:"null;rel(fk)"` // RelForeignKey relation
	Rtype           int
	Seq             int
	Sons            []*Resource        `orm:"reverse(many)"` // fk 的反向关系
	SonNum          int                `orm:"-"`
	Icon            string             `orm:"size(32)"`
	LinkUrl         string             `orm:"-"`
	UrlFor          string             `orm:"size(256)" Json:"-"`
	HtmlDisabled    int                `orm:"-"`             //在html里应用时是否可用
	Level           int                `orm:"-"`             //第几级,从0开始
	RoleResourceRel []*RoleResourceRel `orm:"reverse(many)"` // 设置一对多的反向关系
}

Resource 权限控制资源表

func ResourceOne

func ResourceOne(id int) (*Resource, error)

ResourceOne 获取单条

func ResourceTreeGrid

func ResourceTreeGrid() []*Resource

ResourceTreeGrid 获取treegrid顺序的列表

func ResourceTreeGrid4Parent

func ResourceTreeGrid4Parent(id int) []*Resource

ResourceTreeGrid4Parent 获取可以成为某个节点父节点的列表

func ResourceTreeGridByUserId

func ResourceTreeGridByUserId(backuserid, maxrtype int) []*Resource

ResourceTreeGridByUserId 根据用户获取有权管理的资源列表,并整理成teegrid格式

func (*Resource) TableName

func (a *Resource) TableName() string

TableName 设置表名

type Role

type Role struct {
	Id                 int    `form:"Id"`
	Name               string `form:"Name"`
	Seq                int
	RoleResourceRel    []*RoleResourceRel    `orm:"reverse(many)" json:"-"` // 设置一对多的反向关系
	RoleBackendUserRel []*RoleBackendUserRel `orm:"reverse(many)" json:"-"` // 设置一对多的反向关系
}

Role 用户角色 实体类

func RoleDataList

func RoleDataList(params *RoleQueryParam) []*Role

RoleDataList 获取角色列表

func RoleOne

func RoleOne(id int) (*Role, error)

RoleOne 获取单条

func RolePageList

func RolePageList(params *RoleQueryParam) ([]*Role, int64)

RolePageList 获取分页数据

func (*Role) TableName

func (a *Role) TableName() string

TableName 设置表名

type RoleBackendUserRel

type RoleBackendUserRel struct {
	Id          int
	Role        *Role        `orm:"rel(fk)"`  //外键
	BackendUser *BackendUser `orm:"rel(fk)" ` // 外键
	Created     time.Time    `orm:"auto_now_add;type(datetime)"`
}

RoleBackendUserRel 角色与用户关系

func (*RoleBackendUserRel) TableName

func (a *RoleBackendUserRel) TableName() string

TableName 设置表名

type RoleQueryParam

type RoleQueryParam struct {
	BaseQueryParam
	NameLike string
}

RoleQueryParam 用于搜索的类

type RoleResourceRel

type RoleResourceRel struct {
	Id       int
	Role     *Role     `orm:"rel(fk)"`  //外键
	Resource *Resource `orm:"rel(fk)" ` // 外键
	Created  time.Time `orm:"auto_now_add;type(datetime)"`
}

RoleResourceRel 角色与资源关系表

func (*RoleResourceRel) TableName

func (a *RoleResourceRel) TableName() string

TableName 设置表名

Jump to

Keyboard shortcuts

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