package admin

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

type ConstructorService struct{}

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

func (cs *ConstructorService) QueryConstructor() ([]dao.Constructor, error) {
	return dao.QueryConstructor()
}

func (cs *ConstructorService) CreateConstructor(constructor dao.Constructor) error {
	return constructor.CreateConstructor()
}

func (cs *ConstructorService) UpdateConstructor(constructor dao.Constructor) error {
	return constructor.UpdateConstructor()
}

func (cs *ConstructorService) DeleteConstructor(constructor dao.Constructor) error {
	return constructor.DeleteConstructor()
}
