513 lines
18 KiB
Go
513 lines
18 KiB
Go
// Code generated by protoc-gen-go-aeus. DO NOT EDIT.
|
|
// source: organize.proto
|
|
// date: 2025-06-19 11:06:34
|
|
|
|
package pb
|
|
|
|
import (
|
|
"gorm.io/gorm"
|
|
)
|
|
|
|
type MenuModel struct {
|
|
Id int64 `json:"id" yaml:"id" xml:"id" gorm:"primaryKey;column:id" comment:"菜单ID"`
|
|
CreatedAt int64 `json:"created_at" yaml:"createdAt" xml:"createdAt" gorm:"column:created_at" comment:"创建时间" scenarios:"view;export"`
|
|
UpdatedAt int64 `json:"updated_at" yaml:"updatedAt" xml:"updatedAt" gorm:"index;column:updated_at" comment:"更新时间" scenarios:"view;export"`
|
|
Parent string `json:"parent" yaml:"parent" xml:"parent" gorm:"index;size:60;column:parent" comment:"父级菜单" format:"menu" props:"readonly:update" live:"type:dropdown;url:/menu/level-labels"`
|
|
Name string `json:"name" yaml:"name" xml:"name" gorm:"index;size:60;column:name" comment:"组件名称" props:"readonly:update" rule:"unique;required"`
|
|
Label string `json:"label" yaml:"label" xml:"label" gorm:"size:120;column:label" comment:"菜单标题" rule:"required"`
|
|
Uri string `json:"uri" yaml:"uri" xml:"uri" gorm:"size:512;column:uri" comment:"菜单链接" scenarios:"create;update;view;export" rule:"required"`
|
|
ViewPath string `json:"view_path" yaml:"viewPath" xml:"viewPath" gorm:"size:512;column:view_path" comment:"视图路径" scenarios:"create;update;view;export"`
|
|
Icon string `json:"icon" yaml:"icon" xml:"icon" gorm:"size:60;column:icon" comment:"菜单图标" scenarios:"create;update;view;export"`
|
|
Hidden bool `json:"hidden" yaml:"hidden" xml:"hidden" gorm:"column:hidden" comment:"是否隐藏" scenarios:"create;update;view;export"`
|
|
Public bool `json:"public" yaml:"public" xml:"public" gorm:"column:public" comment:"是否公开" scenarios:"create;update;view;export"`
|
|
Description string `json:"description" yaml:"description" xml:"description" gorm:"size:1024;column:description" comment:"备注说明" scenarios:"create;update;view;export;list" format:"textarea"`
|
|
Position int64 `json:"position" yaml:"position" xml:"position" gorm:"column:position" comment:"排序" scenarios:"create;update"`
|
|
}
|
|
|
|
func (m *MenuModel) TableName() string {
|
|
return "menus"
|
|
}
|
|
|
|
func (m *MenuModel) FromValue(x *Menu) {
|
|
m.Id = x.Id
|
|
m.CreatedAt = x.CreatedAt
|
|
m.UpdatedAt = x.UpdatedAt
|
|
m.Parent = x.Parent
|
|
m.Name = x.Name
|
|
m.Label = x.Label
|
|
m.Uri = x.Uri
|
|
m.ViewPath = x.ViewPath
|
|
m.Icon = x.Icon
|
|
m.Hidden = x.Hidden
|
|
m.Public = x.Public
|
|
m.Description = x.Description
|
|
m.Position = x.Position
|
|
}
|
|
|
|
func (m *MenuModel) ToValue() (x *Menu) {
|
|
x = &Menu{}
|
|
x.Id = m.Id
|
|
x.CreatedAt = m.CreatedAt
|
|
x.UpdatedAt = m.UpdatedAt
|
|
x.Parent = m.Parent
|
|
x.Name = m.Name
|
|
x.Label = m.Label
|
|
x.Uri = m.Uri
|
|
x.ViewPath = m.ViewPath
|
|
x.Icon = m.Icon
|
|
x.Hidden = m.Hidden
|
|
x.Public = m.Public
|
|
x.Description = m.Description
|
|
x.Position = m.Position
|
|
return x
|
|
}
|
|
|
|
func (m *MenuModel) Create(db *gorm.DB) (err error) {
|
|
return db.Create(m).Error
|
|
}
|
|
|
|
func (m *MenuModel) UpdateColumn(db *gorm.DB, column string, value any) (err error) {
|
|
return db.Model(m).UpdateColumn(column, value).Error
|
|
}
|
|
|
|
func (m *MenuModel) Save(db *gorm.DB) (err error) {
|
|
return db.Save(m).Error
|
|
}
|
|
|
|
func (m *MenuModel) Delete(db *gorm.DB) (err error) {
|
|
return db.Delete(m).Error
|
|
}
|
|
|
|
func (m *MenuModel) Find(db *gorm.DB, pk any) (err error) {
|
|
return db.Where("id=?", pk).First(m).Error
|
|
}
|
|
|
|
func (m *MenuModel) QueryOne(db *gorm.DB, query any, args ...any) (err error) {
|
|
return db.Where(query, args...).First(m).Error
|
|
}
|
|
|
|
func (m *MenuModel) QueryAll(db *gorm.DB, query any, args ...any) (err error) {
|
|
return db.Where(query, args...).Find(m).Error
|
|
}
|
|
|
|
func NewMenuModel() *MenuModel {
|
|
return &MenuModel{}
|
|
}
|
|
|
|
type RoleModel struct {
|
|
Id int64 `json:"id" yaml:"id" xml:"id" gorm:"primaryKey;column:id" comment:"角色ID"`
|
|
CreatedAt int64 `json:"created_at" yaml:"createdAt" xml:"createdAt" gorm:"column:created_at" comment:"创建时间" scenarios:"view;export"`
|
|
UpdatedAt int64 `json:"updated_at" yaml:"updatedAt" xml:"updatedAt" gorm:"index;column:updated_at" comment:"更新时间" scenarios:"view;export"`
|
|
Name string `json:"name" yaml:"name" xml:"name" gorm:"index;size:60;column:name" comment:"角色名称" props:"readonly:update" rule:"required"`
|
|
Label string `json:"label" yaml:"label" xml:"label" gorm:"size:60;column:label" comment:"角色标题" rule:"required"`
|
|
Description string `json:"description" yaml:"description" xml:"description" gorm:"size:1024;column:description" comment:"备注说明" scenarios:"list;create;update;export" format:"textarea"`
|
|
}
|
|
|
|
func (m *RoleModel) TableName() string {
|
|
return "roles"
|
|
}
|
|
|
|
func (m *RoleModel) FromValue(x *Role) {
|
|
m.Id = x.Id
|
|
m.CreatedAt = x.CreatedAt
|
|
m.UpdatedAt = x.UpdatedAt
|
|
m.Name = x.Name
|
|
m.Label = x.Label
|
|
m.Description = x.Description
|
|
}
|
|
|
|
func (m *RoleModel) ToValue() (x *Role) {
|
|
x = &Role{}
|
|
x.Id = m.Id
|
|
x.CreatedAt = m.CreatedAt
|
|
x.UpdatedAt = m.UpdatedAt
|
|
x.Name = m.Name
|
|
x.Label = m.Label
|
|
x.Description = m.Description
|
|
return x
|
|
}
|
|
|
|
func (m *RoleModel) Create(db *gorm.DB) (err error) {
|
|
return db.Create(m).Error
|
|
}
|
|
|
|
func (m *RoleModel) UpdateColumn(db *gorm.DB, column string, value any) (err error) {
|
|
return db.Model(m).UpdateColumn(column, value).Error
|
|
}
|
|
|
|
func (m *RoleModel) Save(db *gorm.DB) (err error) {
|
|
return db.Save(m).Error
|
|
}
|
|
|
|
func (m *RoleModel) Delete(db *gorm.DB) (err error) {
|
|
return db.Delete(m).Error
|
|
}
|
|
|
|
func (m *RoleModel) Find(db *gorm.DB, pk any) (err error) {
|
|
return db.Where("id=?", pk).First(m).Error
|
|
}
|
|
|
|
func (m *RoleModel) QueryOne(db *gorm.DB, query any, args ...any) (err error) {
|
|
return db.Where(query, args...).First(m).Error
|
|
}
|
|
|
|
func (m *RoleModel) QueryAll(db *gorm.DB, query any, args ...any) (err error) {
|
|
return db.Where(query, args...).Find(m).Error
|
|
}
|
|
|
|
func NewRoleModel() *RoleModel {
|
|
return &RoleModel{}
|
|
}
|
|
|
|
type PermissionModel struct {
|
|
Id int64 `json:"id" yaml:"id" xml:"id" gorm:"primaryKey;column:id" comment:"权限ID"`
|
|
CreatedAt int64 `json:"created_at" yaml:"createdAt" xml:"createdAt" gorm:"column:created_at" comment:"创建时间" scenarios:"view;export"`
|
|
UpdatedAt int64 `json:"updated_at" yaml:"updatedAt" xml:"updatedAt" gorm:"index;column:updated_at" comment:"更新时间" scenarios:"view;export"`
|
|
Menu string `json:"menu" yaml:"menu" xml:"menu" gorm:"index;size:60;column:menu" comment:"所属菜单" format:"menu" rule:"required"`
|
|
Permission string `json:"permission" yaml:"permission" xml:"permission" gorm:"index;size:60;column:permission" comment:"权限名称" rule:"required"`
|
|
Label string `json:"label" yaml:"label" xml:"label" gorm:"size:60;column:label" comment:"权限标题" rule:"required"`
|
|
}
|
|
|
|
func (m *PermissionModel) TableName() string {
|
|
return "permissions"
|
|
}
|
|
|
|
func (m *PermissionModel) FromValue(x *Permission) {
|
|
m.Id = x.Id
|
|
m.CreatedAt = x.CreatedAt
|
|
m.UpdatedAt = x.UpdatedAt
|
|
m.Menu = x.Menu
|
|
m.Permission = x.Permission
|
|
m.Label = x.Label
|
|
}
|
|
|
|
func (m *PermissionModel) ToValue() (x *Permission) {
|
|
x = &Permission{}
|
|
x.Id = m.Id
|
|
x.CreatedAt = m.CreatedAt
|
|
x.UpdatedAt = m.UpdatedAt
|
|
x.Menu = m.Menu
|
|
x.Permission = m.Permission
|
|
x.Label = m.Label
|
|
return x
|
|
}
|
|
|
|
func (m *PermissionModel) Create(db *gorm.DB) (err error) {
|
|
return db.Create(m).Error
|
|
}
|
|
|
|
func (m *PermissionModel) UpdateColumn(db *gorm.DB, column string, value any) (err error) {
|
|
return db.Model(m).UpdateColumn(column, value).Error
|
|
}
|
|
|
|
func (m *PermissionModel) Save(db *gorm.DB) (err error) {
|
|
return db.Save(m).Error
|
|
}
|
|
|
|
func (m *PermissionModel) Delete(db *gorm.DB) (err error) {
|
|
return db.Delete(m).Error
|
|
}
|
|
|
|
func (m *PermissionModel) Find(db *gorm.DB, pk any) (err error) {
|
|
return db.Where("id=?", pk).First(m).Error
|
|
}
|
|
|
|
func (m *PermissionModel) QueryOne(db *gorm.DB, query any, args ...any) (err error) {
|
|
return db.Where(query, args...).First(m).Error
|
|
}
|
|
|
|
func (m *PermissionModel) QueryAll(db *gorm.DB, query any, args ...any) (err error) {
|
|
return db.Where(query, args...).Find(m).Error
|
|
}
|
|
|
|
func NewPermissionModel() *PermissionModel {
|
|
return &PermissionModel{}
|
|
}
|
|
|
|
type RolePermissionModel struct {
|
|
Id int64 `json:"id" yaml:"id" xml:"id" gorm:"primaryKey;column:id" comment:"ID"`
|
|
Role string `json:"role" yaml:"role" xml:"role" gorm:"index;size:60;column:role" comment:"角色" rule:"required"`
|
|
Permission string `json:"permission" yaml:"permission" xml:"permission" gorm:"size:60;column:permission" comment:"权限" rule:"required"`
|
|
}
|
|
|
|
func (m *RolePermissionModel) TableName() string {
|
|
return "role_permissions"
|
|
}
|
|
|
|
func (m *RolePermissionModel) FromValue(x *RolePermission) {
|
|
m.Id = x.Id
|
|
m.Role = x.Role
|
|
m.Permission = x.Permission
|
|
}
|
|
|
|
func (m *RolePermissionModel) ToValue() (x *RolePermission) {
|
|
x = &RolePermission{}
|
|
x.Id = m.Id
|
|
x.Role = m.Role
|
|
x.Permission = m.Permission
|
|
return x
|
|
}
|
|
|
|
func (m *RolePermissionModel) Create(db *gorm.DB) (err error) {
|
|
return db.Create(m).Error
|
|
}
|
|
|
|
func (m *RolePermissionModel) UpdateColumn(db *gorm.DB, column string, value any) (err error) {
|
|
return db.Model(m).UpdateColumn(column, value).Error
|
|
}
|
|
|
|
func (m *RolePermissionModel) Save(db *gorm.DB) (err error) {
|
|
return db.Save(m).Error
|
|
}
|
|
|
|
func (m *RolePermissionModel) Delete(db *gorm.DB) (err error) {
|
|
return db.Delete(m).Error
|
|
}
|
|
|
|
func (m *RolePermissionModel) Find(db *gorm.DB, pk any) (err error) {
|
|
return db.Where("id=?", pk).First(m).Error
|
|
}
|
|
|
|
func (m *RolePermissionModel) QueryOne(db *gorm.DB, query any, args ...any) (err error) {
|
|
return db.Where(query, args...).First(m).Error
|
|
}
|
|
|
|
func (m *RolePermissionModel) QueryAll(db *gorm.DB, query any, args ...any) (err error) {
|
|
return db.Where(query, args...).Find(m).Error
|
|
}
|
|
|
|
func NewRolePermissionModel() *RolePermissionModel {
|
|
return &RolePermissionModel{}
|
|
}
|
|
|
|
type UserModel struct {
|
|
Id int64 `json:"id" yaml:"id" xml:"id" gorm:"primaryKey;column:id" comment:"ID"`
|
|
CreatedAt int64 `json:"created_at" yaml:"createdAt" xml:"createdAt" gorm:"column:created_at" comment:"创建时间" scenarios:"view;export"`
|
|
UpdatedAt int64 `json:"updated_at" yaml:"updatedAt" xml:"updatedAt" gorm:"index;column:updated_at" comment:"更新时间" scenarios:"view;export"`
|
|
Uid string `json:"uid" yaml:"uid" xml:"uid" gorm:"index;size:20;column:uid" comment:"用户工号" props:"readonly:update" rule:"required;unique;regexp:^[a-zA-Z0-9]{3,8}$"`
|
|
Username string `json:"username" yaml:"username" xml:"username" gorm:"size:20;column:username" comment:"用户名称" rule:"required"`
|
|
Role string `json:"role" yaml:"role" xml:"role" gorm:"size:60;not null;default:'';column:role" comment:"所属角色" format:"role" rule:"required" live:"type:dropdown;url:/role/labels"`
|
|
Admin bool `json:"admin" yaml:"admin" xml:"admin" gorm:"column:admin" comment:"管理员" scenarios:"create"`
|
|
Status string `json:"status" yaml:"status" xml:"status" gorm:"size:20;default:normal;column:status" comment:"状态" scenarios:"create,update,list,search" enum:"normal:正常;disable:禁用"`
|
|
DeptId int64 `json:"dept_id" yaml:"deptId" xml:"deptId" gorm:"not null;default:0;column:dept_id" comment:"所属部门" format:"department" rule:"required" live:"type:dropdown;url:/department/labels"`
|
|
Tag string `json:"tag" yaml:"tag" xml:"tag" gorm:"size:60;column:tag" comment:"用户标签" scenarios:"list;create;update" live:"type:dropdown;url:/user/tags" dropdown:"created;filterable;default_first"`
|
|
Password string `json:"password" yaml:"password" xml:"password" gorm:"size:60;column:password" comment:"用户密码" scenarios:"create" rule:"required"`
|
|
Email string `json:"email" yaml:"email" xml:"email" gorm:"size:60;column:email" comment:"用户邮箱" scenarios:"create;update;view;list;export"`
|
|
Avatar string `json:"avatar" yaml:"avatar" xml:"avatar" gorm:"size:1024;column:avatar" comment:"用户头像" scenarios:"view"`
|
|
Gender string `json:"gender" yaml:"gender" xml:"gender" gorm:"size:20;default:man;column:gender" comment:"用户性别" scenarios:"list;create;update;view;export" rule:"required" enum:"man:男;woman:女;other:其他"`
|
|
Description string `json:"description" yaml:"description" xml:"description" gorm:"size:1024;column:description" comment:"备注说明" scenarios:"create;update;view;export" format:"textarea"`
|
|
}
|
|
|
|
func (m *UserModel) TableName() string {
|
|
return "users"
|
|
}
|
|
|
|
func (m *UserModel) FromValue(x *User) {
|
|
m.Id = x.Id
|
|
m.CreatedAt = x.CreatedAt
|
|
m.UpdatedAt = x.UpdatedAt
|
|
m.Uid = x.Uid
|
|
m.Username = x.Username
|
|
m.Role = x.Role
|
|
m.Admin = x.Admin
|
|
m.Status = x.Status
|
|
m.DeptId = x.DeptId
|
|
m.Tag = x.Tag
|
|
m.Password = x.Password
|
|
m.Email = x.Email
|
|
m.Avatar = x.Avatar
|
|
m.Gender = x.Gender
|
|
m.Description = x.Description
|
|
}
|
|
|
|
func (m *UserModel) ToValue() (x *User) {
|
|
x = &User{}
|
|
x.Id = m.Id
|
|
x.CreatedAt = m.CreatedAt
|
|
x.UpdatedAt = m.UpdatedAt
|
|
x.Uid = m.Uid
|
|
x.Username = m.Username
|
|
x.Role = m.Role
|
|
x.Admin = m.Admin
|
|
x.Status = m.Status
|
|
x.DeptId = m.DeptId
|
|
x.Tag = m.Tag
|
|
x.Password = m.Password
|
|
x.Email = m.Email
|
|
x.Avatar = m.Avatar
|
|
x.Gender = m.Gender
|
|
x.Description = m.Description
|
|
return x
|
|
}
|
|
|
|
func (m *UserModel) Create(db *gorm.DB) (err error) {
|
|
return db.Create(m).Error
|
|
}
|
|
|
|
func (m *UserModel) UpdateColumn(db *gorm.DB, column string, value any) (err error) {
|
|
return db.Model(m).UpdateColumn(column, value).Error
|
|
}
|
|
|
|
func (m *UserModel) Save(db *gorm.DB) (err error) {
|
|
return db.Save(m).Error
|
|
}
|
|
|
|
func (m *UserModel) Delete(db *gorm.DB) (err error) {
|
|
return db.Delete(m).Error
|
|
}
|
|
|
|
func (m *UserModel) Find(db *gorm.DB, pk any) (err error) {
|
|
return db.Where("id=?", pk).First(m).Error
|
|
}
|
|
|
|
func (m *UserModel) QueryOne(db *gorm.DB, query any, args ...any) (err error) {
|
|
return db.Where(query, args...).First(m).Error
|
|
}
|
|
|
|
func (m *UserModel) QueryAll(db *gorm.DB, query any, args ...any) (err error) {
|
|
return db.Where(query, args...).Find(m).Error
|
|
}
|
|
|
|
func NewUserModel() *UserModel {
|
|
return &UserModel{}
|
|
}
|
|
|
|
type DepartmentModel struct {
|
|
Id int64 `json:"id" yaml:"id" xml:"id" gorm:"primaryKey;column:id" comment:"ID"`
|
|
CreatedAt int64 `json:"created_at" yaml:"createdAt" xml:"createdAt" gorm:"column:created_at" comment:"创建时间" scenarios:"view;export"`
|
|
UpdatedAt int64 `json:"updated_at" yaml:"updatedAt" xml:"updatedAt" gorm:"index;column:updated_at" comment:"更新时间" scenarios:"view;export"`
|
|
ParentId int64 `json:"parent_id" yaml:"parentId" xml:"parentId" gorm:"column:parent_id" comment:"父级部门" format:"department" live:"type:dropdown;url:/department/level-labels"`
|
|
Name string `json:"name" yaml:"name" xml:"name" gorm:"size:20;column:name" comment:"部门名称" rule:"required"`
|
|
Description string `json:"description" yaml:"description" xml:"description" gorm:"size:1024;column:description" comment:"备注说明" scenarios:"create;update;view;export;list" format:"textarea"`
|
|
}
|
|
|
|
func (m *DepartmentModel) TableName() string {
|
|
return "departments"
|
|
}
|
|
|
|
func (m *DepartmentModel) FromValue(x *Department) {
|
|
m.Id = x.Id
|
|
m.CreatedAt = x.CreatedAt
|
|
m.UpdatedAt = x.UpdatedAt
|
|
m.ParentId = x.ParentId
|
|
m.Name = x.Name
|
|
m.Description = x.Description
|
|
}
|
|
|
|
func (m *DepartmentModel) ToValue() (x *Department) {
|
|
x = &Department{}
|
|
x.Id = m.Id
|
|
x.CreatedAt = m.CreatedAt
|
|
x.UpdatedAt = m.UpdatedAt
|
|
x.ParentId = m.ParentId
|
|
x.Name = m.Name
|
|
x.Description = m.Description
|
|
return x
|
|
}
|
|
|
|
func (m *DepartmentModel) Create(db *gorm.DB) (err error) {
|
|
return db.Create(m).Error
|
|
}
|
|
|
|
func (m *DepartmentModel) UpdateColumn(db *gorm.DB, column string, value any) (err error) {
|
|
return db.Model(m).UpdateColumn(column, value).Error
|
|
}
|
|
|
|
func (m *DepartmentModel) Save(db *gorm.DB) (err error) {
|
|
return db.Save(m).Error
|
|
}
|
|
|
|
func (m *DepartmentModel) Delete(db *gorm.DB) (err error) {
|
|
return db.Delete(m).Error
|
|
}
|
|
|
|
func (m *DepartmentModel) Find(db *gorm.DB, pk any) (err error) {
|
|
return db.Where("id=?", pk).First(m).Error
|
|
}
|
|
|
|
func (m *DepartmentModel) QueryOne(db *gorm.DB, query any, args ...any) (err error) {
|
|
return db.Where(query, args...).First(m).Error
|
|
}
|
|
|
|
func (m *DepartmentModel) QueryAll(db *gorm.DB, query any, args ...any) (err error) {
|
|
return db.Where(query, args...).Find(m).Error
|
|
}
|
|
|
|
func NewDepartmentModel() *DepartmentModel {
|
|
return &DepartmentModel{}
|
|
}
|
|
|
|
type LoginModel struct {
|
|
Id int64 `json:"id" yaml:"id" xml:"id" gorm:"primaryKey;column:id" comment:"ID"`
|
|
CreatedAt int64 `json:"created_at" yaml:"createdAt" xml:"createdAt" gorm:"column:created_at" comment:"登录时间" scenarios:"list;search;view;export"`
|
|
Uid string `json:"uid" yaml:"uid" xml:"uid" gorm:"index;size:20;column:uid" comment:"用户" format:"user" props:"readonly:update" rule:"required"`
|
|
Ip string `json:"ip" yaml:"ip" xml:"ip" gorm:"size:128;column:ip" comment:"登录地址" scenarios:"list;search;view;export"`
|
|
Browser string `json:"browser" yaml:"browser" xml:"browser" gorm:"size:128;column:browser" comment:"浏览器" scenarios:"list;view;export"`
|
|
Os string `json:"os" yaml:"os" xml:"os" gorm:"size:128;column:os" comment:"操作系统" scenarios:"list;view;export"`
|
|
Platform string `json:"platform" yaml:"platform" xml:"platform" gorm:"size:128;column:platform" comment:"系统平台" scenarios:"list;view;export"`
|
|
AccessToken string `json:"access_token" yaml:"accessToken" xml:"accessToken" gorm:"size:1024;column:access_token" comment:"访问令牌" scenarios:"list;view;export"`
|
|
UserAgent string `json:"user_agent" yaml:"userAgent" xml:"userAgent" gorm:"size:1024;column:user_agent" comment:"用户代理" scenarios:"list;view;export"`
|
|
}
|
|
|
|
func (m *LoginModel) TableName() string {
|
|
return "logins"
|
|
}
|
|
|
|
func (m *LoginModel) FromValue(x *Login) {
|
|
m.Id = x.Id
|
|
m.CreatedAt = x.CreatedAt
|
|
m.Uid = x.Uid
|
|
m.Ip = x.Ip
|
|
m.Browser = x.Browser
|
|
m.Os = x.Os
|
|
m.Platform = x.Platform
|
|
m.AccessToken = x.AccessToken
|
|
m.UserAgent = x.UserAgent
|
|
}
|
|
|
|
func (m *LoginModel) ToValue() (x *Login) {
|
|
x = &Login{}
|
|
x.Id = m.Id
|
|
x.CreatedAt = m.CreatedAt
|
|
x.Uid = m.Uid
|
|
x.Ip = m.Ip
|
|
x.Browser = m.Browser
|
|
x.Os = m.Os
|
|
x.Platform = m.Platform
|
|
x.AccessToken = m.AccessToken
|
|
x.UserAgent = m.UserAgent
|
|
return x
|
|
}
|
|
|
|
func (m *LoginModel) Create(db *gorm.DB) (err error) {
|
|
return db.Create(m).Error
|
|
}
|
|
|
|
func (m *LoginModel) UpdateColumn(db *gorm.DB, column string, value any) (err error) {
|
|
return db.Model(m).UpdateColumn(column, value).Error
|
|
}
|
|
|
|
func (m *LoginModel) Save(db *gorm.DB) (err error) {
|
|
return db.Save(m).Error
|
|
}
|
|
|
|
func (m *LoginModel) Delete(db *gorm.DB) (err error) {
|
|
return db.Delete(m).Error
|
|
}
|
|
|
|
func (m *LoginModel) Find(db *gorm.DB, pk any) (err error) {
|
|
return db.Where("id=?", pk).First(m).Error
|
|
}
|
|
|
|
func (m *LoginModel) QueryOne(db *gorm.DB, query any, args ...any) (err error) {
|
|
return db.Where(query, args...).First(m).Error
|
|
}
|
|
|
|
func (m *LoginModel) QueryAll(db *gorm.DB, query any, args ...any) (err error) {
|
|
return db.Where(query, args...).Find(m).Error
|
|
}
|
|
|
|
func NewLoginModel() *LoginModel {
|
|
return &LoginModel{}
|
|
}
|