输出表格形式的字段文档

MYSQL查询表结构的SQL

select column_name, 
CASE data_type
    WHEN 'varchar' THEN
        'String'
    WHEN 'datetime' THEN
        'Date'
    WHEN 'decimal' THEN
        'BigDecimal'
    ELSE
        'BigDecimal'
END data_type
,
IF(is_nullable='NO','是','否'),  
column_comment 
from columns where table_name ='uc_department';
image.png

把a_b转为aB规则

public void test1() {
        String s = "需要转换的字符串";
        byte[] bytes = s.getBytes(StandardCharsets.UTF_8);
        for (int i = 0; i < bytes.length; i++) {
            //把字段转为驼峰规则
            if (bytes[i] == "\n".getBytes(StandardCharsets.UTF_8)[0]) {
                bytes[i+1] = new String(new byte[]{bytes[i+1]}).toUpperCase(Locale.ROOT).getBytes(StandardCharsets.UTF_8)[0];
            }
        }
        String s1 = new String(bytes).replaceAll("_", "");
        System.out.println(s1);
    }

你可能感兴趣的:(输出表格形式的字段文档)