package service import ( "xps/datamodels" "xps/datasource" "xps/repositories" "xps/viewmodels" ) type BizObjectMappingService interface { GetList(m map[string]interface{}) ([]viewmodels.BizObjectMappingInfo, error) GetPage(m map[string]interface{}) (*viewmodels.PageResult, error) GetById(bizId, objectId, attrId int64) (*viewmodels.BizObjectMappingInfo, error) Create(d *datamodels.BizObjectMapping) error Update(d *datamodels.BizObjectMapping) error Delete(m map[string]interface{}) error } type bizObjectMappingService struct { repo *repositories.BizObjectMappingRepo } func NewBizObjectMappingService() BizObjectMappingService { return &bizObjectMappingService{ repo: repositories.NewBizObjectMappingRepo(datasource.InstanceMaster()), } } func (s *bizObjectMappingService) GetList(m map[string]interface{}) ([]viewmodels.BizObjectMappingInfo, error) { return s.repo.GetList(m) } func (s *bizObjectMappingService) GetPage(m map[string]interface{}) (*viewmodels.PageResult, error) { return s.repo.GetPage(m) } func (s *bizObjectMappingService) GetById(bizId, objectId, attrId int64) (*viewmodels.BizObjectMappingInfo, error) { return s.repo.GetById(bizId, objectId, attrId) } func (s *bizObjectMappingService) Create(attr *datamodels.BizObjectMapping) error { attr.MappingId = NewID() return s.repo.Create(attr) } func (s *bizObjectMappingService) Update(attr *datamodels.BizObjectMapping) error { return s.repo.Update(attr) } func (s *bizObjectMappingService) Delete(m map[string]interface{}) error { return s.repo.Delete(m) }