package storehouse

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

type WarehouseService struct{}

func (ws *WarehouseService) QueryAllWarehouse() ([]dao.Warehouse, error) {
	return dao.QueryAllWarehouse()
}

func (ws *WarehouseService) QueryWarehouseList(info request.PageInfo) (list interface{}, total int64, err error) {
	limit := info.PageSize
	offset := info.PageSize * (info.Page - 1)
	warehouse, total, err := dao.QueryWarehouseList(limit, offset)
	return warehouse, total, err
}

func (ws *WarehouseService) CreateWarehouse(warehouse dao.Warehouse) error {
	return warehouse.CreateWarehouse()
}

func (ws *WarehouseService) UpdateWarehouse(warehouse dao.Warehouse) error {
	return warehouse.UpdateWarehouse()
}

func (ws *WarehouseService) DeleteWarehouse(warehouse dao.Warehouse) error {
	return warehouse.DeleteWarehouse()
}
