package storehouse

import (
	"server/dao"
	"server/model/common/request"
)

type SupplierService struct {
}

func (ss *SupplierService) QueryAllSupplier() ([]dao.Supplier, error) {
	return dao.QueryAllSupplier()
}

func (ss *SupplierService) QuerySupplierList(info request.PageInfo) (list interface{}, total int64, err error) {
	limit := info.PageSize
	offset := info.PageSize * (info.Page - 1)
	suppliers, total, err := dao.QuerySupplierList(limit, offset)
	return suppliers, total, err
}

func (ss *SupplierService) CreateSupplier(supplier dao.Supplier) error {
	return supplier.CreateSupplier()
}

func (ss *SupplierService) UpdateSupplier(supplier dao.Supplier) error {
	return supplier.UpdateSupplier()
}

func (ss *SupplierService) DeleteSupplier(supplier dao.Supplier) error {
	return supplier.DeleteSupplier()
}
