{"id":21524123,"url":"https://github.com/ifinal-io/final-annotation","last_synced_at":"2026-03-17T19:30:27.974Z","repository":{"id":37636554,"uuid":"348932167","full_name":"ifinal-io/final-annotation","owner":"ifinal-io","description":"定义基础的注释与接口","archived":false,"fork":false,"pushed_at":"2024-07-14T08:23:14.000Z","size":934,"stargazers_count":3,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2026-01-14T04:48:07.737Z","etag":null,"topics":["cache","query","redis","sharding"],"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/ifinal-io.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-03-18T03:44:42.000Z","updated_at":"2025-07-04T06:35:29.000Z","dependencies_parsed_at":"2023-10-03T14:40:48.713Z","dependency_job_id":"4fa4d916-c216-4bee-b52b-5c36358b3612","html_url":"https://github.com/ifinal-io/final-annotation","commit_stats":null,"previous_names":["ifinal-io/final-annotation","final-projects/final-annotation"],"tags_count":7,"template":false,"template_full_name":null,"purl":"pkg:github/ifinal-io/final-annotation","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ifinal-io%2Ffinal-annotation","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ifinal-io%2Ffinal-annotation/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ifinal-io%2Ffinal-annotation/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ifinal-io%2Ffinal-annotation/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/ifinal-io","download_url":"https://codeload.github.com/ifinal-io/final-annotation/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ifinal-io%2Ffinal-annotation/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":29502934,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-02-16T05:57:17.024Z","status":"ssl_error","status_checked_at":"2026-02-16T05:56:49.929Z","response_time":115,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.5: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":["cache","query","redis","sharding"],"created_at":"2024-11-24T01:21:02.380Z","updated_at":"2026-02-16T07:32:11.684Z","avatar_url":"https://github.com/ifinal-io.png","language":"Java","funding_links":[],"categories":[],"sub_categories":[],"readme":"![Final Annotation](LOGO.png)\n\n# Final Annotation\n\n![Github CI](https://github.com/final-projects/final-annotation/workflows/ci/badge.svg)\n[![LICENSE](https://img.shields.io/github/license/final-projects/final-annotation)](http://www.apache.org/licenses/LICENSE-2.0.html)\n![Maven Central](https://img.shields.io/maven-central/v/org.ifinalframework.annotation/final-annotation?label=maven)\n![Releases](https://img.shields.io/nexus/r/org.ifinalframework.annotation/final-annotation?server=https://s01.oss.sonatype.org\u0026label=Releases)\n![Snapshots](https://img.shields.io/nexus/s/org.ifinalframework.annotation/final-annotation?server=https://s01.oss.sonatype.org\u0026label=Snapshots)\n![CODECOV](https://codecov.io/gh/final-projects/final-annotation/branch/main/graph/badge.svg)\n\n`Final Annotation`定义基础的注释与接口。\n\n## Final Annotation Core\n\n`Final Annotation Core`定义了大量的超接口和注释，用于标记标记和区分元素（类、方法或属性）在项目中所扮演的角色。\n\n如：\n\n* **IEnum**：用于枚举的`IEnum`接口，可实现Json序列化增强及自定义数据映射。\n* **IEntity**：用于实体类的`IEntity`接口，可实现ORM映射及通用的`CRUD`数据操作。\n* **IException**: 用于异常的`IException`接口，可用于区分系统异常和业务异常，从而进行全局的异常处理。\n* **IQuery**：用于查询的`IQuery`接口，可用于定义统一的查询规则。\n* **IResult**：用于结果的`IResult`接口，可实现统一的结果集处理。\n* **@Default**: 用于标记元素含有（或是）**默认**值，不需要框架进行处理。如数据的默认值。\n* **@Final**：用于标记元素是**终态**，不应该被修改，如数据库的主键ID和创建时间。\n* **@Transient**: 用于票房元素是**短暂**的，不需要被处理。\n\n## Final Annotation Data\n\n`Final Annotation Data`为`ORM`的定义了大量的注解。\n\n如：\n\n* **@Table**：用于指定实体类与数据库表的映射关系。\n* **@Column**：用于指定实体类属性与数据库列的映射关系。\n\n\u003e 一个实体类应有实现`IEntity`接口，或继承自`AbsEntity`。\n\n## Final Annotation Cache\n\n`Final Annotation Cache`定义了切面缓存注释，使用`Redis`做为缓存存储，支持`Value`和`Hash`等数据结构。\n\n可以为应用快速添加缓存功能，减少大量模板代码。\n\n```java\npublic interface UserService {\n\n    @Cacheable(key = \"#{#id}\")\n    User findById(Long id);\n\n}\n```\n\n## Final Annotation Query\n\n`Final Annotation Query`提供了丰富的查询条件(`Criterion`)和更新操作(`Update`)。\n\n### Query\n\n**Final Annotation Query**提供**编码**和**注解**两种方式来构建查询条件。\n\n如当需要构建以下查询条件时：\n\n```sql\nWHERE name = #{value} AND age BETWEEN #{min} AND #{max}\n```\n\n* 编码\n\n```java\nnew Query().where(\n    name.eq(\"name\"),\n    age.between(min,max)\n    );\n```\n\n* 注解\n\n```java\npublic class MyQuery implements IQuery {\n\n    @Equal\n    private String name;\n\n    @Between\n    private BetweenValue\u003cInteger\u003e age;\n\n    //setter and getter\n    //...\n}\n```\n\n### Update\n\n`Update`支持常用的数据设置及数学运算，如：\n\n```java\n    // UPDATE table SET name = #{value},version = version + 1;\n    new Update().set(\"name\",\"value\").incr(\"version\");\n```\n\n也添加了对`Json`数据列的支持：\n\n```java\n    // UPDATE table SET json = JSON_SET(json,path,value);\n    new Update().jsonSet(\"json\",\u003cpath, value\u003e);\n    // UPDATE table SET json = JSON_INSERT(json,path,value);\n    new Update().jsonInsert(\"json\",\u003cpath, value\u003e);\n    // UPDATE table SET json = JSON_REPLACE(json,path,value);\n    new Update().jsonReplace(\"json\",\u003cpath, value\u003e);\n    // UPDATE table SET json = JSON_REMOVE(json,paths);\n    new Update().jsonRemove(\"json\",paths);\n```\n\n\u003e **注意**`path`的格式为要以`$开头`。","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fifinal-io%2Ffinal-annotation","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fifinal-io%2Ffinal-annotation","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fifinal-io%2Ffinal-annotation/lists"}