update
This commit is contained in:
@@ -5,22 +5,26 @@ import (
|
||||
"time"
|
||||
|
||||
"management/internal/erpserver/model/dto"
|
||||
|
||||
"gorm.io/datatypes"
|
||||
)
|
||||
|
||||
type ConfigRepository interface {
|
||||
Initialize(ctx context.Context) error
|
||||
Create(ctx context.Context, obj *Config) error
|
||||
Update(ctx context.Context, obj *Config) error
|
||||
Get(ctx context.Context, id int32) (*Config, error)
|
||||
GetByKey(ctx context.Context, key string) (*Config, error)
|
||||
GetValueByKey(ctx context.Context, key string) ([]byte, error)
|
||||
List(ctx context.Context, q dto.SearchDto) ([]*Config, int64, error)
|
||||
}
|
||||
|
||||
type Config struct {
|
||||
ID int32 `json:"id" gorm:"primaryKey;autoIncrement;not null"`
|
||||
Key string `json:"key" gorm:"type:varchar(200);not null;uniqueIndex"`
|
||||
Value string `json:"value" gorm:"type:jsonb;not null;"`
|
||||
CreatedAt time.Time `json:"created_at" gorm:"type:timestamptz;not null;default:'now()'"`
|
||||
UpdatedAt time.Time `json:"updated_at" gorm:"type:timestamptz;not null;default:'0001-01-01 00:00:00+8';"`
|
||||
ID int32 `json:"id" gorm:"primaryKey;autoIncrement;not null"`
|
||||
Key string `json:"key" gorm:"type:varchar(200);not null;uniqueIndex"`
|
||||
Value datatypes.JSON `json:"value" gorm:"type:jsonb;not null;"`
|
||||
CreatedAt time.Time `json:"created_at" gorm:"type:timestamptz;not null;default:'now()'"`
|
||||
UpdatedAt time.Time `json:"updated_at" gorm:"type:timestamptz;not null;default:'0001-01-01 00:00:00+8';"`
|
||||
}
|
||||
|
||||
func (Config) TableName() string {
|
||||
|
||||
@@ -8,6 +8,7 @@ import (
|
||||
)
|
||||
|
||||
type DepartmentRepository interface {
|
||||
Initialize(ctx context.Context) error
|
||||
Create(ctx context.Context, obj *Department) error
|
||||
Update(ctx context.Context, obj *Department) error
|
||||
Get(ctx context.Context, id int32) (*Department, error)
|
||||
|
||||
@@ -9,7 +9,7 @@ import (
|
||||
|
||||
type LoginLogRepository interface {
|
||||
Create(ctx context.Context, obj *LoginLog) error
|
||||
GetLatest(ctx context.Context, email string) (*LoginLog, error)
|
||||
GetLatest(ctx context.Context, email string) ([]*LoginLog, error)
|
||||
List(ctx context.Context, q dto.SearchDto) ([]*LoginLog, int64, error)
|
||||
Count(ctx context.Context, email string) (int64, error)
|
||||
}
|
||||
@@ -27,7 +27,7 @@ type LoginLog struct {
|
||||
Browser string `json:"browser" gorm:"type:varchar(100);not null;"`
|
||||
}
|
||||
|
||||
func (LoginLog) TableName() string {
|
||||
func (*LoginLog) TableName() string {
|
||||
return "sys_user_login_log"
|
||||
}
|
||||
|
||||
|
||||
@@ -6,7 +6,8 @@ import (
|
||||
)
|
||||
|
||||
type MenuRepository interface {
|
||||
Create(ctx context.Context, obj *Menu) error
|
||||
Initialize(ctx context.Context) error
|
||||
Create(ctx context.Context, obj *Menu) (*Menu, error)
|
||||
Update(ctx context.Context, obj *Menu) error
|
||||
Get(ctx context.Context, id int32) (*Menu, error)
|
||||
GetByUrl(ctx context.Context, url string) (*Menu, error)
|
||||
|
||||
@@ -8,6 +8,7 @@ import (
|
||||
)
|
||||
|
||||
type RoleRepository interface {
|
||||
Initialize(ctx context.Context) (*Role, error)
|
||||
Create(ctx context.Context, obj *Role) error
|
||||
Update(ctx context.Context, obj *Role) error
|
||||
Get(ctx context.Context, id int32) (*Role, error)
|
||||
|
||||
@@ -10,6 +10,7 @@ import (
|
||||
)
|
||||
|
||||
type UserRepository interface {
|
||||
Initialize(ctx context.Context, departId, roleId int32) error
|
||||
Create(ctx context.Context, obj *User) error
|
||||
Update(ctx context.Context, obj *User) error
|
||||
Get(ctx context.Context, id int32) (*User, error)
|
||||
|
||||
Reference in New Issue
Block a user