feat:完善项目信息
This commit is contained in:
@ -54,6 +54,7 @@ func (this *Instance) Handle() {
|
||||
&synchronized{iModel: model.NewSysUserRole()}, &synchronized{iModel: model.NewSysUserTenant()},
|
||||
&synchronized{iModel: model.NewSysDepartment()},
|
||||
&synchronized{iModel: model.NewSysRole()}, &synchronized{iModel: model.NewSysRoleMenu()}, &synchronized{iModel: model.NewSysRoleAuth()},
|
||||
&synchronized{iModel: model.NewSysUserDepartment()},
|
||||
// 配置管理
|
||||
&synchronized{iModel: model.NewSysConfig(), iValues: func() interface{} {
|
||||
return nil
|
||||
@ -142,10 +143,10 @@ func (this *Instance) Handle() {
|
||||
&synchronized{iModel: model.NewActivityInstance()}, &synchronized{iModel: model.NewActivityApply()},
|
||||
&synchronized{iModel: model.NewActivityExamine()}, &synchronized{iModel: model.NewActivityJoin()},
|
||||
)
|
||||
fmt.Println("=== 数据迁移 ===")
|
||||
fmt.Println("=== 数据开始迁移 ===")
|
||||
fmt.Printf("=== 成功【%d】 ===\n", successCount)
|
||||
fmt.Printf("=== 失败【%d】 ===\n", failureCount)
|
||||
fmt.Println("========================")
|
||||
fmt.Println("=== 数据完成迁移 ===")
|
||||
}
|
||||
|
||||
func WithGormDBOption(db *gorm.DB) Option {
|
||||
|
@ -21,7 +21,7 @@ type IModel interface {
|
||||
|
||||
// Model
|
||||
type Model struct {
|
||||
ID uint64 `gorm:"column:id;primaryKey;autoIncrement;comment:主键" json:"-" form:"id"`
|
||||
ID uint64 `gorm:"column:id;primaryKey;autoIncrement;comment:主键" json:"-"`
|
||||
|
||||
Database string `json:"-" gorm:"-"`
|
||||
}
|
||||
@ -74,6 +74,9 @@ func (m *Model) GetID() uint64 {
|
||||
}
|
||||
|
||||
func (m *Model) GetEncodeID() string {
|
||||
if m.ID <= 0 {
|
||||
return ""
|
||||
}
|
||||
return utils.HASHIDEncode(int(m.ID))
|
||||
}
|
||||
|
||||
|
@ -3,11 +3,12 @@ package model
|
||||
type SysDepartment struct {
|
||||
Model
|
||||
ModelTenant
|
||||
ParentID uint64 `gorm:"column:parent_id;type:int;default:0;comment:父级ID" json:"parent_id"`
|
||||
Title string `gorm:"column:title;type:varchar(20);default:'';comment:部门名称" json:"title"`
|
||||
Name string `gorm:"column:name;type:varchar(20);default:'';comment:联系人" json:"name"`
|
||||
Mobile string `gorm:"column:mobile;type:varchar(15);default:'';comment:联系方式" json:"mobile"`
|
||||
Remark string `gorm:"column:remark;type:varchar(255);default:'';comment:备注信息" json:"remark"`
|
||||
ParentID uint64 `gorm:"column:parent_id;type:int;default:0;comment:父级ID" json:"-"`
|
||||
Name string `gorm:"column:name;type:varchar(20);default:'';comment:部门名称" json:"name"`
|
||||
Contact string `gorm:"column:contact_name;type:varchar(20);default:'';comment:联系人" json:"contact_name"`
|
||||
ContactMobile string `gorm:"column:contact_mobile;type:varchar(15);default:'';comment:联系方式" json:"contact_mobile"`
|
||||
Status int `gorm:"column:status;type:tinyint(1);default:0;comment:状态(1:正常,2:禁用)" json:"status"`
|
||||
Remark string `gorm:"column:remark;type:varchar(255);default:'';comment:备注信息" json:"remark"`
|
||||
ModelDeleted
|
||||
ModelAt
|
||||
}
|
||||
|
@ -3,7 +3,7 @@ package model
|
||||
type SysMenu struct {
|
||||
Model
|
||||
SysMenuBasic
|
||||
Auth SysMenuAuth `gorm:"column:auth;type:tinyint(1);default:0;comment:查看权限(0:通用,1:超管)" json:"auth"`
|
||||
Auth SysMenuAuth `gorm:"column:auth;type:tinyint(1);default:0;comment:查看权限(0:通用,1:超管)" json:"-"`
|
||||
Sort int `gorm:"column:sort;type:tinyint(3);default:0;comment:排序,数值越大,优先排序" json:"sort"`
|
||||
Remark string `gorm:"column:remark;type:varchar(255);default:'';comment:菜单备注" json:"remark"`
|
||||
Status SysMenuStatus `gorm:"column:status;type:tinyint(1);default:1;comment:状态" json:"status"`
|
||||
@ -12,12 +12,14 @@ type SysMenu struct {
|
||||
}
|
||||
|
||||
type SysMenuBasic struct {
|
||||
ParentID uint64 `gorm:"column:parent_id;type:int;default:0;comment:父级ID" json:"parent_id"`
|
||||
Name string `gorm:"column:name;type:varchar(30);default:'';comment:菜单名" json:"name"`
|
||||
Kind SysMenuKind `gorm:"column:kind;type:tinyint(1);default:1;comment:类型(1:目录,2:菜单)" json:"kind"`
|
||||
Link string `gorm:"column:link;type:varchar(80);default:'';comment:菜单链接" json:"link"`
|
||||
Component string `gorm:"column:component;type:varchar(80);default:'';comment:组件标识" json:"component"`
|
||||
Icon string `gorm:"column:icon;type:varchar(50);default:'';comment:菜单图标" json:"icon"`
|
||||
ParentID uint64 `gorm:"column:parent_id;type:int;default:0;comment:父级ID" json:"-"`
|
||||
Name string `gorm:"column:name;type:varchar(30);default:'';comment:菜单名" json:"name"`
|
||||
Kind SysMenuKind `gorm:"column:kind;type:tinyint(1);default:1;comment:类型(1:目录,2:菜单,3:事件)" json:"kind"`
|
||||
Link string `gorm:"column:link;type:varchar(80);default:'';comment:菜单链接" json:"-"`
|
||||
Component string `gorm:"column:component;type:varchar(80);default:'';comment:组件标识" json:"component"`
|
||||
Icon string `gorm:"column:icon;type:varchar(50);default:'';comment:菜单图标" json:"icon"`
|
||||
IsCache SysMenuCacheStatus `gorm:"column:is_cache;type:tinyint(1);default:0;comment:缓存(0:不缓存,1:缓存)" json:"is_cache"`
|
||||
IsHidden SysMenuHiddenStatus `gorm:"column:is_hidden;type:tinyint(1);default:0;comment:隐藏(0:不隐藏,1:隐藏)" json:"-"`
|
||||
}
|
||||
|
||||
// SysMenuKind 菜单类型
|
||||
@ -28,6 +30,8 @@ const (
|
||||
SysMenuKindForCatalogue SysMenuKind = iota + 1
|
||||
// SysMenuKindForMenu 菜单
|
||||
SysMenuKindForMenu
|
||||
// SysMenuKindForEvent 事件
|
||||
SysMenuKindForEvent
|
||||
)
|
||||
|
||||
// SysMenuAuth 菜单权限
|
||||
@ -50,6 +54,20 @@ const (
|
||||
SysMenuStatusForDisable
|
||||
)
|
||||
|
||||
type SysMenuHiddenStatus int
|
||||
|
||||
const (
|
||||
SysMenuHiddenStatusForNot SysMenuHiddenStatus = iota
|
||||
SysMenuHiddenStatusForYes
|
||||
)
|
||||
|
||||
type SysMenuCacheStatus int
|
||||
|
||||
const (
|
||||
SysMenuCacheStatusForNot SysMenuCacheStatus = iota
|
||||
SysMenuCacheStatusForYes
|
||||
)
|
||||
|
||||
func (m *SysMenu) TableName() string {
|
||||
return "sys_menu"
|
||||
}
|
||||
|
18
app/common/model/sys_user_department.go
Normal file
18
app/common/model/sys_user_department.go
Normal file
@ -0,0 +1,18 @@
|
||||
package model
|
||||
|
||||
// SysUserDepartment 用户部门信息数据模型
|
||||
type SysUserDepartment struct {
|
||||
Model
|
||||
UID uint64 `gorm:"column:uid;type:int;default:0;comment:用户uuid" json:"-"`
|
||||
DepartmentID uint64 `gorm:"column:department_id;type:int;default:0;comment:部门ID" json:"-"`
|
||||
ModelDeleted
|
||||
ModelAt
|
||||
}
|
||||
|
||||
func (m *SysUserDepartment) TableName() string {
|
||||
return "sys_user_department"
|
||||
}
|
||||
|
||||
func NewSysUserDepartment() *SysUserDepartment {
|
||||
return &SysUserDepartment{}
|
||||
}
|
@ -2,7 +2,6 @@ package model
|
||||
|
||||
type SysUserRole struct {
|
||||
Model
|
||||
ModelTenant
|
||||
UID uint64 `gorm:"column:uid;type:int;default:0;comment:用户uuid" json:"-"`
|
||||
RoleID uint64 `gorm:"column:role_id;type:int;default:0;comment:角色ID" json:"-"`
|
||||
ModelDeleted
|
||||
|
Reference in New Issue
Block a user