数据库转java实体

SELECT
concat( '\n/**\n', ' * ', v.column_comment, '\n', ' */\n', 'private ', 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'
WHEN data_type = 'tinyint' THEN 'Boolean'
WHEN data_type = 'datetime' THEN 'Date'
END AS dataType,
column_name,
column_comment
FROM
information_schema. COLUMNS
WHERE
table_name = 'basicdata_negative_list' ) v

 

posted @ 2023-07-06 11:33  八英里  阅读(5)  评论(0编辑  收藏  举报