package service import ( "xps/datamodel" "xps/datasource" "xps/repositories" "xps/viewmodel" ) type ArtCatService interface { GetList(m map[string]interface{}) ([]viewmodel.ArtCatInfo, error) GetPage(m map[string]interface{}) (*viewmodel.PageResult, error) GetById(ocId, artCatId int64) (*viewmodel.ArtCatInfo, error) Create(d *datamodel.ArtCat) error Update(d *datamodel.ArtCat) error Delete(m map[string]interface{}) error } type artCatService struct { repo *repositories.ArtCatRepo } func NewArtCatService() ArtCatService { return &artCatService{ repo: repositories.NewArtCatRepo(datasource.InstanceMaster()), } } func (s *artCatService) GetList(m map[string]interface{}) ([]viewmodel.ArtCatInfo, error) { return s.repo.GetList(m) } func (s *artCatService) GetPage(m map[string]interface{}) (*viewmodel.PageResult, error) { return s.repo.GetPage(m) } func (s *artCatService) GetById(ocId, artCatId int64) (*viewmodel.ArtCatInfo, error) { return s.repo.GetById(ocId, artCatId) } func (s *artCatService) Create(ArtCat *datamodel.ArtCat) error { ArtCat.ArtCatId = NewID() return s.repo.Create(ArtCat) } func (s *artCatService) Update(ArtCat *datamodel.ArtCat) error { return s.repo.Update(ArtCat) } func (s *artCatService) Delete(m map[string]interface{}) error { return s.repo.Delete(m) }