Skip to content

Commit

Permalink
增加多值传入
Browse files Browse the repository at this point in the history
  • Loading branch information
devzwy committed Sep 7, 2023
1 parent 5bb08b2 commit 084b606
Show file tree
Hide file tree
Showing 4 changed files with 29 additions and 12 deletions.
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,13 +21,13 @@
<dependency>
<groupId>io.github.devzwy</groupId>
<artifactId>mdhelper</artifactId>
<version>2.1.9</version>
<version>2.2.0</version>
</dependency>
```

- Gradle
```
implementation("io.github.devzwy:mdhelper:2.1.9")
implementation("io.github.devzwy:mdhelper:2.2.0")
```

## 开始使用
Expand Down
2 changes: 1 addition & 1 deletion build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
5 changes: 5 additions & 0 deletions src/main/kotlin/io/github/devzwy/mdhelper/data/DataType.kt
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
//失败
Expand Down
30 changes: 21 additions & 9 deletions src/main/kotlin/io/github/devzwy/mdhelper/data/data.kt
Original file line number Diff line number Diff line change
Expand Up @@ -82,33 +82,45 @@ 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

//筛选类型
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)
}
}

Expand Down

0 comments on commit 084b606

Please sign in to comment.