wfy
2021-09-14 cd33651deff9fff7e7d9651b766210771c075190
java110-generator/src/main/java/com/java110/code/TableToJson.java
@@ -34,7 +34,7 @@
            ")";
    public static void main(String[] args) {
        //业务名称 desc 业务编码名称生成后类名 name 主键 id  需要放到那个服务 shareName
        String newSql = createTableSql.substring(createTableSql.indexOf("(") + 1, createTableSql.lastIndexOf(")"));
        String tableName = createTableSql.substring(createTableSql.indexOf("TABLE") + 5, createTableSql.indexOf("("));
        tableName = tableName.replaceAll("`", "").trim();
@@ -73,6 +73,14 @@
            if (rowSql.toLowerCase().contains("not null")) {
                required.put("code", StringUtil.lineToHump(key));
                String comment = rowSql.contains("COMMENT") ? rowSql.substring(rowSql.indexOf("COMMENT '") + 9) : StringUtil.lineToHump(key);
                comment = comment.trim();
                if(comment.contains(",")){
                    comment = comment.split(",")[0];
                }
                if(comment.contains(" ")){
                    comment = comment.split(" ")[0];
                }
                required.put("msg", comment + "不能为空");
                requireds.add(required);
            }