| | |
| | | ")"; |
| | | |
| | | 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(); |
| | |
| | | param.put("desc", ""); |
| | | param.put("id", ""); |
| | | param.put("name", ""); |
| | | param.put("shareColumn", ""); |
| | | param.put("shareColumn", "community_id"); |
| | | param.put("shareName", ""); |
| | | param.put("shareParam", ""); |
| | | param.put("shareParam", "communityId"); |
| | | param.put("tableName", tableName); |
| | | JSONObject paramColumn = new JSONObject(); |
| | | JSONArray requireds = new JSONArray(); |
| | |
| | | if ("KEY".equals(key)) { |
| | | continue; |
| | | } |
| | | if ("b_id".equals(key)) { |
| | | continue; |
| | | } |
| | | if ("create_time".equals(key)) { |
| | | continue; |
| | | } |
| | | 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); |
| | | } |