【发布时间】:2016-06-26 07:18:05
【问题描述】:
我的问题可能听起来很平淡,但我仍然没有解决它。
我的 Products Table 实现如下
class ProductsTable(tag: Tag) extends Table[Product](tag, "PRODUCTS") {
def id = column[Int]("PRODUCT_ID", O.PrimaryKey, O.AutoInc)
def title = column[String]("NAME")
def description = column[String]("DESCRIPTION")
def style = column[String]("STYLE")
def price = column[Int]("PRICE")
def category_id = column[Int]("CATEGORY_ID")
def size_id = column[Int]("SIZE_ID")
def brand_id = column[Int]("BRAND_ID")
def * = (id.?, title, description, style, price, category_id, size_id, brand_id) <>(Product.tupled, Product.unapply _)
}
及其在
中的表示val Products = TableQuery[ProductsTable]
如何实现与 SQl 查询等效的查询:
select * from products where( category_id = 1 or category_id = 2 or category_id = 3 ) and (price between min and max)
【问题讨论】: