Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
  • Loading branch information
darkredz committed Dec 22, 2019
2 parents 18e78c7 + 182fdd3 commit 2cfca8c
Show file tree
Hide file tree
Showing 4 changed files with 17 additions and 6 deletions.
4 changes: 2 additions & 2 deletions examples/zeko-vertx-query/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -127,7 +127,7 @@
<dependency>
<groupId>com.zeko.model</groupId>
<artifactId>data-mapper</artifactId>
<version>1.3</version>
<version>1.4.1</version>
</dependency>
<!--<dependency>-->
<!--<groupId>com.zeko.model</groupId>-->
Expand Down Expand Up @@ -210,7 +210,7 @@
</executions>

<configuration>
<redeploy>true</redeploy>
<redeploy>false</redeploy>
</configuration>
</plugin>

Expand Down
3 changes: 2 additions & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

<groupId>com.zeko.model</groupId>
<artifactId>data-mapper</artifactId>
<version>1.4</version>
<version>1.4.1</version>
<packaging>jar</packaging>

<name>com.zeko.model data-mapper</name>
Expand Down Expand Up @@ -189,6 +189,7 @@
<includes><include>**/*</include></includes>
<repositoryName>Zeko-Data-Mapper</repositoryName> <!-- github repo name -->
<repositoryOwner>darkredz</repositoryOwner> <!-- github username -->
<oauth2Token></oauth2Token>
</configuration>
<executions>
<!-- run site-maven-plugin's 'site' target as part of the build's normal 'deploy' phase -->
Expand Down
5 changes: 5 additions & 0 deletions src/main/kotlin/com.zeko.model/DataMapper.kt
Original file line number Diff line number Diff line change
Expand Up @@ -389,6 +389,11 @@ open class DataMapper {
return toAdd2
}


open fun mapStruct(mapConf: MapperConfig, arr: List<Any>, delimiter: String = "-"): ArrayList<Any> {
return mapStruct(mapConf.toTableInfo(), arr)
}

open fun mapStruct(allTableInfo: LinkedHashMap<String, TableInfo>, arr: List<Any>, delimiter: String = "-"): ArrayList<Any> {
if (arr.size == 0) {
return arrayListOf()
Expand Down
11 changes: 8 additions & 3 deletions src/main/kotlin/com.zeko.model/MapperConfig.kt
Original file line number Diff line number Diff line change
Expand Up @@ -122,13 +122,18 @@ class MapperConfig(defaultPrimaryKey: String, autoRemoveLinkKey: Boolean) {
return this
}


fun moveUnder(fieldName: String): MapperConfig {
val table = this.currentTable()
table.move_under = fieldName
return this
}

fun mapTo(mapClass: Class<*>): MapperConfig {
val table = this.currentTable()
table.mapClass = mapClass
return this
}

fun toArrayMap(): LinkedHashMap<String, TableInfo> {
this.tableInfo = this.sortTableInfo(this.tableInfo)
return this.tableInfo
Expand All @@ -138,7 +143,7 @@ class MapperConfig(defaultPrimaryKey: String, autoRemoveLinkKey: Boolean) {
this.tableInfo = this.sortTableInfo(this.tableInfo)
return this.tableInfo
}

fun sortTableInfo(tables: LinkedHashMap<String, TableInfo>): LinkedHashMap<String, TableInfo> {
val tableList = tables.keys.asIterable()
val firstTable = tableList.first()
Expand Down Expand Up @@ -173,4 +178,4 @@ class MapperConfig(defaultPrimaryKey: String, autoRemoveLinkKey: Boolean) {
}
return tables
}
}
}

0 comments on commit 2cfca8c

Please sign in to comment.