方式1:List<Record>records=Db.template("core.getDbTableColumnsByName", "sys_user").find(); 方式2:List<GenTableColumn>genTableColumnsList=columndao.find("core.getDbTableColumnsByName","sys_user"); 方法1的SQL: SELECT column_name, ( CASE WHEN ( is_nullable = 'no' && column_key != 'PRI' ) THEN '1' ELSE NULL END ) AS is_required, ( CASE WHEN column_key = 'PRI' THEN '1' ELSE '0' END ) AS is_pk, ordinal_position AS sort, column_comment, ( CASE WHEN extra = 'auto_increment' THEN '1' ELSE '0' END ) AS is_increment, column_type FROM information_schema.columns WHERE table_schema = (SELECT DATABASE()) AND table_name = (#para(0)) 方法2的SQL: SELECT column_name, ( CASE WHEN ( is_nullable = 'no' && column_key != 'PRI' ) THEN '1' ELSE NULL END ) AS is_required, ( CASE WHEN column_key = 'PRI' THEN '1' ELSE '0' END ) AS is_pk, ordinal_position AS sort, column_comment, ( CASE WHEN extra = 'auto_increment' THEN '1' ELSE '0' END ) AS is_increment, column_type FROM information_schema.columns WHERE table_schema = (SELECT DATABASE()) AND table_name = (?) 运行方法1可以获取数据 方法2报错 不明天咋回事
项目:JFinal
而方式二的 columndao.find(...) 的参数是要传入具体的 sql , 而不能传入 sql 的 id