jfinal 2.0 使用Model遍历表结构(字段列表)

首先要引入以下类
java

import java.util.Map;app

import java.util.Set;spa

import com.jfinal.plugin.activerecord.Table;get

import com.jfinal.plugin.activerecord.TableMapping;table

//而后经过以下代码来得到Mode对应的表结构,其中PtXzqh是一个Modelimport

Table table = TableMapping.me().getTable(PtXzqh.dao.getClass());plugin

String s = table.getColumnTypeMap().toString();im

Map<String, Class<?>> m = table.getColumnTypeMap();tab

for(Map.Entry<String, Class<?>> entry:m.entrySet()){    ping

        System.out.println(entry.getKey()+"--->"+entry.getValue());    

}

相关文章
相关标签/搜索