34 lines
1.1 KiB
Go
34 lines
1.1 KiB
Go
package system
|
|
|
|
import (
|
|
"context"
|
|
"time"
|
|
|
|
"management/internal/erpserver/model/dto"
|
|
)
|
|
|
|
type RoleRepository interface {
|
|
Initialize(ctx context.Context) (*Role, error)
|
|
Create(ctx context.Context, obj *Role) (*Role, error)
|
|
Update(ctx context.Context, obj *Role) error
|
|
Get(ctx context.Context, id int32) (*Role, error)
|
|
GetByVip(ctx context.Context, vip bool) (*Role, error)
|
|
All(ctx context.Context) ([]*Role, error)
|
|
Count(ctx context.Context, filter dto.SearchDto) (int64, error)
|
|
List(ctx context.Context, filter dto.SearchDto) ([]*Role, error)
|
|
RebuildParentPath(ctx context.Context) error
|
|
}
|
|
|
|
type Role struct {
|
|
ID int32 `db:"id" json:"id"`
|
|
Name string `db:"name" json:"name"`
|
|
DisplayName string `db:"display_name" json:"display_name"`
|
|
ParentID int32 `db:"parent_id" json:"parent_id"`
|
|
ParentPath string `db:"parent_path" json:"parent_path"`
|
|
Vip bool `db:"vip" json:"-"`
|
|
Status int32 `db:"status" json:"status"`
|
|
Sort int32 `db:"sort" json:"sort"`
|
|
CreatedAt time.Time `db:"created_at" json:"created_at"`
|
|
UpdatedAt time.Time `db:"updated_at" json:"updated_at"`
|
|
}
|