doc[zfoo]: update document

This commit is contained in:
godotg committed 2022-12-02 20:39:13 +08:00
1 parent 2f75896907
commit 44004d5f93
14 files changed
+965 -265

No files matched your search

+23 -18
View File
@@ -1,24 +1,28 @@
### Ⅰ. 简介
English | [简体中文](./README_CN.md)
### Ⅰ. Introduction
- [storage](https://github.com/zfoo-project/zfoo/blob/main/storage/README.md)
Excel和Java类自动映射框架,只需要定义一个和Excel对应的类,直接解析Excel,json,csv
Excel and Java class automatic mapping framework, only need to define a class corresponding to Excel, directly parse
Excel, json, csv
- 利用Java动态语言的反射特性,无需任何代码就能解析Excel
- Take advantage of the reflection nature of the Java dynamic language to parse Excel without any code
- 支持Excel导出json,csv文件
- Support Excel to export json, csv files
### Ⅱ. 自动映射
### Ⅱ. Automatic mapping
- Excel的第一行对应Java类属性,第二行和第三行不会起到注释的作用,其中第一列必须是Id属性
- The first line of Excel corresponds to the Java class attribute, and the second and third lines do not serve as
comments, where the first column must be the Id attribute
![Image text](../doc/image/storage/storage01.png)
- Excel对应的Java类
- The Java class for Excel
![Image text](../doc/image/storage/storage02.png)
- 解析过后有两种使用方式
1. 通过注解
- After parsing, there are two ways to use it
1. By annotation
```
@Component
public class StudentManager {
@@ -28,31 +32,32 @@
}
```
2. 通过类动态获取
2. Dynamically obtained through classes
```
Storage<Integer, StudentResource> studentResources = (Storage<Integer, StudentResource>) StorageContext.getStorageManager().getStorage(StudentResource.class);
```
- 通过id找到对应的行
- Find the corresponding row by id
```
var studentResource = studentResources.get(1000);
```
- 通过索引找对应的行,默认为可重复的索引,返回了一个列表list
- Find the corresponding row by index, default to a repeatable index, and return a list
```
var students = studentResources.getIndex("name", "james0");
```
- 唯一索引通过Storage.getUniqueIndex()获取,需要把索引注解标注为@Index(unique = true)
- The unique index is obtained through Storage.getUniqueIndex(), and the index annotation needs to be marked as @Index(
unique = true)
### Ⅲ. 热更新Excel/Json
### Ⅲ. Hot update Excel Json
- [tank](https://github.com/zfoo-project/tank-game-server/blob/main/common/src/main/java/com/zfoo/tank/common/util/HotUtils.java)
分布式热更新Excel/Json/csv配置文件实现
Distributed hot update Excel Jsoncsv configuration file implementation
### Ⅳ. 用途
### Ⅳ. Use
- 财务分析,数据分析统计
- 游戏中的数值配置
- Financial analysis, data analysis statistics
- Numerical configuration in the game