代码语言:javascript复制
val pageLevelId = 3
val pageLevelName = "entrance"
val funnel = Map(2 -> List(11111), 4 -> List(7), 3 -> List(402, 403), 5 -> List(1572, 1574))
val bg = s"$pageLevelName.page_id = 254" :: s"$pageLevelName.page_value in('%s')".format(funnel(pageLevelId).mkString("','")) :: s"page_level_id = $pageLevelId" :: Nil
println(bg)
val pageValues = 2
val sqlStr = s"""select
|date as date_id,
|site_id,
|terminal_id,
|cate_level1_id,
|from dw.fct_ordr_path_off
|where date = '%s'
|and $pageValues
|group by
|date,
|site_id,
|terminal_id,
|cate_level1_id,
|cate_level2_id,
|cate_level3_id;""".stripMargin
val sql = String.format(sqlStr, "{$date}")
println(sql)