43 lines
1002 B
Go
43 lines
1002 B
Go
package system
|
|
|
|
import (
|
|
"context"
|
|
|
|
"management/internal/db/model/dto"
|
|
db "management/internal/db/sqlc"
|
|
systemmodel "management/internal/erpserver/model/system"
|
|
"management/internal/erpserver/store"
|
|
)
|
|
|
|
type LoginLogBiz interface {
|
|
Create(ctx context.Context, obj *systemmodel.LoginLog) error
|
|
List(ctx context.Context, q dto.SearchDto) ([]*systemmodel.LoginLog, int64, error)
|
|
}
|
|
|
|
type loginLogBiz struct {
|
|
database store.IStore
|
|
store db.Store
|
|
}
|
|
|
|
var _ LoginLogBiz = (*loginLogBiz)(nil)
|
|
|
|
func NewLoginLog(database store.IStore, store db.Store) *loginLogBiz {
|
|
return &loginLogBiz{
|
|
database: database,
|
|
store: store,
|
|
}
|
|
}
|
|
|
|
func (b *loginLogBiz) Create(ctx context.Context, obj *systemmodel.LoginLog) error {
|
|
return b.database.LoginLog().Create(ctx, obj)
|
|
}
|
|
|
|
func (b *loginLogBiz) List(ctx context.Context, q dto.SearchDto) ([]*systemmodel.LoginLog, int64, error) {
|
|
res, count, err := b.database.LoginLog().List(ctx, q)
|
|
if err != nil {
|
|
return nil, 0, err
|
|
}
|
|
|
|
return res, count, nil
|
|
}
|