我的DAL:
def login(username: String,pass :String) =
sql"""SELECT AD1SYS.PKG_STC_LOGIN.USER_LOGIN ('#$username','#$pass')FROM DUAL""".as[String]
def getEmpName(username: String,empName :String) =
sql"""SELECT AD1SYS.PKG_STC_LOGIN.GET_EMPL_NAME ('#$username','#$empName') FROM DUAL""".as[(String)]
我的服务:
def login(username:String,pass:String): Future[Seq[(String)]] = {
db.run(DalLogin.login(username, pass))
}
def getEmpName(username:String,empName:String): Future[Seq[(String)]] = {
db.run(DalLogin.getEmpName(username, empName))
}
我的控制器:
def login = Action.async(BodyParsers.parse.json) { request =>
val username = (request.body \ "username").as[String]
val pass = (request.body \ "pass").as[String]
ServiceLogin.login(username, pass).map { data =>
ServiceLogin.getEmpName(username,data).map(result =>
Ok(Json.toJson(result.map( p =>
ModelKodeCabang(p)
))
))}
}
Service.login的结果是Seq(String)" data",我不能使用Seq(String)参数ServiceLogin.getEmpName(用户名,数据)..如何转换Seq(String)to String ??