model

package
v1.0.5 Latest Latest
Warning

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

Go to latest
Published: Dec 9, 2020 License: MIT Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func DataScopes

func DataScopes(tableName string, userID int) func(db *gorm.DB) *gorm.DB

DataScopes DataScopes

func GetColumnsDB

func GetColumnsDB(db *gorm.DB) *gorm.DB

GetColumnsDB 获取数据字典存储

func GetConfigDB

func GetConfigDB(db *gorm.DB) *gorm.DB

GetConfigDB 获取数据字典存储

func GetDeptDB

func GetDeptDB(db *gorm.DB) *gorm.DB

GetDeptDB 获取数据字典存储

func GetDictDataDB

func GetDictDataDB(db *gorm.DB) *gorm.DB

GetDictDataDB 获取数据字典存储

func GetDictTypeDB

func GetDictTypeDB(db *gorm.DB) *gorm.DB

GetDictTypeDB 获取字典类型存储

func GetFileDirDB

func GetFileDirDB(db *gorm.DB) *gorm.DB

GetFileDirDB 获取数据字典存储

func GetFileInfoDB

func GetFileInfoDB(db *gorm.DB) *gorm.DB

GetFileInfoDB 获取数据字典存储

func GetLoginLogDB

func GetLoginLogDB(db *gorm.DB) *gorm.DB

GetLoginLogDB 获取数据字典存储

func GetMenuDB

func GetMenuDB(db *gorm.DB) *gorm.DB

GetMenuDB 获取数据字典存储

func GetOperLogDB

func GetOperLogDB(db *gorm.DB) *gorm.DB

GetOperLogDB 获取数据字典存储

func GetPostDB

func GetPostDB(db *gorm.DB) *gorm.DB

GetPostDB 获取数据字典存储

func GetRoleDB

func GetRoleDB(db *gorm.DB) *gorm.DB

GetRoleDB 获取数据字典存储

func GetRoleDeptDB

func GetRoleDeptDB(db *gorm.DB) *gorm.DB

GetRoleDeptDB 获取数据字典存储

func GetRoleMenuDB

func GetRoleMenuDB(db *gorm.DB) *gorm.DB

GetRoleMenuDB 获取数据字典存储

func GetSettingDB

func GetSettingDB(db *gorm.DB) *gorm.DB

GetSettingDB 获取分类存储

func GetTablesDB

func GetTablesDB(db *gorm.DB) *gorm.DB

GetTablesDB 获取数据字典存储

func GetUserDB

func GetUserDB(db *gorm.DB) *gorm.DB

GetUserDB 获取数据字典存储

Types

type Columns

type Columns struct {
	ColumnID           int       `gorm:"primary_key;auto_increment;" json:"columnId"`          // 列ID
	TableID            int       `gorm:"" json:"tableId"`                                      // 表ID
	ColumnName         string    `gorm:"size:128;" json:"columnName"`                          // 列名
	ColumnComment      string    `gorm:"column:column_comment;size:128;" json:"columnComment"` // 列备注
	ColumnType         string    `gorm:"column:column_type;size:128;" json:"columnType"`       // 列类型
	GoType             string    `gorm:"column:go_type;size:128;" json:"goType"`               // Go类型
	GoField            string    `gorm:"column:go_field;size:128;" json:"goField"`             // Go字段
	JSONField          string    `gorm:"column:json_field;size:128;" json:"jsonField"`         // JSON字段
	IsPk               string    `gorm:"column:is_pk;size:4;" json:"isPk"`                     // 主键
	IsIncrement        string    `gorm:"column:is_increment;size:4;" json:"isIncrement"`       // 自增
	IsRequired         string    `gorm:"column:is_required;size:4;" json:"isRequired"`         // 必须
	IsInsert           string    `gorm:"column:is_insert;size:4;" json:"isInsert"`             // 增加
	IsEdit             string    `gorm:"column:is_edit;size:4;" json:"isEdit"`                 // 修改
	IsList             string    `gorm:"column:is_list;size:4;" json:"isList"`                 // 列表
	IsQuery            string    `gorm:"column:is_query;size:4;" json:"isQuery"`               // 查询
	IsEncrypt          string    `gorm:"column:is_encrypt;size:4;" json:"IsEncrypt"`           // 加密
	QueryType          string    `gorm:"column:query_type;size:128;" json:"queryType"`         // 查询类型
	HTMLType           string    `gorm:"column:html_type;size:128;" json:"htmlType"`           //显示方式
	DictType           string    `gorm:"column:dict_type;size:128;" json:"dictType"`           // 字典类型
	Sort               int       `gorm:"column:sort;" json:"sort"`                             // 排序
	List               string    `gorm:"column:list;size:1;" json:"list"`                      // 队列
	Pk                 bool      `gorm:"column:pk;size:1;" json:"pk"`                          // 主键
	Required           bool      `gorm:"column:required;size:1;" json:"required"`              // 必须
	SuperColumn        bool      `gorm:"column:super_column;size:1;" json:"superColumn"`       // 超级列
	UsableColumn       bool      `gorm:"column:usable_column;size:1;" json:"usableColumn"`     // UsableColumn
	Increment          bool      `gorm:"column:increment;size:1;" json:"increment"`            // 自增
	Insert             bool      `gorm:"column:insert;size:1;" json:"insert"`                  // 增加
	Edit               bool      `gorm:"column:edit;size:1;" json:"edit"`                      // 编辑
	Query              bool      `gorm:"column:query;size:1;" json:"query"`                    // 查询
	Remark             string    `gorm:"column:remark;size:255;" json:"remark"`                // 备注
	FkTableName        string    `gorm:"" json:"fkTableName"`                                  // 关系表名
	FkTableNameClass   string    `gorm:"" json:"fkTableNameClass"`                             // 关系表类名
	FkTableNamePackage string    `gorm:"" json:"fkTableNamePackage"`                           // 关系表包名
	FkCol              []Columns `gorm:"-" json:"fkCol"`                                       // 关系列
	FkLabelID          string    `gorm:"" json:"fkLabelId"`                                    // 关系字段ID
	FkLabelName        string    `gorm:"size:255;" json:"fkLabelName"`                         // 关系字段名
	CreateBy           string    `gorm:"column:create_by;size:128;" json:"createBy"`           // 增加人
	UpdateBy           string    `gorm:"column:update_By;size:128;" json:"updateBy"`           // 修改人
	Gorm               string    `gorm:"column:gorm;size:255;" json:"gorm"`                    // GORM 映射

	models.AtModel
}

Columns 列表

func (*Columns) Create

func (m *Columns) Create(db *gorm.DB, item Columns) error

Create 创建数据

func (*Columns) Get

func (m *Columns) Get(db *gorm.DB) (*Columns, error)

Get 查询指定数据

func (*Columns) Querys

func (m *Columns) Querys(db *gorm.DB) ([]Columns, error)

Querys 查询数据

func (*Columns) Update

func (m *Columns) Update(db *gorm.DB, item Columns) error

Update 更新数据

type Config

type Config struct {
	gorm.Model
	models.ByModel
	ConfigName  string `json:"configName" gorm:"type:varchar(128);comment:ConfigName"`   // 参数名称
	ConfigKey   string `json:"configKey" gorm:"type:varchar(128);comment:ConfigKey"`     // 参数健名
	ConfigValue string `json:"configValue" gorm:"type:varchar(255);comment:ConfigValue"` // 参数键值
	ConfigType  string `json:"configType" gorm:"type:varchar(64);comment:ConfigType"`    // 参数类型
	Remark      string `json:"remark" gorm:"type:varchar(128);comment:Remark"`           //	备注
}

Config 系统参数实体

func (*Config) BatchDelete

func (m *Config) BatchDelete(db *gorm.DB, ids []int) error

BatchDelete 批量删除

func (*Config) Create

func (m *Config) Create(db *gorm.DB, item Config) error

Create 创建数据

func (*Config) Delete

func (m *Config) Delete(db *gorm.DB, id int) error

Delete 删除数据

func (*Config) Exists

func (m *Config) Exists(db *gorm.DB, item Config) (bool, error)

Exists 检查数据是否存在

func (*Config) Get

func (m *Config) Get(db *gorm.DB) (*Config, error)

Get 查询指定数据

func (*Config) Query

func (m *Config) Query(db *gorm.DB, params param.ConfigParam) (*pagination.Result, error)

Query 查询数据

func (*Config) Update

func (m *Config) Update(db *gorm.DB, item Config) error

Update 更新数据

type DBColumns

type DBColumns struct {
	TableSchema            string `gorm:"column:TABLE_SCHEMA" json:"tableSchema"`
	TableName              string `gorm:"column:TABLE_NAME" json:"tableName"`
	ColumnName             string `gorm:"column:COLUMN_NAME" json:"columnName"`
	ColumnDefault          string `gorm:"column:COLUMN_DEFAULT" json:"columnDefault"`
	IsNullable             string `gorm:"column:IS_NULLABLE" json:"isNullable"`
	DataType               string `gorm:"column:DATA_TYPE" json:"dataType"`
	CharacterMaximumLength string `gorm:"column:CHARACTER_MAXIMUM_LENGTH" json:"characterMaximumLength"`
	CharacterSetName       string `gorm:"column:CHARACTER_SET_NAME" json:"characterSetName"`
	ColumnType             string `gorm:"column:COLUMN_TYPE" json:"columnType"`
	ColumnKey              string `gorm:"column:COLUMN_KEY" json:"columnKey"`
	Extra                  string `gorm:"column:EXTRA" json:"extra"`
	ColumnComment          string `gorm:"column:COLUMN_COMMENT" json:"columnComment"`
}

DBColumns 数据库列实体

func (*DBColumns) Get

func (m *DBColumns) Get(db *gorm.DB) ([]*DBColumns, error)

Get 查询指定数据

func (*DBColumns) Query

func (m *DBColumns) Query(db *gorm.DB, params param.DBColumnsParam) (*pagination.Result, error)

Query 查询数据

type DBTables

type DBTables struct {
	TableName      string `gorm:"column:TABLE_NAME" json:"tableName"`
	Engine         string `gorm:"column:ENGINE" json:"engine"`
	TableRows      string `gorm:"column:TABLE_ROWS" json:"tableRows"`
	TableCollation string `gorm:"column:TABLE_COLLATION" json:"tableCollation"`
	CreateTime     string `gorm:"column:CREATE_TIME" json:"createTime"`
	UpdateTime     string `gorm:"column:UPDATE_TIME" json:"updateTime"`
	TableComment   string `gorm:"column:TABLE_COMMENT" json:"tableComment"`
}

DBTables 数据库表

func (*DBTables) Get

func (m *DBTables) Get(db *gorm.DB) (*DBTables, error)

Get 查询指定数据

func (*DBTables) Query

func (m *DBTables) Query(db *gorm.DB, params param.DBTablesParam) (*pagination.Result, error)

Query 查询数据

type DataPermission

type DataPermission struct {
	DataScope string
	UserID    int
	DeptID    int
	RoleID    int
}

DataPermission 数据权限

func (*DataPermission) GetDataScope

func (e *DataPermission) GetDataScope(db *gorm.DB, tbname string) (*gorm.DB, error)

GetDataScope GetDataScope

type Dept

type Dept struct {
	DeptID   int    `json:"deptId" gorm:"primary_key;auto_increment;"` // 部门编码
	ParentID int    `json:"parentId" gorm:""`                          // 上级部门
	DeptPath string `json:"deptPath" gorm:"size:255;"`                 // 部门路径
	DeptName string `json:"deptName"  gorm:"size:128;"`                // 部门名称
	Sort     int    `json:"sort" gorm:"index:idx_sort;"`               // 排序
	Leader   string `json:"leader" gorm:"size:128;"`                   // 负责人
	Phone    string `json:"phone" gorm:"size:11;"`                     // 手机
	Email    string `json:"email" gorm:"size:64;"`                     // 邮箱
	Status   string `json:"status" gorm:"size:4;"`                     // 状态
	CreateBy string `json:"createBy" gorm:"size:64;"`
	UpdateBy string `json:"updateBy" gorm:"size:64;"`
	models.AtModel

	DataScope string `json:"dataScope" gorm:"-"`
	Params    string `json:"params" gorm:"-"`
	Children  []Dept `json:"children" gorm:"-"`
}

Dept 部门实体

func (*Dept) Create

func (m *Dept) Create(db *gorm.DB, item *Dept) error

Create 创建数据

func (*Dept) Delete

func (m *Dept) Delete(db *gorm.DB, id int) error

Delete 删除数据

func (*Dept) Exists

func (m *Dept) Exists(db *gorm.DB, item Dept) (bool, error)

Exists 检查数据是否存在

func (*Dept) Get

func (m *Dept) Get(db *gorm.DB) (*Dept, error)

Get 查询指定数据

func (*Dept) Query

func (m *Dept) Query(db *gorm.DB, params param.DeptParam) (*pagination.Result, error)

Query 查询数据

func (*Dept) Update

func (m *Dept) Update(db *gorm.DB, item Dept) error

Update 更新数据

type DeptID

type DeptID struct {
	DeptID int `json:"DeptId"`
}

DeptID 部门ID实体

type DeptIDList

type DeptIDList []*DeptID

DeptIDList 部门ID列表

type DeptLabel

type DeptLabel struct {
	ID       int         `gorm:"-" json:"id"`
	Label    string      `gorm:"-" json:"label"`
	Children []DeptLabel `gorm:"-" json:"children"`
}

DeptLabel 部门标签

type DictData

type DictData struct {
	DictCode  int    `gorm:"column:dict_code;primary_key;auto_increment;" json:"dictCode" example:"1"` // 字典编码
	DictSort  int    `gorm:"column:dict_sort;index:idx_dict_sort;" json:"dictSort"`                    // 显示顺序
	DictLabel string `gorm:"column:dict_label;size:128;" json:"dictLabel"`                             // 数据标签
	DictValue string `gorm:"column:dict_value;size:255;" json:"dictValue"`                             // 数据键值
	DictType  string `gorm:"column:dict_type;size:64;index:idx_dict_type;" json:"dictType"`            // 字典类型
	CSSClass  string `gorm:"column:css_class;size:128;" json:"cssClass"`                               //
	ListClass string `gorm:"column:list_class;size:128;" json:"listClass"`                             //
	IsDefault string `gorm:"column:is_default;size:8;" json:"isDefault"`                               //
	Status    string `gorm:"column:status;size:4;" json:"status"`                                      // 状态
	Default   string `gorm:"column:default;size:8;" json:"default"`                                    //
	CreateBy  string `gorm:"column:create_by;size:64;" json:"createBy"`                                // 创建人
	UpdateBy  string `gorm:"column:update_by;size:64;" json:"updateBy"`                                // 更新人
	Remark    string `gorm:"column:remark;size:255;" json:"remark"`                                    // 备注
	models.AtModel

	Params    string `gorm:"-" json:"params"`
	DataScope string `gorm:"-" json:"dataScope"`
}

DictData 字典数据实体

func (*DictData) BatchDelete

func (m *DictData) BatchDelete(db *gorm.DB, dictCodes []int) error

BatchDelete 批量删除

func (*DictData) Create

func (m *DictData) Create(db *gorm.DB, item DictData) error

Create 创建数据

func (*DictData) Delete

func (m *DictData) Delete(db *gorm.DB, dictCode int) error

Delete 删除数据

func (*DictData) Exists

func (m *DictData) Exists(db *gorm.DB, item DictData) (bool, error)

Exists 检查数据是否存在

func (*DictData) Get

func (m *DictData) Get(db *gorm.DB) (*DictData, error)

Get 查询指定数据

func (*DictData) Query

func (m *DictData) Query(db *gorm.DB, params param.DictDataParam) (*pagination.Result, error)

Query 查询数据

func (*DictData) Update

func (m *DictData) Update(db *gorm.DB, item DictData) error

Update 更新数据

type DictType

type DictType struct {
	DictID   int    `gorm:"primary_key;auto_increment;" json:"dictId"` //字典ID
	DictName string `gorm:"size:128;" json:"dictName"`                 //字典名称
	DictType string `gorm:"size:128;" json:"dictType"`                 //字典类型
	Status   string `gorm:"size:4;" json:"status"`                     //状态
	CreateBy string `gorm:"size:11;" json:"createBy"`                  //创建者
	UpdateBy string `gorm:"size:11;" json:"updateBy"`                  //更新者
	Remark   string `gorm:"size:255;" json:"remark"`                   //备注
	models.AtModel

	DataScope string `gorm:"-" json:"dataScope"` //
	Params    string `gorm:"-" json:"params"`    //
}

DictType 字典类型实体

func (*DictType) BatchDelete

func (m *DictType) BatchDelete(db *gorm.DB, dictIDs []int) error

BatchDelete 批量删除

func (*DictType) Create

func (m *DictType) Create(db *gorm.DB, item DictType) error

Create 创建数据

func (*DictType) Delete

func (m *DictType) Delete(db *gorm.DB, dictID int) error

Delete 删除数据

func (*DictType) Exists

func (m *DictType) Exists(db *gorm.DB, item DictType) (bool, error)

Exists 检查数据是否存在

func (*DictType) Get

func (m *DictType) Get(db *gorm.DB) (*DictType, error)

Get 查询指定数据

func (*DictType) Query

func (m *DictType) Query(db *gorm.DB, params param.DictTypeParam) (*pagination.Result, error)

Query 查询数据

func (*DictType) Update

func (m *DictType) Update(db *gorm.DB, item DictType) error

Update 更新数据

type FileDir

type FileDir struct {
	ID       int    `json:"id"`
	Label    string `json:"label" gorm:"type:varchar(255);"`    // 名称
	PID      int    `json:"pId" gorm:"type:int(11);"`           // 父ID
	Sort     int    `json:"sort" gorm:""`                       // 排序
	Path     string `json:"path" gorm:"size:255;"`              // 路径层级
	CreateBy string `json:"createBy" gorm:"type:varchar(128);"` // 创建人
	UpdateBy string `json:"updateBy" gorm:"type:varchar(128);"` // 更新人
	models.AtModel

	Children  []FileDir `json:"children" gorm:"-"`
	DataScope string    `json:"dataScope" gorm:"-"`
	Params    string    `json:"params"  gorm:"-"`
}

FileDir 文件夹实体

func (*FileDir) BatchDelete

func (m *FileDir) BatchDelete(db *gorm.DB, ids []int) error

BatchDelete 批量删除

func (*FileDir) Create

func (m *FileDir) Create(db *gorm.DB, item *FileDir) error

Create 创建数据

func (*FileDir) Delete

func (m *FileDir) Delete(db *gorm.DB, id int) error

Delete 删除数据

func (*FileDir) Get

func (m *FileDir) Get(db *gorm.DB) (*FileDir, error)

Get 查询指定数据

func (*FileDir) Query

func (m *FileDir) Query(db *gorm.DB, params param.FileDirParam) (*pagination.Result, error)

Query 查询数据

func (*FileDir) Update

func (m *FileDir) Update(db *gorm.DB, item FileDir) error

Update 更新数据

type FileInfo

type FileInfo struct {
	ID       int    `json:"id"`                                 // id
	Type     string `json:"type" gorm:"type:varchar(255);"`     // 文件类型
	Name     string `json:"name" gorm:"type:varchar(255);"`     // 文件名称
	Size     string `json:"size" gorm:"type:int(11);"`          // 文件大小
	PID      int    `json:"pId" gorm:"type:int(11);"`           // 目录ID
	Source   string `json:"source" gorm:"type:varchar(255);"`   // 文件源
	URL      string `json:"url" gorm:"type:varchar(255);"`      // 文件路径
	FullURL  string `json:"fullUrl" gorm:"type:varchar(255);"`  // 文件全路径
	CreateBy string `json:"createBy" gorm:"type:varchar(128);"` // 创建人
	UpdateBy string `json:"updateBy" gorm:"type:varchar(128);"` // 编辑人
	models.AtModel

	DataScope string `json:"dataScope" gorm:"-"`
	Params    string `json:"params"  gorm:"-"`
}

FileInfo 文件信息实体

func (*FileInfo) BatchDelete

func (m *FileInfo) BatchDelete(db *gorm.DB, ids []int) error

BatchDelete 批量删除

func (*FileInfo) Create

func (m *FileInfo) Create(db *gorm.DB, item FileInfo) error

Create 创建数据

func (*FileInfo) Delete

func (m *FileInfo) Delete(db *gorm.DB, id int) error

Delete 删除数据

func (*FileInfo) Get

func (m *FileInfo) Get(db *gorm.DB) (*FileInfo, error)

Get 查询指定数据

func (*FileInfo) Query

func (m *FileInfo) Query(db *gorm.DB, params param.FileInfoParam) (*pagination.Result, error)

Query 查询数据

func (*FileInfo) Update

func (m *FileInfo) Update(db *gorm.DB, item FileInfo) error

Update 更新数据

type Index

type Index struct {
	Normal    map[string]*TableIndex
	Clustered map[string]*TableIndex
}

Index 区分一般索引和聚合索引

type LoginLog

type LoginLog struct {
	InfoID        int       `json:"infoId" gorm:"primary_key;auto_increment;"` // 主键
	Username      string    `json:"username" gorm:"size:128;"`                 // 用户名
	Status        string    `json:"status" gorm:"size:4;"`                     // 状态
	IPaddr        string    `json:"ipaddr" gorm:"size:255;"`                   // ip地址
	LoginLocation string    `json:"loginLocation" gorm:"size:255;"`            // 归属地
	Browser       string    `json:"browser" gorm:"size:255;"`                  // 浏览器
	Os            string    `json:"os" gorm:"size:255;"`                       // 系统
	Platform      string    `json:"platform" gorm:"size:255;"`                 // 固件
	LoginTime     time.Time `json:"loginTime" gorm:"type:timestamp;"`          // 登录时间
	CreateBy      string    `json:"createBy" gorm:"size:128;"`                 // 创建人
	UpdateBy      string    `json:"updateBy" gorm:"size:128;"`                 // 更新者
	DataScope     string    `json:"dataScope" gorm:"-"`                        // 数据
	Remark        string    `json:"remark" gorm:"size:255;"`                   // 备注
	Msg           string    `json:"msg" gorm:"size:255;"`

	Params string `json:"params" gorm:"-"`
	models.AtModel
}

LoginLog 登录日志

func (*LoginLog) BatchDelete

func (m *LoginLog) BatchDelete(db *gorm.DB, ids []int) error

BatchDelete 批量删除

func (*LoginLog) Create

func (m *LoginLog) Create(db *gorm.DB, item LoginLog) error

Create 创建数据

func (*LoginLog) Delete

func (m *LoginLog) Delete(db *gorm.DB, id int) error

Delete 删除数据

func (*LoginLog) Get

func (m *LoginLog) Get(db *gorm.DB) (*LoginLog, error)

Get 查询指定数据

func (*LoginLog) Query

func (m *LoginLog) Query(db *gorm.DB, params param.LoginLogParam) (*pagination.Result, error)

Query 查询数据

func (*LoginLog) Update

func (m *LoginLog) Update(db *gorm.DB, item LoginLog) error

Update 更新数据

type Menu struct {
	MenuID     int    `json:"menuId" gorm:"primary_key;AUTO_INCREMENT;"` // 菜单ID
	MenuName   string `json:"menuName" gorm:"size:128;"`                 // 路由名称; 对应VUE Router中name属性; 菜单类型为目录或菜单时必填
	Title      string `json:"title" gorm:"size:128;"`                    // 菜单标题; 必须;
	Icon       string `json:"icon" gorm:"size:128;"`                     // 菜单图标
	Path       string `json:"path" gorm:"size:128;"`                     // 路由Path; 对应VUE Router中path属性; 菜单类型为目录或菜单时必填
	Paths      string `json:"paths" gorm:"size:128;"`                    // 菜单层级
	MenuType   string `json:"menuType" gorm:"size:1;"`                   // 菜单类型; 必须; M:目录, C:菜单, F:按钮, A:接口; 例如: M
	Action     string `json:"action" gorm:"size:16;"`                    // 请求方式; GET:GET, POST:POST, PUT:PUT, DELETE:DELETE; 菜单类型为接口时必填; 例如: GET
	Permission string `json:"permission" gorm:"size:255;"`               //	权限标识; 例如: "*:*:*"表示所有权限, "system:user:add"表示用户增加权限
	ParentID   int    `json:"parentId" gorm:"size:11;"`                  //	上级菜单ID; 必须; 例如: 1
	NoCache    bool   `json:"noCache" gorm:"size:8;"`                    // 路由缓存; 对应VUE Router中meta下noCache属性
	Breadcrumb string `json:"breadcrumb" gorm:"size:255;"`               // 导航; 未使用
	Component  string `json:"component" gorm:"size:255;"`                // 组件路径; 对应VUE Router中component属性; 菜单类型为目录或菜单时必填
	Sort       int    `json:"sort" gorm:"size:4;index:idx_sort;"`        // 菜单显示顺序; 例如: 1
	Visible    string `json:"visible" gorm:"size:1;"`                    // 菜单状态; 0:显示, 1:隐藏; 菜单类型为目录、菜单或接口时需要; 例如: 0
	CreateBy   string `json:"createBy" gorm:"size:128;"`                 // 创建人
	UpdateBy   string `json:"updateBy" gorm:"size:128;"`                 // 更新人
	IsFrame    string `json:"isFrame" gorm:"size:1;default:0;"`          // 外链; 0:是, 1:否; 菜单类型为目录或菜单时需要; 例如: 1
	DataScope  string `json:"dataScope" gorm:"-"`                        // 数据权限
	Params     string `json:"params" gorm:"-"`                           // 参数
	RoleID     int    `gorm:"-"`                                         // 角色ID
	Children   []Menu `json:"children" gorm:"-"`                         // 子菜单
	IsSelect   bool   `json:"is_select" gorm:"-"`                        // 选中
	models.AtModel
}

Menu 菜单实体

func (m *Menu) BatchDelete(db *gorm.DB, ids []int) error

BatchDelete 批量删除

func (m *Menu) Create(db *gorm.DB, item *Menu) error

Create 创建数据

func (m *Menu) Delete(db *gorm.DB, id int) error

Delete 删除数据

func (m *Menu) Exists(db *gorm.DB, item Menu) (bool, error)

Exists 检查数据是否存在

func (m *Menu) Get(db *gorm.DB) (*Menu, error)

Get 查询指定数据

func (m *Menu) GetWithRole(db *gorm.DB, roleName string) ([]Menu, error)

GetWithRole 查询角色菜单

func (m *Menu) Query(db *gorm.DB, params param.MenuParam) (*pagination.Result, error)

Query 查询数据

func (m *Menu) Update(db *gorm.DB, item Menu) error

Update 更新数据

type MenuID struct {
	MenuID int `json:"menuId"`
}

MenuID MenuID实体

type MenuIDList []*MenuID

MenuIDList MenuID列表

type MenuLabel struct {
	ID       int         `json:"id" gorm:"-"`
	Label    string      `json:"label" gorm:"-"`
	Children []MenuLabel `json:"children" gorm:"-"`
}

MenuLabel 菜单标识

type MenuPath struct {
	Path string `json:"path"`
}

MenuPath 菜单路径

type OperLog

type OperLog struct {
	OperID        int       `json:"operId" gorm:"primary_key;AUTO_INCREMENT;"` // 日志编码
	Title         string    `json:"title" gorm:"size:255;"`                    // 操作模块
	BusinessType  string    `json:"businessType" gorm:"size:128;"`             // 操作类型
	BusinessTypes string    `json:"businessTypes" gorm:"size:128;"`            // 操作类型
	Method        string    `json:"method" gorm:"size:128;"`                   // 函数
	RequestMethod string    `json:"requestMethod" gorm:"size:128;"`            // 请求方式
	OperatorType  string    `json:"operatorType" gorm:"size:128;"`             // 操作类型
	OperName      string    `json:"operName" gorm:"size:128;"`                 // 操作者
	DeptName      string    `json:"deptName" gorm:"size:128;"`                 // 部门名称
	OperURL       string    `json:"operUrl" gorm:"size:255;"`                  // 访问地址
	OperIP        string    `json:"operIp" gorm:"size:128;"`                   // 客户端ip
	OperLocation  string    `json:"operLocation" gorm:"size:128;"`             // 访问位置
	OperParam     string    `json:"operParam" gorm:"size:255;"`                // 请求参数
	Status        string    `json:"status" gorm:"size:4;"`                     // 操作状态
	OperTime      time.Time `json:"operTime" gorm:"type:timestamp;"`           // 操作时间
	JSONResult    string    `json:"jsonResult" gorm:"size:255;"`               // 返回数据
	CreateBy      string    `json:"createBy" gorm:"size:128;"`                 // 创建人
	UpdateBy      string    `json:"updateBy" gorm:"size:128;"`                 // 更新者
	DataScope     string    `json:"dataScope" gorm:"-"`                        // 数据
	Params        string    `json:"params" gorm:"-"`                           // 参数
	Remark        string    `json:"remark" gorm:"size:255;"`                   // 备注
	LatencyTime   string    `json:"latencyime" gorm:"size:128;"`               // 耗时
	UserAgent     string    `json:"userAgent" gorm:"size:255;"`                // UserAgent
	models.AtModel
}

OperLog 操作日志

func (*OperLog) BatchDelete

func (m *OperLog) BatchDelete(db *gorm.DB, ids []int) error

BatchDelete 批量删除

func (*OperLog) Create

func (m *OperLog) Create(db *gorm.DB, item OperLog) error

Create 创建数据

func (*OperLog) Delete

func (m *OperLog) Delete(db *gorm.DB, id int) error

Delete 删除数据

func (*OperLog) Get

func (m *OperLog) Get(db *gorm.DB) (*OperLog, error)

Get 查询指定数据

func (*OperLog) Query

func (m *OperLog) Query(db *gorm.DB, params param.OperLogParam) (*pagination.Result, error)

Query 查询数据

func (*OperLog) Update

func (m *OperLog) Update(db *gorm.DB, item OperLog) error

Update 更新数据

type Params

type Params struct {
	TreeCode       string `gorm:"-" json:"treeCode"`
	TreeParentCode string `gorm:"-" json:"treeParentCode"`
	TreeName       string `gorm:"-" json:"treeName"`
}

Params 树参数

type Post

type Post struct {
	PostID   int    `gorm:"primary_key;AUTO_INCREMENT;" json:"postId"` //岗位编号
	PostName string `gorm:"size:128;" json:"postName"`                 //岗位名称
	PostCode string `gorm:"size:128;" json:"postCode"`                 //岗位代码
	Sort     int    `gorm:"" json:"sort"`                              //岗位排序
	Status   string `gorm:"size:4;" json:"status"`                     //状态
	Remark   string `gorm:"size:255;" json:"remark"`                   //描述
	CreateBy string `gorm:"size:128;" json:"createBy"`
	UpdateBy string `gorm:"size:128;" json:"updateBy"`
	models.AtModel

	DataScope string `gorm:"-" json:"dataScope"`
	Params    string `gorm:"-" json:"params"`
}

Post 岗位实体

func (*Post) BatchDelete

func (m *Post) BatchDelete(db *gorm.DB, ids []int) error

BatchDelete 批量删除

func (*Post) Create

func (m *Post) Create(db *gorm.DB, item Post) error

Create 创建数据

func (*Post) Delete

func (m *Post) Delete(db *gorm.DB, id int) error

Delete 删除数据

func (*Post) Exists

func (m *Post) Exists(db *gorm.DB, item Post) (bool, error)

Exists 检查数据是否存在

func (*Post) Get

func (m *Post) Get(db *gorm.DB) (*Post, error)

Get 查询指定数据

func (*Post) Query

func (m *Post) Query(db *gorm.DB, params param.PostParam) (*pagination.Result, error)

Query 查询数据

func (*Post) Update

func (m *Post) Update(db *gorm.DB, item Post) error

Update 更新数据

type Role

type Role struct {
	RoleID    int    `json:"roleId" gorm:"primary_key;AUTO_INCREMENT;"` // 角色编码
	RoleName  string `json:"roleName" gorm:"size:128;"`                 // 角色名称
	Status    string `json:"status" gorm:"size:4;"`                     // 角色状态
	RoleKey   string `json:"roleKey" gorm:"size:128;"`                  // 角色代码
	RoleSort  int    `json:"roleSort" gorm:""`                          // 角色排序
	Flag      string `json:"flag" gorm:"size:128;"`                     // 标识
	Remark    string `json:"remark" gorm:"size:255;"`                   // 备注
	CreateBy  string `json:"createBy" gorm:"size:128;"`                 // 创建人
	UpdateBy  string `json:"updateBy" gorm:"size:128;"`                 // 更新人
	Admin     bool   `json:"admin" gorm:"size:4;"`                      // 管理员
	DataScope string `json:"dataScope" gorm:"size:128;"`                // 数据权限
	models.AtModel

	Params  string `json:"params" gorm:"-"`
	MenuIDs []int  `json:"menuIds" gorm:"-"`
	DeptIDs []int  `json:"deptIds" gorm:"-"`
}

Role 角色实体

func (*Role) BatchDelete

func (m *Role) BatchDelete(db *gorm.DB, ids []int) error

BatchDelete 批量删除

func (*Role) Create

func (m *Role) Create(db *gorm.DB, item *Role) error

Create 创建数据

func (*Role) Delete

func (m *Role) Delete(db *gorm.DB, id int) error

Delete 删除数据

func (*Role) Exists

func (m *Role) Exists(db *gorm.DB, item Role) (bool, error)

Exists 检查数据是否存在

func (*Role) Get

func (m *Role) Get(db *gorm.DB) (*Role, error)

Get 查询指定数据

func (*Role) GetWithDept

func (m *Role) GetWithDept(db *gorm.DB) ([]int, error)

GetWithDept 获取角色对应部门ID

func (*Role) GetWithMenu

func (m *Role) GetWithMenu(db *gorm.DB) ([]int, error)

GetWithMenu 获取角色对应菜单ID

func (*Role) Query

func (m *Role) Query(db *gorm.DB, params param.RoleParam) (*pagination.Result, error)

Query 查询数据

func (*Role) Update

func (m *Role) Update(db *gorm.DB, item Role) error

Update 更新数据

type RoleDept

type RoleDept struct {
	RoleID int `gorm:""`
	DeptID int `gorm:""`
}

RoleDept 角色部门

func (*RoleDept) Create

func (m *RoleDept) Create(db *gorm.DB, roleID int, deptIDs []int) error

Create 创建

func (*RoleDept) Delete

func (m *RoleDept) Delete(db *gorm.DB, roleID int) error

Delete 删除角色部门

type RoleMenu

type RoleMenu struct {
	RoleID   int    `gorm:""`
	MenuID   int    `gorm:""`
	RoleName string `gorm:"size:128;"`
	CreateBy string `gorm:"size:128;"`
	UpdateBy string `gorm:"size:128;"`
}

RoleMenu 角色菜单实体

func NewRoleMenu

func NewRoleMenu() *RoleMenu

NewRoleMenu 角色菜单模型实例

func (*RoleMenu) BatchDeleteRoleMenu

func (m *RoleMenu) BatchDeleteRoleMenu(db *gorm.DB, IDs []int) error

BatchDeleteRoleMenu 批量删除角色菜单(该方法即将弃用)

func (*RoleMenu) Create

func (m *RoleMenu) Create(db *gorm.DB, roleID int, menuID []int) error

Create 创建角色菜单

func (*RoleMenu) Delete

func (m *RoleMenu) Delete(db *gorm.DB) error

Delete 删除角色菜单

func (*RoleMenu) DeleteRoleMenu

func (m *RoleMenu) DeleteRoleMenu(db *gorm.DB, id int) error

DeleteRoleMenu 删除角色菜单

func (*RoleMenu) Get

func (m *RoleMenu) Get(db *gorm.DB) ([]RoleMenu, error)

Get 查询指定数据

func (*RoleMenu) GetIDs

func (m *RoleMenu) GetIDs(db *gorm.DB) ([]MenuPath, error)

GetIDs 获取所有ID

func (*RoleMenu) GetPermissions

func (m *RoleMenu) GetPermissions(db *gorm.DB, roleID int) ([]string, error)

GetPermissions 获取权限

type Setting

type Setting struct {
	SettingsID int    `json:"settings_id" gorm:"primary_key;AUTO_INCREMENT"`
	Name       string `json:"name" gorm:"type:varchar(256);"`
	models.AtModel
}

Setting 设置

func (*Setting) Create

func (m *Setting) Create(db *gorm.DB, item Setting) error

Create 创建数据

func (*Setting) Get

func (m *Setting) Get(db *gorm.DB) (*Setting, error)

Get 查询指定数据

func (*Setting) Update

func (m *Setting) Update(db *gorm.DB, item *Setting) error

Update 更新数据

type TableIndex

type TableIndex struct {
	Table      string `gorm:"column:Table"`        // 表名
	NonUnique  int    `gorm:"column:Non_unique"`   // 唯一索引
	KeyName    string `gorm:"column:Key_name"`     // 索引名称
	SeqInIndex int    `gorm:"column:Seq_in_index"` // 索引中的列序列号
	ColumnName string `gorm:"column:Column_name"`  // 索引的列名
	Visible    string `gorm:"column:Visible"`      // 不可见索引
	Clustered  bool   `gorm:"-"`                   // 聚合索引
}

TableIndex 表索引

func (*TableIndex) Get

func (m *TableIndex) Get(db *gorm.DB) (*Index, error)

Get 查询指定数据

type TableIndexList

type TableIndexList []*TableIndex

TableIndexList 索引列表

type Tables

type Tables struct {
	TableID             int    `gorm:"primary_key;auto_increment;" json:"tableId"`   // 表编码
	TBName              string `gorm:"column:table_name;size:255;" json:"tableName"` // 表名称
	TableComment        string `gorm:"size:255;" json:"tableComment"`                // 表备注
	ClassName           string `gorm:"size:255;" json:"className"`                   // 类名
	TplCategory         string `gorm:"size:255;" json:"tplCategory"`                 //
	PackageName         string `gorm:"size:255;" json:"packageName"`                 // 包名
	ModuleName          string `gorm:"size:255;" json:"moduleName"`                  // 模块名
	BusinessName        string `gorm:"size:255;" json:"businessName"`                //
	FunctionName        string `gorm:"size:255;" json:"functionName"`                // 功能名称
	FunctionAuthor      string `gorm:"size:255;" json:"functionAuthor"`              // 功能作者
	PkColumn            string `gorm:"size:255;" json:"pkColumn"`                    // 列
	PkGoField           string `gorm:"size:255;" json:"pkGoField"`                   // GO字段
	PkJSONField         string `gorm:"size:255;" json:"pkJsonField"`                 // JSON字段
	Options             string `gorm:"size:255;" json:"options"`                     // 选项
	TreeCode            string `gorm:"size:255;" json:"treeCode"`                    // 树编码
	TreeParentCode      string `gorm:"size:255;" json:"treeParentCode"`              // 树父编码
	TreeName            string `gorm:"size:255;" json:"treeName"`                    // 树Name
	Tree                bool   `gorm:"size:1;" json:"tree"`                          // 树
	Crud                bool   `gorm:"size:1;" json:"crud"`                          // 增删改查
	Remark              string `gorm:"size:255;" json:"remark"`                      // 备注
	IsDataScope         int    `gorm:"size:1;" json:"isDataScope"`                   // 数据权限
	IsActions           int    `gorm:"size:1;" json:"isActions"`                     // 动作
	IsAuth              int    `gorm:"size:1;" json:"isAuth"`                        // 认证
	IsLogicalDelete     string `gorm:"size:1;" json:"isLogicalDelete"`               // 是否逻辑删除
	LogicalDelete       bool   `gorm:"size:1;" json:"logicalDelete"`                 // 逻辑删除
	LogicalDeleteColumn string `gorm:"size:128;" json:"logicalDeleteColumn"`         // 逻辑删除列
	CreateBy            string `gorm:"size:128;" json:"createBy"`                    // 创建人
	UpdateBy            string `gorm:"size:128;" json:"updateBy"`                    // 更新人
	models.AtModel

	DataScope string    `gorm:"-" json:"dataScope"` // 数据权限
	Params    Params    `gorm:"-" json:"params"`    // 参数
	Columns   []Columns `gorm:"-" json:"columns"`   // 列
}

Tables 表

func (*Tables) BatchDelete

func (m *Tables) BatchDelete(db *gorm.DB, ids []int) error

BatchDelete 批量删除

func (*Tables) Create

func (m *Tables) Create(db *gorm.DB, item *Tables) error

Create 创建数据

func (*Tables) Delete

func (m *Tables) Delete(db *gorm.DB, id int) error

Delete 删除数据

func (*Tables) Get

func (m *Tables) Get(db *gorm.DB) (*Tables, error)

Get 查询指定数据

func (*Tables) List

func (m *Tables) List(db *gorm.DB, tableNames []string) ([]*Tables, error)

List 查询所有

func (*Tables) Query

func (m *Tables) Query(db *gorm.DB, params param.TablesParam) (*pagination.Result, error)

Query 查询数据

func (*Tables) Update

func (m *Tables) Update(db *gorm.DB, item Tables) error

Update 更新数据

type User

type User struct {
	UserID   int    `gorm:"primary_key;AUTO_INCREMENT;"  json:"userId"` // 用户ID
	Username string `gorm:"size:64" json:"username"`                    // 用户名
	Password string `gorm:"size:128" json:"password"`                   // 密码
	NickName string `gorm:"size:128" json:"nickName"`                   // 昵称
	Phone    string `gorm:"size:11" json:"phone"`                       // 手机号
	RoleID   int    `gorm:"index:idx_role_id;" json:"roleId"`           // 角色编码
	Salt     string `gorm:"size:255" json:"salt"`                       // 盐
	Avatar   string `gorm:"size:255" json:"avatar"`                     // 头像
	Sex      string `gorm:"size:255" json:"sex"`                        // 性别
	Email    string `gorm:"size:128" json:"email"`                      // 邮箱
	DeptID   int    `gorm:"" json:"deptId"`                             // 部门编码
	PostID   int    `gorm:"" json:"postId"`                             // 职位编码
	CreateBy string `gorm:"size:128" json:"createBy"`                   // 创建人
	UpdateBy string `gorm:"size:128" json:"updateBy"`                   // 更新人
	Remark   string `gorm:"size:255" json:"remark"`                     // 备注
	Status   string `gorm:"size:4;" json:"status"`                      // 状态
	models.AtModel

	RoleName string `gorm:"-"  json:"role_name"` // 角色名称
	DeptName string `gorm:"-" json:"deptName"`   // 部门名称

	DataScope string `gorm:"-" json:"dataScope"`
	Params    string `gorm:"-" json:"params"`
}

User 用户实体

func (*User) BatchDelete

func (m *User) BatchDelete(db *gorm.DB, id []int) error

BatchDelete 批量删除

func (*User) Create

func (m *User) Create(db *gorm.DB, item User) error

Create 创建数据

func (*User) Delete

func (m *User) Delete(db *gorm.DB, id int) error

Delete 删除数据

func (*User) Exists

func (m *User) Exists(db *gorm.DB, item User) (bool, error)

Exists 检查数据是否存在

func (*User) Get

func (m *User) Get(db *gorm.DB) (*User, error)

Get 查询指定数据

func (*User) Query

func (m *User) Query(db *gorm.DB, params param.UserParam) (*pagination.Result, error)

Query 查询数据

func (*User) Update

func (m *User) Update(db *gorm.DB, item User) error

Update 更新数据

Jump to

Keyboard shortcuts

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