Controller 只能呼叫 Service
Service 只能呼叫 Repository
Service ⇒ 所有業務邏輯
Repository ⇒ 所有的 CRUD、和資料庫有關的操作
Controller 只負責接收並整理使用者給的資料 (collect id, data, …)
Service 不負責跟資料庫互動,負責拋接從 controller 來的資料到 Repo.
一個 table 對應一個 Model
一個 Model 對應一個 Repository
一個 Controller 會呼叫多個 Service
一個 Service 會呼叫多個 Repository