nbcp.myoql.db.sql.component.JsonMapRowMapper.kt Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of ktmyoql Show documentation
Show all versions of ktmyoql Show documentation
kotlin orm -- mysql,mongo , just like ktorm
The newest version!
package nbcp.myoql.db.sql.component
import nbcp.base.comm.JsonMap
import nbcp.myoql.db.mysql.ExistsSqlSourceConfigCondition
import org.springframework.context.annotation.Conditional
import org.springframework.jdbc.core.RowMapper
import org.springframework.stereotype.Component
import java.sql.ResultSet
/**
* Created by yuxh on 2018/7/2
*/
@Component
@Conditional(ExistsSqlSourceConfigCondition::class)
class JsonMapRowMapper : RowMapper {
override fun mapRow(rs: ResultSet, rowNum: Int): JsonMap {
val ret = JsonMap()
val meta = rs.metaData;
for (i in 1..meta.columnCount) {
ret.set(meta.getColumnLabel(i), rs.getObject(i))
}
return ret
}
}