|
1 | | -# Code Generator |
| 1 | +# Code Generator 4 |
2 | 2 | 此工具主要用于将Excel模板文档转换为数据库结构、初始数据的sql及多语言资源代码。 |
3 | 3 |
|
4 | 4 | ## 主要功能 |
5 | 5 | * 生成Mysql/SQLServer/SQLite的数据库结构代码(ddl) |
6 | 6 | * 生成初始数据的sql代码(dml) |
7 | | -* 生成js/json/java格式的国际化资源代码 |
| 7 | +* 生成适用于android/ios/json/java/.net等格式的国际化资源代码 |
8 | 8 |
|
9 | 9 | ## 参数说明 |
10 | 10 | ``` |
11 | | -用法: |
12 | | -cg -type 生成类型 -lang 生成语言 -in 输入文件 [-sheets 要生成的Sheet名1[,2]] [-out 输出目录] |
13 | | -
|
14 | | -选项: |
15 | | - -type: ddl_mysql|ddl_sqlserver|ddl_sqlite|dml|msg |
16 | | - -lang: java|sql|js|json |
17 | | -
|
18 | | -默认值: |
19 | | - -type: 无 |
20 | | - -lang: java (type为 ddl/dml时默认值为sql) |
21 | | - -in: 无 |
22 | | - -sheets: 所有 |
23 | | - -out: ./out |
| 11 | +用法:cg command file [options] |
| 12 | +Commands: |
| 13 | + ddl.mssql 生成SqlServer数据库结构SQL脚本(.ddl)。 |
| 14 | + ddl.mysql 生成MySql数据库结构SQL脚本(.ddl)。 |
| 15 | + ddl.sqlite 生成SQLite数据库结构SQL脚本(.ddl)。 |
| 16 | + dml 生成数据库初始 数据SQL脚本(.dml)。 |
| 17 | + msg.android 生成Android国际化资源文件(strings.xml)。 |
| 18 | + msg.ios 生成IOS国际化资源文件(.strings)。 |
| 19 | + msg.json 生成JSON国际化资源文件(.json)。 |
| 20 | + msg.prop 生成Java国际化资源文件(.properties)。 |
| 21 | + msg.resx 生成.NET国际化资源文件(.resx)。 |
| 22 | +
|
| 23 | +Options: |
| 24 | + -fn,--file-name <fn> 生成的文件名,默认为Excel名。 |
| 25 | + -h,--help 显示帮助信息。 |
| 26 | + -out,--out-dir <dir> 输出目录,默认输出到 ./out 目录下。 |
| 27 | + -s,--sheets <names> 要处理的Excel Sheet名,默认全部,"#"开头的不处理。 |
| 28 | + -v,--version 打印版本信息。 |
| 29 | +
|
| 30 | +示例: |
| 31 | + cg msg.json 001.xlsx |
| 32 | + cg msg.resx 001.xlsx --sheets Sheet1 Sheet2 Sheet5 |
| 33 | +
|
| 34 | +帮助: |
| 35 | + cg ddl.mysql --help 显示数生成据库结构的更多帮助信息。 |
| 36 | + cg dml --help 显示生成初始数据的更多帮助信息。 |
| 37 | + cg msg.json --help 显示生成国际化资源的更多帮助信息。 |
| 38 | +通过 cg command --help 查看详细命令。 |
| 39 | +
|
| 40 | +--- |
| 41 | +Code Generator v4.0.0 |
| 42 | +By https://yanglb.com |
| 43 | +
|
24 | 44 | ``` |
25 | 45 |
|
26 | 46 | ## 用法示例 |
27 | 47 | ```sh |
28 | | -java -jar cg.jar -type ddl_mysql -lang sql -in xxx.xlsx -out ./out --type mysql |
| 48 | +# 生成 MySql 数据库结构脚本 |
| 49 | +java -jar cg4.jar ddl.mysql database.xlsx --engine myisam |
29 | 50 |
|
| 51 | +# 生成 JSON 多语言资源 |
| 52 | +java -jar cg4.jar msg.json msg.xlsx |
30 | 53 | ``` |
31 | 54 |
|
32 | | -> 详细请参考示例 [example](example) |
| 55 | +## 升级说明 |
| 56 | +4.x版本不兼容老版本的命令行参数,但Excel模板在所有版本下均可正常使用。 |
33 | 57 |
|
34 | 58 | ## License |
35 | 59 |
|
36 | | -Copyright (c) Copyright 2015-2019 yanglb.com. All rights reserved. |
| 60 | +Copyright (c) Copyright 2015-2020 yanglb.com. All rights reserved. |
37 | 61 |
|
38 | 62 | Licensed under the [Apache License 2.0](LICENSE) license. |
0 commit comments