直接进入正题
import play.api.libs.functional.syntax._
import org.json4s.native.Serialization.read
import play.api.libs.functional.syntax.unlift
import play.api.libs.json.{JsPath, Json, Reads, Writes}
/**
* Created by zmm on 2019/1/31
*/
case class FilterData(var id: Option[Int], publisherId: Int, subId: String, minPercentage: Byte, maxPercentage: Byte, var updateTime: Option[Int], status: Byte) {}
object JsonUtil {
implicit val filterDataReads: Reads[FilterData] = (
(JsPath \ "id").readNullable[Int] and
(JsPath \ "publisher_id").read[Int] and
(JsPath \ "sub_id").read[String] and
(JsPath \ "min_percentage").read[Byte] and
(JsPath \ "max_percentage").read[Byte] and
(JsPath \ "update_time").readNullable[Int] and
(JsPath \ "status").read[Byte]
) (FilterData.apply _)
implicit val filterDataWrites: Writes[FilterData] = (
(JsPath \ "id").writeNullab