mirror of
https://gitee.com/dromara/mayfly-go
synced 2026-03-02 16:15:37 +08:00
feat: v1.7.1新增支持sqlite&oracle分页限制等问题修复
This commit is contained in:
@@ -3,6 +3,7 @@ package entity
|
||||
import (
|
||||
"errors"
|
||||
"mayfly-go/internal/common/utils"
|
||||
"mayfly-go/pkg/enumx"
|
||||
"mayfly-go/pkg/model"
|
||||
"time"
|
||||
)
|
||||
@@ -10,13 +11,13 @@ import (
|
||||
type Account struct {
|
||||
model.Model
|
||||
|
||||
Name string `json:"name"`
|
||||
Username string `json:"username"`
|
||||
Password string `json:"-"`
|
||||
Status int8 `json:"status"`
|
||||
LastLoginTime *time.Time `json:"lastLoginTime"`
|
||||
LastLoginIp string `json:"lastLoginIp"`
|
||||
OtpSecret string `json:"-"`
|
||||
Name string `json:"name"`
|
||||
Username string `json:"username"`
|
||||
Password string `json:"-"`
|
||||
Status AccountStatus `json:"status"`
|
||||
LastLoginTime *time.Time `json:"lastLoginTime"`
|
||||
LastLoginIp string `json:"lastLoginIp"`
|
||||
OtpSecret string `json:"-"`
|
||||
}
|
||||
|
||||
func (a *Account) TableName() string {
|
||||
@@ -25,7 +26,7 @@ func (a *Account) TableName() string {
|
||||
|
||||
// 是否可用
|
||||
func (a *Account) IsEnable() bool {
|
||||
return a.Status == AccountEnableStatus
|
||||
return a.Status == AccountEnable
|
||||
}
|
||||
|
||||
func (a *Account) OtpSecretEncrypt() error {
|
||||
@@ -49,7 +50,13 @@ func (a *Account) OtpSecretDecrypt() error {
|
||||
return nil
|
||||
}
|
||||
|
||||
type AccountStatus int8
|
||||
|
||||
const (
|
||||
AccountEnableStatus int8 = 1 // 启用状态
|
||||
AccountDisableStatus int8 = -1 // 禁用状态
|
||||
AccountEnable AccountStatus = 1 // 启用状态
|
||||
AccountDisable AccountStatus = -1 // 禁用状态
|
||||
)
|
||||
|
||||
var AccountStatusEnum = enumx.NewEnum[AccountStatus]("账号状态").
|
||||
Add(AccountEnable, "启用").
|
||||
Add(AccountDisable, "禁用")
|
||||
|
||||
Reference in New Issue
Block a user