You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Service 可以不注入 Repository,或者只注入与处理当前业务存在数据关联的 Repository。比如,EmailService中或许就只有调用第三方 API 的逻辑,不需要更新维护系统中的数据,就不需要注入 Repository;OrderService中实现了订单出库逻辑后,还需要生成相应的财务结算单据,就需要注入 OrderReposoitory和FinancialDocumentRepository,财务单据中的原单号关联着订单号,存在着数据关联。
Service 中不允许调用其他 Service,保持职责单一,如有需要,应该考虑 Controller 中调用
对于上面提到的service的职责,如果涉及到EmailService中或许就只有调用第三方 API 的逻辑是不是另外弄个logic逻辑层好点呢?这样service只负责简单的业务逻辑,像商城下订单复杂的业务逻辑验证也可以放到logic层。
The text was updated successfully, but these errors were encountered:
Service 岗位职责:
handleListPageDisplay
和handleProfilePageDisplay
,分别对应用户列表展示和用户详情页展示的需求。3.(可选)根据业务需求配置相应的 Criteria 和 Presenter 后(不需要的可以不用配置,或者将通用的配置到 Repository 中)
EmailService
中或许就只有调用第三方 API 的逻辑,不需要更新维护系统中的数据,就不需要注入 Repository;OrderService
中实现了订单出库逻辑后,还需要生成相应的财务结算单据,就需要注入OrderReposoitory
和FinancialDocumentRepository
,财务单据中的原单号关联着订单号,存在着数据关联。对于上面提到的service的职责,如果涉及到
EmailService
中或许就只有调用第三方 API 的逻辑是不是另外弄个logic逻辑层好点呢?这样service只负责简单的业务逻辑,像商城下订单复杂的业务逻辑验证也可以放到logic层。The text was updated successfully, but these errors were encountered: