<commit_before>package com.weez.mercury.product

import com.weez.mercury.common._

import scala.slick.jdbc.SetParameter

object DataService extends RemoteService {
  def availableAssistants: QueryCall = c => {
    import c._
    val items = sql"""SELECT a.id,s.name,a.price,a.description
             FROM biz_assistant a JOIN biz_staffs s ON s.id = a.id
         """.as[ModelObject].list
    completeWith("items" -> items)
  }

  def availableRooms: QueryCall = c => {
    import c._
    val items = sql"SELECT id,title,price,description FROM biz_rooms".as[ModelObject].list
    completeWith("items" -> items)
  }

  def availableDevices: QueryCall = c => {
    import c._
    def getProducts(keywords: String, start: Int, count: Int) = {
      sqlp"""SELECT id,code,title,price,description FROM biz_product_models
           WHERE title LIKE CONCAT('%',$keywords,'%') LIMIT $start,$count""".as[ModelObject]
    }
    completeWith("items" -> getProducts(request.keywords, request.start, request.count).list)
  }
}<commit_msg>changes<commit_after>package com.weez.mercury.product

import com.weez.mercury.common._

object DataService extends RemoteService {
  def availableAssistants: QueryCall = c => {
    import c._
    val items = sql"""SELECT a.id,s.name,a.price,a.description
             FROM biz_assistants a JOIN biz_staffs s ON s.id = a.id
         """.as[ModelObject].list
    completeWith("items" -> items)
  }

  def availableRooms: QueryCall = c => {
    import c._
    val items = sql"SELECT id,title,price,description FROM biz_rooms".as[ModelObject].list
    completeWith("items" -> items)
  }

  def availableDevices: QueryCall = c => {
    import c._
    def getProducts(keywords: String, start: Int, count: Int) = {
      sqlp"""SELECT id,code,title,price,description FROM biz_product_models
           WHERE title LIKE CONCAT('%',?,'%') LIMIT $start,$count""".as[ModelObject]
    }
    completeWith("items" -> getProducts(request.keywords, request.start, request.count).list)
  }
}
{'fraction_non_alphanumeric': 0.12843578210894552, 'fraction_numerical': 0.0, 'mean_word_length': 3.560364464692483, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 15, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '3018655', 'n_tokens_mistral': 648, 'n_tokens_neox': 632, 'n_words': 144}