v2_10
This commit is contained in:
45
internal/erpserver/biz/v1/customer/customer.go
Normal file
45
internal/erpserver/biz/v1/customer/customer.go
Normal file
@@ -0,0 +1,45 @@
|
||||
package customer
|
||||
|
||||
import (
|
||||
"context"
|
||||
|
||||
db "management/internal/db/sqlc"
|
||||
"management/internal/pkg/redis"
|
||||
)
|
||||
|
||||
type CustomerBiz interface {
|
||||
Create(ctx context.Context, arg *db.CreateCustomerParams) (*db.Customer, error)
|
||||
Update(ctx context.Context, arg *db.UpdateCustomerParams) (*db.Customer, error)
|
||||
List(ctx context.Context, arg *db.ListCustomerConditionParam) ([]*db.CustomerView, int64, error)
|
||||
Get(ctx context.Context, id int64) (*db.Customer, error)
|
||||
}
|
||||
|
||||
type customerBiz struct {
|
||||
store db.Store
|
||||
redis redis.IRedis
|
||||
}
|
||||
|
||||
var _ CustomerBiz = (*customerBiz)(nil)
|
||||
|
||||
func New(store db.Store, redis redis.IRedis) *customerBiz {
|
||||
return &customerBiz{
|
||||
store: store,
|
||||
redis: redis,
|
||||
}
|
||||
}
|
||||
|
||||
func (b *customerBiz) Create(ctx context.Context, arg *db.CreateCustomerParams) (*db.Customer, error) {
|
||||
return b.store.CreateCustomer(ctx, arg)
|
||||
}
|
||||
|
||||
func (b *customerBiz) Update(ctx context.Context, arg *db.UpdateCustomerParams) (*db.Customer, error) {
|
||||
return b.store.UpdateCustomer(ctx, arg)
|
||||
}
|
||||
|
||||
func (b *customerBiz) List(ctx context.Context, arg *db.ListCustomerConditionParam) ([]*db.CustomerView, int64, error) {
|
||||
return b.store.ListCustomerCondition(ctx, arg)
|
||||
}
|
||||
|
||||
func (b *customerBiz) Get(ctx context.Context, id int64) (*db.Customer, error) {
|
||||
return b.store.GetCustomer(ctx, id)
|
||||
}
|
||||
Reference in New Issue
Block a user