代码如下:
override fun getSubPath(tableName: String, cloName: String, value: String): String {
val v = Strings.sNull(value)
val sql = Sqls.create("select $cloName from $tableName where $cloName like '$v" + "____' order by $cloName desc")
sql.setCallback(SqlCallback { _, rs, _ -> {
var rsvalue:String = v + "0001"
if (rs!=null && rs.next()) {
rsvalue = rs.getString(1)
val newvalue = NumberUtils.toInt(rsvalue.substring(rsvalue.length-4)) + 1
rsvalue = rsvalue.substring(0, rsvalue.length-4) + DecimalFormat("0000").format(newvalue)
}
rsvalue
} })
dao().execute(sql)
println(sql.string.toString())
return sql.string
}