diff --git a/README.md b/README.md index a3b3aa6..74d17f0 100644 --- a/README.md +++ b/README.md @@ -1,5 +1,3 @@ -[//]: # "Author: bug" -[//]: # "Date: 2020-10-20 20:24:07" # Luban @@ -26,6 +24,14 @@ Luban适合有以下需求的开发者: 3. 希望做其他自定义生成或者缓存 +## 支持和联系 + +有使用上的疑问请即时加QQ群询问,随时帮助解决。 + + - QQ 群: 692890842 + - 邮箱: taojingjian#gmail.com + + ## 文档 - [主页](https://focus-creative-games.github.io/luban/index.html) @@ -115,9 +121,9 @@ Luban适合有以下需求的开发者: ![ex_2](docs/images/examples/ex_2.png) -- name="TbDemoPrivitive" 表示数据表名为TbDemoPrivitive,生成table的代码时使用这个类名。 +- name="TbDemoPrimitive" 表示数据表名为TbDemoPrimitive,生成table的代码时使用这个类名。 - value="DemoPrimitiveTypesTable" 表示数据表每行记录(即KV中的V)的类型为DemoPrimitiveTypesTable。 -- index="x4" 表示数据表以 类型的x4字段为key。 +- index="x4" 表示数据表以 类型的x4字段为key。可不填,**默认为第一个字段**。 - input="demo_primitive.xlsx" 表示数据表的数据文件为 demo_primitives.xlsx ### 枚举 @@ -194,16 +200,31 @@ Luban适合有以下需求的开发者: ![ex_32](docs/images/examples/ex_32.png) ### 可空数据类型 -配置数据中经常有空值的语义需求,实际项目中往往混杂地使用0或-1表达空值,既不自然清晰也不统一。luban借鉴了c#中的可空变量的概念,特地提供可空数据支持。除了string外的所有原生数据类型,以及enum类型都有相应的可空数据类型。定义方式为 <类型名>?,与c#里的Nullable类型定义方式相同。例如 bool?,int?,long?,double?, EColor? +配置数据中经常有空值的语义需求,实际项目中往往混杂地使用0或-1表达空值,既不自然清晰也不统一。luban借鉴了c#中的可空变量的概念,特地提供可空数据支持。除了string外的所有原生数据类型,以及enum、bean、和多态bean类型都有相应的可空数据类型。定义方式为 <类型名>?,与c#里的Nullable类型定义方式相同。例如 bool?,int?,long?,double?, EColor?, DemoType? ```xml - - - - - - - + + + + 多态数据结构 + + + + + + + + + + + + + + + + + +
``` ![ex_42](docs/images/examples/ex_42.png) @@ -771,12 +792,7 @@ return - [.NET Core source index](https://source.dot.net) -## 支持和联系 -``` - QQ 群: 692890842 - 邮箱: taojingjian#gmail.com -``` ## License diff --git a/config/Datas/test/test_null.xlsx b/config/Datas/test/test_null.xlsx index df6a027..872cf94 100644 Binary files a/config/Datas/test/test_null.xlsx and b/config/Datas/test/test_null.xlsx differ diff --git a/docs/images/examples/ex_42.png b/docs/images/examples/ex_42.png index 776b041..d240682 100644 Binary files a/docs/images/examples/ex_42.png and b/docs/images/examples/ex_42.png differ diff --git a/src/Luban.Job.Cfg/Source/DataCreators/ExcelDataCreator.cs b/src/Luban.Job.Cfg/Source/DataCreators/ExcelDataCreator.cs index a121ebc..c7df47d 100644 --- a/src/Luban.Job.Cfg/Source/DataCreators/ExcelDataCreator.cs +++ b/src/Luban.Job.Cfg/Source/DataCreators/ExcelDataCreator.cs @@ -352,9 +352,9 @@ namespace Luban.Job.Cfg.DataCreators { return null; } - else if (subType != DefBean.BEAN_NOT_NULL_STR) + else if (subType != DefBean.BEAN_NOT_NULL_STR && subType != originBean.Name) { - throw new Exception($"type:{type.Bean.FullName} 可空标识:{subType} 不合法(只能为{DefBean.BEAN_NOT_NULL_STR}或{DefBean.BEAN_NULL_STR})"); + throw new Exception($"type:{type.Bean.FullName} 可空标识:{subType} 不合法(只能为{DefBean.BEAN_NOT_NULL_STR}或{DefBean.BEAN_NULL_STR}或{originBean.Name})"); } } return new DBean(originBean, originBean, CreateBeanFields(originBean, x, ass)); diff --git a/src/Luban.Job.Cfg/Source/DataCreators/ExcelNamedRowDataCreator.cs b/src/Luban.Job.Cfg/Source/DataCreators/ExcelNamedRowDataCreator.cs index 576ccd6..0b8d61f 100644 --- a/src/Luban.Job.Cfg/Source/DataCreators/ExcelNamedRowDataCreator.cs +++ b/src/Luban.Job.Cfg/Source/DataCreators/ExcelNamedRowDataCreator.cs @@ -208,9 +208,9 @@ namespace Luban.Job.Cfg.DataCreators { return null; } - else if (subType != DefBean.BEAN_NOT_NULL_STR) + else if (subType != DefBean.BEAN_NOT_NULL_STR && subType != originBean.Name) { - throw new Exception($"type:{type.Bean.FullName} {DefBean.TYPE_NAME_KEY}:{subType} 不合法(只能为{DefBean.BEAN_NOT_NULL_STR}或{DefBean.BEAN_NULL_STR})"); + throw new Exception($"type:{type.Bean.FullName} 可空标识:{subType} 不合法(只能为{DefBean.BEAN_NOT_NULL_STR}或{DefBean.BEAN_NULL_STR}或{originBean.Name})"); } }