mirror of
https://gitee.com/dromara/mayfly-go
synced 2025-12-02 14:00:26 +08:00
feat: 机器列表新增运行状态 & refactor: 登录账号信息存储与context
This commit is contained in:
@@ -12,6 +12,15 @@ const (
|
||||
ModelUndeleted int8 = 0
|
||||
)
|
||||
|
||||
// 实体接口
|
||||
type ModelI interface {
|
||||
|
||||
// 使用当前登录账号信息设置实体结构体的基础信息
|
||||
//
|
||||
// 如创建时间,修改时间,创建者,修改者信息
|
||||
SetBaseInfo(account *LoginAccount)
|
||||
}
|
||||
|
||||
// 含有删除字段模型
|
||||
type DeletedModel struct {
|
||||
Id uint64 `json:"id"`
|
||||
@@ -19,6 +28,13 @@ type DeletedModel struct {
|
||||
DeleteTime *time.Time `json:"-"`
|
||||
}
|
||||
|
||||
func (m *DeletedModel) SetBaseInfo(account *LoginAccount) {
|
||||
isCreate := m.Id == 0
|
||||
if isCreate {
|
||||
m.IsDeleted = ModelUndeleted
|
||||
}
|
||||
}
|
||||
|
||||
// 基础实体模型,数据表最基础字段,每张表必备字段
|
||||
type Model struct {
|
||||
DeletedModel
|
||||
|
||||
Reference in New Issue
Block a user