From 084b6065da35b8a58d5b4e148018f470fee27a00 Mon Sep 17 00:00:00 2001 From: devzwy Date: Thu, 7 Sep 2023 11:47:48 +0800 Subject: [PATCH] =?UTF-8?q?=E5=A2=9E=E5=8A=A0=E5=A4=9A=E5=80=BC=E4=BC=A0?= =?UTF-8?q?=E5=85=A5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- README.md | 4 +-- build.gradle.kts | 2 +- .../github/devzwy/mdhelper/data/DataType.kt | 5 ++++ .../io/github/devzwy/mdhelper/data/data.kt | 30 +++++++++++++------ 4 files changed, 29 insertions(+), 12 deletions(-) diff --git a/README.md b/README.md index d485f44..2f2d2d1 100644 --- a/README.md +++ b/README.md @@ -21,13 +21,13 @@ io.github.devzwy mdhelper - 2.1.9 + 2.2.0 ``` - Gradle ``` -implementation("io.github.devzwy:mdhelper:2.1.9") +implementation("io.github.devzwy:mdhelper:2.2.0") ``` ## 开始使用 diff --git a/build.gradle.kts b/build.gradle.kts index fa7b046..e8c835c 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -7,7 +7,7 @@ plugins { } group = "io.github.devzwy" -version = "2.1.9" +version = "2.2.0" val sourceJar by tasks.registering(Jar::class) { from(sourceSets["main"].allSource) diff --git a/src/main/kotlin/io/github/devzwy/mdhelper/data/DataType.kt b/src/main/kotlin/io/github/devzwy/mdhelper/data/DataType.kt index 4239507..da2bdb8 100644 --- a/src/main/kotlin/io/github/devzwy/mdhelper/data/DataType.kt +++ b/src/main/kotlin/io/github/devzwy/mdhelper/data/DataType.kt @@ -81,6 +81,11 @@ enum class FilterType(val value: Int) { Lte(16), } +enum class SpliceType(val value: Int){ + AND(1), + OR(2) +} + //返回的错误码 enum class ErrorCode(val value: Int) { //失败 diff --git a/src/main/kotlin/io/github/devzwy/mdhelper/data/data.kt b/src/main/kotlin/io/github/devzwy/mdhelper/data/data.kt index 0e27389..09f2cbe 100644 --- a/src/main/kotlin/io/github/devzwy/mdhelper/data/data.kt +++ b/src/main/kotlin/io/github/devzwy/mdhelper/data/data.kt @@ -82,8 +82,24 @@ data class RowData( val value: Any? ) -class FilterBean private constructor(val controlId: String, val value: Any?, val dataType: Int, val spliceType: Int, val filterType: Int) { - class Builder(private val controlId: String, private val value: Any?) { +class FilterBean private constructor(val controlId: String, val value: Any?, val values: Any?, val dataType: Int, val spliceType: Int, val filterType: Int) { + class Builder( + /** + * 字段名称 + */ + private val controlId: String, + /** + * 单个值 + */ + private val value: Any? = null , + /** + * 多个值 + */ + val values: Any?=null, + /** + * 筛选类型 只能一种 使用 [io.github.devzwy.mdhelper.data.SpliceType]构造取值 + */ + val spliceType: Int) { //字段类型 private var dataType: Int = 0 @@ -91,24 +107,20 @@ class FilterBean private constructor(val controlId: String, val value: Any?, v private var filterType: Int = 0 /** - * 字段的类型 使用[io.github.devzwy.DataType]构造 + * 字段的类型 使用[io.github.devzwy.mdhelper.data.DataType]构造 */ fun typeOf(dateType: Int) = apply { this.dataType = dateType } /** - * 字段的类型 使用[io.github.devzwy.FilterType]构造 + * 字段的类型 使用[io.github.devzwy.mdhelper.data.FilterType]构造 */ fun filterOf(filterType: Int) = apply { this.filterType = filterType } /** * 与下一组条件的关系为AND拼接 */ - fun buildAnd() = FilterBean(controlId, value, dataType, 1, filterType) + fun build() = FilterBean(controlId, value, values,dataType, spliceType, filterType) - /** - * 与下一组条件的关系为OR拼接 - */ - fun buildOr() = FilterBean(controlId, value, dataType, 2, filterType) } }