biz_object_mapping_service.go 1.8 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758
  1. package service
  2. import (
  3. "xps/datamodels"
  4. "xps/datasource"
  5. "xps/repositories"
  6. "xps/viewmodels"
  7. )
  8. type BizObjectMappingService interface {
  9. GetList(m map[string]interface{}) ([]viewmodels.BizObjectMappingInfo, error)
  10. GetPage(m map[string]interface{}) (*viewmodels.PageResult, error)
  11. GetById(bizId, objectId, mappingId int64) (*viewmodels.BizObjectMappingInfo, error)
  12. GetListById(bizId, objectId int64) ([]viewmodels.BizObjectMappingInfo, error)
  13. Create(d *datamodels.BizObjectMapping) error
  14. Update(d *datamodels.BizObjectMapping) error
  15. Delete(m map[string]interface{}) error
  16. }
  17. type bizObjectMappingService struct {
  18. repo *repositories.BizObjectMappingRepo
  19. }
  20. func NewBizObjectMappingService() BizObjectMappingService {
  21. return &bizObjectMappingService{
  22. repo: repositories.NewBizObjectMappingRepo(datasource.InstanceMaster()),
  23. }
  24. }
  25. func (s *bizObjectMappingService) GetList(m map[string]interface{}) ([]viewmodels.BizObjectMappingInfo, error) {
  26. return s.repo.GetList(m)
  27. }
  28. func (s *bizObjectMappingService) GetListById(bizId, objectId int64) ([]viewmodels.BizObjectMappingInfo, error) {
  29. return s.repo.GetListById(bizId, objectId)
  30. }
  31. func (s *bizObjectMappingService) GetPage(m map[string]interface{}) (*viewmodels.PageResult, error) {
  32. return s.repo.GetPage(m)
  33. }
  34. func (s *bizObjectMappingService) GetById(bizId, objectId, attrId int64) (*viewmodels.BizObjectMappingInfo, error) {
  35. return s.repo.GetById(bizId, objectId, attrId)
  36. }
  37. func (s *bizObjectMappingService) Create(attr *datamodels.BizObjectMapping) error {
  38. attr.MappingId = NewID()
  39. return s.repo.Create(attr)
  40. }
  41. func (s *bizObjectMappingService) Update(attr *datamodels.BizObjectMapping) error {
  42. return s.repo.Update(attr)
  43. }
  44. func (s *bizObjectMappingService) Delete(m map[string]interface{}) error {
  45. return s.repo.Delete(m)
  46. }