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