select column_id, table_id, column_name, column_comment, column_type, java_type, java_field, is_pk, is_increment, is_required, is_insert, is_edit, is_list, is_query, query_type, html_type, dict_type, sort, create_by, create_time, update_by, update_time from gen_table_column
where table_id = #{tableId} order by sort
select column_name, (case when (is_nullable = 'no' && column_key != 'PRI') then '1' else '0' 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 = (#{tableName}) order by ordinal_position
SELECT c.column_name, (CASE WHEN c.nullable = 'N' AND u.constraint_type != 'P' THEN '1' ELSE '0' END) AS is_required, (CASE WHEN u.constraint_type = 'P' THEN '1' ELSE '0' END) AS is_pk, c.column_id AS sort, cc.comments AS column_comment, (CASE WHEN c.data_default IS NOT NULL AND c.data_default LIKE 'SEQ%' THEN '1' ELSE '0' END) AS is_increment, c.data_type AS column_type FROM user_tab_columns c LEFT JOIN user_col_comments cc ON c.table_name = cc.table_name AND c.column_name = cc.column_name LEFT JOIN user_cons_columns ucc ON c.column_name = ucc.column_name AND c.table_name = ucc.table_name LEFT JOIN user_constraints u ON ucc.constraint_name = u.constraint_name AND u.constraint_type IN ('P', 'U') WHERE c.table_name = UPPER(#{tableName}) ORDER BY c.column_id;
SELECT LOWER(c.column_name) as column_name, (CASE WHEN c.nullable = 'N' AND u.constraint_type != 'P' THEN '1' ELSE '0' END) AS is_required, (CASE WHEN u.constraint_type = 'P' THEN '1' ELSE '0' END) AS is_pk, c.column_id AS sort, cc.comments AS column_comment, (CASE WHEN c.data_default IS NOT NULL AND c.data_default LIKE 'SEQ%' THEN '1' ELSE '0' END) AS is_increment, c.data_type AS column_type FROM user_tab_columns c LEFT JOIN user_col_comments cc ON c.table_name = cc.table_name AND c.column_name = cc.column_name LEFT JOIN user_cons_columns ucc ON c.column_name = ucc.column_name AND c.table_name = ucc.table_name LEFT JOIN user_constraints u ON ucc.constraint_name = u.constraint_name AND u.constraint_type IN ('P', 'U') WHERE c.table_name = UPPER(#{tableName}) ORDER BY c.column_id
insert into gen_table_column ( table_id, column_name, column_comment, column_type, java_type, java_field, is_pk, is_increment, is_required, is_insert, is_edit, is_list, is_query, query_type, html_type, dict_type, sort, create_by, create_time )values( #{tableId}, #{columnName}, #{columnComment}, #{columnType}, #{javaType}, #{javaField}, #{isPk}, #{isIncrement}, #{isRequired}, #{isInsert}, #{isEdit}, #{isList}, #{isQuery}, #{queryType}, #{htmlType}, #{dictType}, #{sort}, #{createBy}, sysdate() )
update gen_table_column column_comment = #{columnComment}, java_type = #{javaType}, java_field = #{javaField}, is_insert = #{isInsert}, is_edit = #{isEdit}, is_list = #{isList}, is_query = #{isQuery}, is_required = #{isRequired}, query_type = #{queryType}, html_type = #{htmlType}, dict_type = #{dictType}, sort = #{sort}, update_by = #{updateBy}, update_time = sysdate() where column_id = #{columnId}
delete from gen_table_column where table_id in #{tableId}
delete from gen_table_column where column_id in #{item.columnId}