{"id":37023005,"url":"https://github.com/weiecho/mybatis-plugin","last_synced_at":"2026-01-14T02:45:24.302Z","repository":{"id":57716186,"uuid":"99231310","full_name":"weiecho/mybatis-plugin","owner":"weiecho","description":"根据真实使用场景对mybatis进行的扩展，实现分页、json存储、数组存储、blob存储等支持。","archived":false,"fork":false,"pushed_at":"2023-04-14T17:55:27.000Z","size":28,"stargazers_count":8,"open_issues_count":1,"forks_count":9,"subscribers_count":3,"default_branch":"master","last_synced_at":"2025-07-12T21:47:24.976Z","etag":null,"topics":["array","blob","json","mybatis","mybatis-plus","pagination"],"latest_commit_sha":null,"homepage":"","language":"Java","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/weiecho.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}},"created_at":"2017-08-03T12:42:03.000Z","updated_at":"2025-01-17T16:06:57.000Z","dependencies_parsed_at":"2022-08-25T09:20:19.266Z","dependency_job_id":null,"html_url":"https://github.com/weiecho/mybatis-plugin","commit_stats":null,"previous_names":[],"tags_count":1,"template":false,"template_full_name":null,"purl":"pkg:github/weiecho/mybatis-plugin","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/weiecho%2Fmybatis-plugin","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/weiecho%2Fmybatis-plugin/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/weiecho%2Fmybatis-plugin/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/weiecho%2Fmybatis-plugin/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/weiecho","download_url":"https://codeload.github.com/weiecho/mybatis-plugin/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/weiecho%2Fmybatis-plugin/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":28408735,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-01-14T01:52:23.358Z","status":"online","status_checked_at":"2026-01-14T02:00:06.678Z","response_time":107,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"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":["array","blob","json","mybatis","mybatis-plus","pagination"],"created_at":"2026-01-14T02:45:23.680Z","updated_at":"2026-01-14T02:45:24.281Z","avatar_url":"https://github.com/weiecho.png","language":"Java","funding_links":[],"categories":[],"sub_categories":[],"readme":"# mybatis-plugin\n根据真实使用场景对mybatis进行的扩展，实现分页、json存储、数组存储、blob存储等支持。\n\n[![GitHub release](https://img.shields.io/github/v/release/weiecho/mybatis-plugin)](https://github.com/weiecho/mybatis-plugin/releases)\n[![Maven Central Repo](https://img.shields.io/maven-central/v/cn.weiecho/mybatis-plugin)](https://mvnrepository.com/artifact/cn.weiecho/mybatis-plugin)\n[![openjdk](https://img.shields.io/badge/jdk-v1.8%2B-red)](http://openjdk.java.net)\n[![License](https://img.shields.io/github/license/weiecho/sentinel-client)](https://opensource.org/licenses/Apache-2.0)\n\n\n### 扩展Mybatis数据类型\n\n##### 1、ArrayTypeHandler 支持数组数据的存储和读取\nbean定义格式\n```java\nprivate String[] tags;\n```\n\nmapper定义格式\n```xml\n\u003cresult property=\"tags\" column=\"tags\" typeHandler=\"ArrayTypeHandler\"/\u003e\n```\n\n\n##### 2、JsonTypeHandler 支持Json对象数据的存储和读取\nbean定义格式\n```java\n/** 图片 如：[{imageUrl:\"/1.jpg\"}] **/\nprivate Object imagesUrl;\n```\n\nmapper定义格式\n```xml\n\u003cresult property=\"imagesUrl\" column=\"imagesUrl\" typeHandler=\"JsonTypeHandler\"/\u003e\n```\n\n##### 3、BlobTypeHandler 支持Blob数据的存储和读取\nbean定义格式\n```java\n/** 文章内容 **/\nprivate String content;\n```\n\nmapper定义格式\n```xml\n\u003cresult property=\"content\" column=\"content\" typeHandler=\"BlobTypeHandler\"/\u003e\n```\n\n##### 4、ListTypeHandler 支持List\u003cString\u003e数据的存储和读取(可以视为Array的升级版)\nbean定义格式\n```java\nprivate List\u003cString\u003e tags;\n```\n\nmapper定义格式\n```xml\n\u003cresult property=\"tags\" column=\"tags\" typeHandler=\"ListTypeHandler\"/\u003e\n```\n\n\n\n### 扩展Mybatis自动执行分页SQL处理\n##### 1、MysqlPageInterceptor支持mysql数据的分页\n```java\nPageInterceptor pageInterceptor = new MysqlPageInterceptor();\nsessionFactory.setPlugins(new Interceptor[]{pageInterceptor});\n```\n\n##### 2、OraclePageInterceptor支持oracle数据的分页\n```java\nPageInterceptor pageInterceptor = new OraclePageInterceptor();\nsessionFactory.setPlugins(new Interceptor[]{pageInterceptor});\n```\n\n##### 3、PostgresqlPageInterceptor支持postgresql数据的分页\n```java\nPageInterceptor pageInterceptor = new PostgresqlPageInterceptor();\nsessionFactory.setPlugins(new Interceptor[]{pageInterceptor});\n```\n\nps:如果分页对应的查询语句中不存在` from `会throw异常分页查询SQL没有找到[from]关键字，from必须为小写且前后加空格。\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fweiecho%2Fmybatis-plugin","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fweiecho%2Fmybatis-plugin","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fweiecho%2Fmybatis-plugin/lists"}