我正在使用scala和slick的playframework。在scala中調用控制器的方法時出現問題
在我的DTO(DAO)我這樣做:
class processDTO @Inject() (protected val dbConfigProvider: DatabaseConfigProvider) extends HasDatabaseConfigProvider[JdbcProfile]
with ProcessTemplatesComponent {
import driver.api._
private val processTemplates = TableQuery[ProcessTemplates]
def getAll(): Future[Seq[ProcessTemplatesModel]] = db.run { processTemplates.to[Seq].result }
}
,並在控制器我這樣做:
@Singleton
class ProcessesController @Inject() (processDTO: processDTO, actionBuilder: ActionBuilders) extends Controller{
def getProcesses() = actionBuilder.DynamicAction(name = "pureLuck").defaultHandler() {
request =>
processDTO.getAll().map(_.map(result => {
}))
.map(result => Ok(Json.toJson(result)))
}
}
複製和粘貼錯誤有什麼問題? – pedrofurla