| | |
| | | public class TableToJsonWeb { |
| | | |
| | | //show create table c_orders 用这个语句获取 |
| | | public static final String createTableSql = "CREATE TABLE `machine_type` (\n" + |
| | | " `type_id` varchar(30) NOT NULL COMMENT '设备类型ID',\n" + |
| | | " `machine_type_cd` varchar(30) NOT NULL COMMENT '设备大类 详情看t_dict',\n" + |
| | | " `machine_type_name` varchar(30) NOT NULL COMMENT '设备类型名称',\n" + |
| | | " `create_time` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',\n" + |
| | | " `status_cd` varchar(2) NOT NULL DEFAULT '0' COMMENT '数据状态,详细参考c_status表,S 保存,0, 在用 1失效',\n" + |
| | | " KEY `idx_bm_machine_id` (`type_id`) USING BTREE\n" + |
| | | public static final String createTableSql = "CREATE TABLE business_images(\n" + |
| | | " `id` varchar(64) PRIMARY KEY NOT NULL comment '编号',\n" + |
| | | " `name` varchar(64) NOT NULL comment '镜像名称',\n" + |
| | | " images_type varchar(12) not null comment '镜像类型',\n" + |
| | | " type_url varchar(512) not null comment '镜像url',\n" + |
| | | " images_flag varchar(12) not null comment '镜像标识'\n" + |
| | | ")"; |
| | | |
| | | public static void main(String[] args) { |
| | | String templateName = "设备类型"; //业务名称 |
| | | String templateCode = "machineType"; //表名大写 |
| | | String templateKey = "typeId"; //表主键 |
| | | String templateKeyName = "设备类型ID";//主键说明 |
| | | String searchCode = "typeId"; //分片字段 |
| | | String searchName = "设备类型ID"; //分片字段说明 |
| | | String directories = "property"; //前端生成到那个目录下 |
| | | |
| | | String templateName = "镜像"; //业务名称 |
| | | String templateCode = "businessImages"; //表名大写 |
| | | String templateKey = "id"; //表主键 |
| | | String templateKeyName = "编号";//主键说明 |
| | | String searchCode = "id"; //分片字段 |
| | | String searchName = "编号"; //分片字段说明 |
| | | String directories = "admin"; //前端生成到那个目录下 |
| | | // templateName 业务名称 业务编码名称生成后文件名 templateCode 主键 templateKey |
| | | // 业务主键名称 templateKeyName=templateName+ID 主机驼峰 searchCode 主键名称 searchName |
| | | // directories 放在前端那个目录下 |
| | |
| | | if ("create_time".equals(key)) { |
| | | continue; |
| | | } |
| | | if ("status_cd".equals(key)) { |
| | | continue; |
| | | } |
| | | String comment = rowSql.contains("COMMENT") ? rowSql.substring(rowSql.indexOf("COMMENT '") + 9) : StringUtil.lineToHump(key); |
| | | comment = comment.trim(); |
| | | if (comment.contains(",")) { |