{"id":18678125,"url":"https://github.com/lovemo/build_java","last_synced_at":"2026-04-17T01:02:13.412Z","repository":{"id":86580332,"uuid":"162372658","full_name":"lovemo/build_java","owner":"lovemo","description":"根据sql创建语句生成java类属性、jersey注解类、mybatis mapper映射、sql列","archived":false,"fork":false,"pushed_at":"2018-12-19T02:53:34.000Z","size":8,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-08-02T09:38:29.263Z","etag":null,"topics":["automatic","java","jersey","mapper","mybatis","php","sql"],"latest_commit_sha":null,"homepage":"","language":"PHP","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/lovemo.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2018-12-19T02:38:11.000Z","updated_at":"2018-12-19T02:53:36.000Z","dependencies_parsed_at":"2023-03-02T21:30:31.100Z","dependency_job_id":null,"html_url":"https://github.com/lovemo/build_java","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/lovemo/build_java","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lovemo%2Fbuild_java","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lovemo%2Fbuild_java/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lovemo%2Fbuild_java/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lovemo%2Fbuild_java/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/lovemo","download_url":"https://codeload.github.com/lovemo/build_java/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lovemo%2Fbuild_java/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":31910585,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-04-16T18:22:33.417Z","status":"ssl_error","status_checked_at":"2026-04-16T18:21:47.142Z","response_time":69,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.6:443 state=error: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["automatic","java","jersey","mapper","mybatis","php","sql"],"created_at":"2024-11-07T09:36:06.463Z","updated_at":"2026-04-17T01:02:13.380Z","avatar_url":"https://github.com/lovemo.png","language":"PHP","funding_links":[],"categories":[],"sub_categories":[],"readme":"# build_java\n根据sql创建语句生成java类属性、jersey注解类、mybatis mapper映射、sql列\n\n### step1\n将创建sql语句写入input.txt中\n```sql\nCREATE TABLE `t_gift_shop` (\n  `product_id` int(10) unsigned NOT NULL,\n  `shop_group_id` int(10) unsigned NOT NULL,\n  `is_new` tinyint(3) unsigned NOT NULL,\n  `remark` varchar(200) NOT NULL,\n  `upd_dt` datetime NOT NULL,\n  PRIMARY KEY (`product_id`)\n) ENGINE=InnoDB DEFAULT CHARSET=utf8;\n```\n\n### step2\n输入php build_java 命令\n```sh\nphp build_java \n\n  desc   根据sql创建语句生成java类属性、jersey注解类、mapper映射、sql列\n  e.g.   php build_java -type class\n  -type  转化的类型: \n                    class:  转化为普通类\n                    jersey: 转化为带有@JsonProperty注解的类属性\n                    mapper: 转化为mybatis mapper映射结果集\n                    sql:    生成sql列\n```\n### 生成对应结果文件\n```java\n// class\npublic class GiftShop {\n\n\tprivate int productID;\n\n\tprivate int shopGroupID;\n\n\tprivate int productWeight;\n\n\tprivate int new;\n\n\tprivate String remark;\n\n\tprivate Date updDT;\n\n}\n\n// jersey\npublic class GiftShop {\n\n\t@JsonProperty(\"product_id\")\n\tprivate int productID;\n\n\t@JsonProperty(\"shop_group_id\")\n\tprivate int shopGroupID;\n\n\t@JsonProperty(\"product_weight\")\n\tprivate int productWeight;\n\n\t@JsonProperty(\"is_new\")\n\tprivate int new;\n\n\t@JsonProperty(\"remark\")\n\tprivate String remark;\n\n\t@JsonProperty(\"upd_dt\")\n\t@JsonFormat(pattern = \"yyyy-MM-dd HH:mm:ss\", locale = \"zh\", timezone = \"GMT+8\")\n\tprivate Date updDT;\n\n}\n\n// mybatis mapper\n\u003cresultMap id=\"GiftShopDOMap\" type=\"GiftShopDO\"\u003e\n\t\u003cresult property=\"productID\" column=\"product_id\" /\u003e\n\t\u003cresult property=\"shopGroupID\" column=\"shop_group_id\" /\u003e\n\t\u003cresult property=\"productWeight\" column=\"product_weight\" /\u003e\n\t\u003cresult property=\"new\" column=\"is_new\" /\u003e\n\t\u003cresult property=\"remark\" column=\"remark\" /\u003e\n\t\u003cresult property=\"updDT\" column=\"upd_dt\" /\u003e\n\u003c/resultMap\u003e\n\n// sql\nproduct_id,shop_group_id,product_weight,is_new,remark,upd_dt\n\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Flovemo%2Fbuild_java","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Flovemo%2Fbuild_java","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Flovemo%2Fbuild_java/lists"}