package service import ( "xps/datamodel" "xps/datasource" "xps/repositories" "xps/viewmodel" ) type BizRuleService interface { GetList(m map[string]interface{}) ([]viewmodel.BizRuleInfo, error) GetPage(m map[string]interface{}) (*viewmodel.PageResult, error) GetById(ruleId int64) (*viewmodel.BizRuleInfo, error) Create(d *datamodel.BizRule) error Update(d *datamodel.BizRule) error Delete(m map[string]interface{}) error } type bizRuleService struct { repo *repositories.BizRuleRepo } func NewBizRuleService() BizRuleService { return &bizRuleService{ repo: repositories.NewBizRuleRepo(datasource.InstanceMaster()), } } func (s *bizRuleService) GetList(m map[string]interface{}) ([]viewmodel.BizRuleInfo, error) { return s.repo.GetList(m) } func (s *bizRuleService) GetPage(m map[string]interface{}) (*viewmodel.PageResult, error) { return s.repo.GetPage(m) } func (s *bizRuleService) GetById(ruleId int64) (*viewmodel.BizRuleInfo, error) { return s.repo.GetById(ruleId) } func (s *bizRuleService) Create(m *datamodel.BizRule) error { m.RuleId = NewID() return s.repo.Create(m) } func (s *bizRuleService) Update(m *datamodel.BizRule) error { return s.repo.Update(m) } func (s *bizRuleService) Delete(m map[string]interface{}) error { return s.repo.Delete(m) }