package service import ( "xps/cmd/datasource" "xps/pkg/biz/datamodel" "xps/pkg/biz/repository" "xps/pkg/biz/viewmodel" "xps/pkg/common" ) type BizObjectAttrService interface { GetList(m map[string]interface{}) ([]viewmodel.BizObjectAttrInfo, error) GetPage(m map[string]interface{}) (*common.PageResult, error) GetById(bizId, objectId, attrId int64) (*viewmodel.BizObjectAttrInfo, error) GetListById(bizId, objectId int64) ([]viewmodel.BizObjectAttrInfo, error) Create(d *datamodel.BizObjectAttr) error Update(d *datamodel.BizObjectAttr) error Delete(m map[string]interface{}) error } type bizObjectAttrService struct { repo *repository.BizObjectAttrRepo } func NewBizObjectAttrService() BizObjectAttrService { return &bizObjectAttrService{ repo: repository.NewBizObjectAttrRepo(datasource.InstanceMaster()), } } func (s *bizObjectAttrService) GetListById(bizId, objectId int64) ([]viewmodel.BizObjectAttrInfo, error) { return s.repo.GetListById(bizId, objectId) } func (s *bizObjectAttrService) GetList(m map[string]interface{}) ([]viewmodel.BizObjectAttrInfo, error) { return s.repo.GetList(m) } func (s *bizObjectAttrService) GetPage(m map[string]interface{}) (*common.PageResult, error) { return s.repo.GetPage(m) } func (s *bizObjectAttrService) GetById(bizId, objectId, attrId int64) (*viewmodel.BizObjectAttrInfo, error) { return s.repo.GetById(bizId, objectId, attrId) } func (s *bizObjectAttrService) Create(attr *datamodel.BizObjectAttr) error { attrId := NewID(); attr.AttrId = attrId return s.repo.Create(attr) } func (s *bizObjectAttrService) Update(attr *datamodel.BizObjectAttr) error { return s.repo.Update(attr) } func (s *bizObjectAttrService) Delete(m map[string]interface{}) error { return s.repo.Delete(m) }