{"id":36420831,"url":"https://github.com/yananhub/flying-mybatis","last_synced_at":"2026-01-11T17:34:35.792Z","repository":{"id":239158668,"uuid":"354760942","full_name":"yananhub/flying-mybatis","owner":"yananhub","description":"Let Mybatis fly, provide some basic CRUD methods by simply inheriting AutoMapper, without losing any of the original Mybatis Spring functionally.","archived":false,"fork":false,"pushed_at":"2024-07-16T06:36:56.000Z","size":108,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2024-07-16T08:42:55.428Z","etag":null,"topics":["database","mybatis","spring","ssm"],"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/yananhub.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":"2021-04-05T07:59:35.000Z","updated_at":"2024-07-16T06:29:08.000Z","dependencies_parsed_at":"2024-06-03T12:54:09.741Z","dependency_job_id":"06033560-70a9-4dcc-bba8-9e710f160314","html_url":"https://github.com/yananhub/flying-mybatis","commit_stats":null,"previous_names":["yanandgit/flying-mybatis","yananhub/flying-mybatis"],"tags_count":4,"template":false,"template_full_name":null,"purl":"pkg:github/yananhub/flying-mybatis","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/yananhub%2Fflying-mybatis","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/yananhub%2Fflying-mybatis/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/yananhub%2Fflying-mybatis/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/yananhub%2Fflying-mybatis/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/yananhub","download_url":"https://codeload.github.com/yananhub/flying-mybatis/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/yananhub%2Fflying-mybatis/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":28315879,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-01-11T14:58:17.114Z","status":"ssl_error","status_checked_at":"2026-01-11T14:55:53.580Z","response_time":60,"last_error":"SSL_read: 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":["database","mybatis","spring","ssm"],"created_at":"2026-01-11T17:34:35.385Z","updated_at":"2026-01-11T17:34:35.777Z","avatar_url":"https://github.com/yananhub.png","language":"Java","funding_links":[],"categories":[],"sub_categories":[],"readme":"**Read this in other languages: [English](README.md), [中文](README_zh.md).**\n\n# Flying Mybatis\n\nLet Mybatis fly, provide some basic CRUD methods by simply inheriting `AutoMapper`, without losing any of the original\nMybatis Spring functionally.\n\nUse steps:\n\nAdd the jar package dependency, using gradle as an example:\n\n```groovy\ndependencies {\n    implementation 'org.mybatis.spring.boot:mybatis-spring-boot-starter:x.y.z'\n    implementation 'tech.yanand:flying-mybatis:x.y.z'   // Flying Mybatis jar\n}\n```\n\nAdd configuration in `application.properties` to turn on the camel case conversion, which is required:\n\n```properties\nmybatis.configuration.map-underscore-to-camel-case=true\n# XML mapper can be turned on if needed, but it is not necessary\nmybatis.mapper-locations=classpath:mapper/*.xml\n```\n\nAdd a Spring configuration class to your project:\n\n```java\n@Configuration\n@Import(AutoMapperProcessor.class)\nclass AutoMapperConfig {\n}\n```\n\nCreate a new entity class that maps the tables and columns of the DB using `@Table` and `@Column` annotations.\nTake the `Book` entity as an example:\n\n```java\n@Table\npublic class Book {\n\n    @Column\n    @PrimaryKey\n    private Long id;\n\n    @Column\n    private String name;\n\n    @Column(\"release_date\")\n    private LocalDate publishDate;\n}\n```\n\nDefine the `BookMapper` interface, which extends from the `AutoMapper` interface.\nIt will derive basic methods of adding, deleting, modifying, selecting, and their functionality.\n\n```java\n@Mapper\npublic interface BookMapper extends AutoMapper\u003cBook, Long\u003e {\n\n    // Custom methods that define SQL in XML Mapper.\n    Collection\u003cBook\u003e selectByName(@Param(\"name\") String name);\n}\n```\n\nUse the `BookMapper`:\n\n```java\n@Autowired\nprivate BookMapper bookMapper;\n\nvoid testBookMapper() {\n    int result =          bookMapper.insertAll(List.of(book1, book2));\n    int result =          bookMapper.insert(book3);\n    \n    List\u003cBook\u003e bookList = bookMapper.selectAll();\n    Book book =           bookMapper.selectById(1L);\n    List\u003cBook\u003e bookList = bookMapper.selectAllById(List.of(1L, 0L));\n    List\u003cBook\u003e bookList = bookMapper.selectAllByColumn(\"name\", \"test_book_2\");\n    long count =          bookMapper.countAll();\n\n    int result =          bookMapper.updateAll(List.of(book3, book4));\n    int result =          bookMapper.updateAllSelective(List.of(book3, book4));\n    int result =          bookMapper.update(book3);\n    int result =          bookMapper.updateSelective(book3);\n\n    int result =          bookMapper.deleteById(1L);\n    int result =          bookMapper.deleteAllById(List.of(0L, 1L));\n                          bookMapper.deleteAll();\n}\n```","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fyananhub%2Fflying-mybatis","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fyananhub%2Fflying-mybatis","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fyananhub%2Fflying-mybatis/lists"}