package service import ( "xps/cmd/datasource" "xps/pkg/app/datamodel" "xps/pkg/app/repository" "xps/pkg/app/viewmodel" "xps/pkg/common" ) type AppService interface { GetList(m map[string]interface{}) ([]viewmodel.AppInfo, error) GetPage(m map[string]interface{}) (*common.PageResult, error) GetById(appId int64) (*viewmodel.AppInfo, error) Create(d *datamodel.App) error Update(d *datamodel.App) error Delete(m map[string]interface{}) error } type appService struct { appRepo *repository.AppRepo appPermitRepo *repository.AppPermitRepo } func NewAppService() AppService { return &appService{ appRepo: repository.NewAppRepo(datasource.InstanceMaster()), } } func (s *appService) GetList(m map[string]interface{}) ([]viewmodel.AppInfo, error) { return s.appRepo.GetList(m) } func (s *appService) GetPage(m map[string]interface{}) (*common.PageResult, error) { return s.appRepo.GetPage(m) } func (s *appService) GetById(appId int64) (*viewmodel.AppInfo, error) { return s.appRepo.GetById(appId) } func (s *appService) Create(App *datamodel.App) error { App.AppId = NewID() return s.appRepo.Create(App) } func (s *appService) Update(App *datamodel.App) error { return s.appRepo.Update(App) } func (s *appService) Delete(m map[string]interface{}) error { return s.appRepo.Delete(m) }