mirror of
https://gitee.com/dromara/mayfly-go
synced 2025-11-04 00:10:25 +08:00
refactor: 后端包结构重构、去除无用的文件
This commit is contained in:
30
server/internal/sys/domain/entity/account.go
Normal file
30
server/internal/sys/domain/entity/account.go
Normal file
@@ -0,0 +1,30 @@
|
||||
package entity
|
||||
|
||||
import (
|
||||
"mayfly-go/pkg/model"
|
||||
"time"
|
||||
)
|
||||
|
||||
type Account struct {
|
||||
model.Model
|
||||
|
||||
Username string `json:"username"`
|
||||
Password string `json:"-"`
|
||||
Status int8 `json:"status"`
|
||||
LastLoginTime *time.Time `json:"lastLoginTime"`
|
||||
LastLoginIp string `json:"lastLoginIp"`
|
||||
}
|
||||
|
||||
func (a *Account) TableName() string {
|
||||
return "t_sys_account"
|
||||
}
|
||||
|
||||
// 是否可用
|
||||
func (a *Account) IsEnable() bool {
|
||||
return a.Status == AccountEnableStatus
|
||||
}
|
||||
|
||||
const (
|
||||
AccountEnableStatus int8 = 1 // 启用状态
|
||||
AccountDisableStatus int8 = -1 // 禁用状态
|
||||
)
|
||||
20
server/internal/sys/domain/entity/msg.go
Normal file
20
server/internal/sys/domain/entity/msg.go
Normal file
@@ -0,0 +1,20 @@
|
||||
package entity
|
||||
|
||||
import (
|
||||
"time"
|
||||
)
|
||||
|
||||
type Msg struct {
|
||||
Id uint64 `json:"id"`
|
||||
CreateTime *time.Time `json:"createTime"`
|
||||
CreatorId uint64 `json:"creatorId"`
|
||||
Creator string `json:"creator"`
|
||||
|
||||
Type int `json:"type"`
|
||||
Msg string `json:"msg"`
|
||||
RecipientId int64 `json:"recipientId"` // 接受者id
|
||||
}
|
||||
|
||||
func (a *Msg) TableName() string {
|
||||
return "t_sys_msg"
|
||||
}
|
||||
27
server/internal/sys/domain/entity/resource.go
Normal file
27
server/internal/sys/domain/entity/resource.go
Normal file
@@ -0,0 +1,27 @@
|
||||
package entity
|
||||
|
||||
import "mayfly-go/pkg/model"
|
||||
|
||||
type Resource struct {
|
||||
model.Model
|
||||
Pid int `json:"pid"`
|
||||
Type int8 `json:"type"` // 1:菜单路由;2:资源(按钮等)
|
||||
Status int8 `json:"status"` // 1:可用;-1:不可用
|
||||
Code string `json:"code"`
|
||||
Name string `json:"name"`
|
||||
Weight int `json:"weight"`
|
||||
Meta string `json:"meta"`
|
||||
}
|
||||
|
||||
func (a *Resource) TableName() string {
|
||||
return "t_sys_resource"
|
||||
}
|
||||
|
||||
const (
|
||||
ResourceStatusEnable int8 = 1 // 启用状态
|
||||
ResourceStatusDisable int8 = -1 // 禁用状态
|
||||
|
||||
// 资源状态
|
||||
ResourceTypeMenu int8 = 1
|
||||
ResourceTypePermission int8 = 2
|
||||
)
|
||||
52
server/internal/sys/domain/entity/role.go
Normal file
52
server/internal/sys/domain/entity/role.go
Normal file
@@ -0,0 +1,52 @@
|
||||
package entity
|
||||
|
||||
import (
|
||||
"mayfly-go/pkg/model"
|
||||
"time"
|
||||
)
|
||||
|
||||
const (
|
||||
RoleTypeCommon int = 1 // 公共角色类型
|
||||
RoleTypeSpecial int = 2 // 特殊角色类型
|
||||
)
|
||||
|
||||
type Role struct {
|
||||
model.Model
|
||||
Status int `json:"status"` // 1:可用;-1:不可用
|
||||
Name string `json:"name"`
|
||||
Remark string `json:"remark"`
|
||||
Code string `json:"code"`
|
||||
Type int `json:"type"`
|
||||
}
|
||||
|
||||
func (a *Role) TableName() string {
|
||||
return "t_sys_role"
|
||||
}
|
||||
|
||||
// 角色资源
|
||||
type RoleResource struct {
|
||||
Id uint64 `json:"id"`
|
||||
RoleId uint64 `json:"roleId"`
|
||||
ResourceId uint64 `json:"resourceId"`
|
||||
CreateTime *time.Time `json:"createTime"`
|
||||
CreatorId uint64 `json:"creatorId"`
|
||||
Creator string `json:"creator"`
|
||||
}
|
||||
|
||||
func (a *RoleResource) TableName() string {
|
||||
return "t_sys_role_resource"
|
||||
}
|
||||
|
||||
// 账号角色
|
||||
type AccountRole struct {
|
||||
Id uint64 `json:"id"`
|
||||
AccountId uint64 `json:"accountId"`
|
||||
RoleId uint64 `json:"roleId"`
|
||||
CreateTime *time.Time `json:"createTime"`
|
||||
CreatorId uint64 `json:"creatorId"`
|
||||
Creator string `json:"creator"`
|
||||
}
|
||||
|
||||
func (a *AccountRole) TableName() string {
|
||||
return "t_sys_account_role"
|
||||
}
|
||||
Reference in New Issue
Block a user