package storehouse

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

type CommodityService struct{}

func (cs *CommodityService) QueryAllCommodity() ([]dao.Commodity, error) {
	return dao.QueryAllCommodity()
}

func (cs *CommodityService) QueryCommodityList(info request.PageInfo) (list interface{}, total int64, err error) {
	limit := info.PageSize
	offset := info.PageSize * (info.Page - 1)
	return dao.QueryCommodityList(limit, offset)
}

func (cs *CommodityService) CreateCommodity(commodity dao.Commodity) error {
	return commodity.CreateCommodity()
}

func (cs *CommodityService) UpdateCommodity(commodity dao.Commodity) error {
	return commodity.UpdateCommodity()
}

func (cs *CommodityService) DeleteCommodity(commodity dao.Commodity) error {
	return commodity.DeleteCommodity()
}
