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());    

}

相關文章
相關標籤/搜索