【数据库】Mysql表字段转Java实体(sql语句)
一、Mysql表字段转Java实体(sql语句)
SELECT concat( '\n/**\n', ' * ', v.column_comment, '\n', ' */\n', 'public ', v.dataType, ' ', v.column_name, ';' ) resultData FROM ( SELECT CASE WHEN ( data_type = 'varchar' OR data_type = 'char' OR data_type = 'text' OR data_type = 'blob' ) THEN 'String' WHEN data_type = 'int' THEN 'int' WHEN data_type = 'bigint' THEN 'Long' WHEN data_type = 'double' THEN 'double' END AS dataType, column_name, column_comment FROM information_schema. COLUMNS WHERE table_name = '表名(仅修改这个即可)' ) v
二、备注
如果忍耐算是坚强 我选择抵抗 如果妥协算是努力 我选择争取