export-table-pulgin-csharp 1.0.19 → 1.0.22
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +33 -5
- package/package.json +1 -1
- package/src/index.ts +33 -5
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AACA,OAAO,EAAO,iBAAiB,EAA+B,UAAU,EAA0B,MAAM,kBAAkB,CAAA;AAG1H,wBAAgB,YAAY,CAAC,KAAK,EAAE,iBAAiB,GAAG,MAAM,GAAG,IAAI,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AACA,OAAO,EAAO,iBAAiB,EAA+B,UAAU,EAA0B,MAAM,kBAAkB,CAAA;AAG1H,wBAAgB,YAAY,CAAC,KAAK,EAAE,iBAAiB,GAAG,MAAM,GAAG,IAAI,CAiQpE;AAED,qBAAa,YAAa,SAAQ,UAAU;IAC3C,IAAI,SAAW;IACf,IAAI,EAAE,MAAM,EAAE,CAAS;IAEvB,WAAW,CAAC,KAAK,EAAE,iBAAiB;CAOpC;AAED,eAAO,MAAM,aAAa,gBAEzB,CAAA"}
|
package/dist/index.js
CHANGED
|
@@ -148,6 +148,7 @@ function export_stuff(paras) {
|
|
|
148
148
|
using System.Collections.Generic;
|
|
149
149
|
using System.Linq;
|
|
150
150
|
|
|
151
|
+
namespace MEEC.ExportedConfigs{
|
|
151
152
|
public class ${RowClass} {
|
|
152
153
|
|
|
153
154
|
public static List<${RowClass}> Configs = new List<${RowClass}>()
|
|
@@ -182,7 +183,7 @@ ${(0, export_table_lib_1.foreach)(getDescripts(f), line => ` /// ${line}`)}
|
|
|
182
183
|
public ${getFieldType(f)} ${convMemberName(f.name)};`)}
|
|
183
184
|
|
|
184
185
|
${(0, export_table_lib_1.cmm)( /**生成get字段 */)}
|
|
185
|
-
|
|
186
|
+
#region get字段
|
|
186
187
|
${(0, export_table_lib_1.foreach)(fields, f => {
|
|
187
188
|
if (f.nameOrigin != f.name) {
|
|
188
189
|
return ` public ${getFieldType(f)} ${getTitle(f).replace(" ", "_")} => ${convMemberName(f.name)};`;
|
|
@@ -191,9 +192,35 @@ ${(0, export_table_lib_1.foreach)(fields, f => {
|
|
|
191
192
|
return "";
|
|
192
193
|
}
|
|
193
194
|
})}
|
|
194
|
-
|
|
195
|
+
#endregion
|
|
195
196
|
|
|
196
|
-
|
|
197
|
+
#region uid map
|
|
198
|
+
${(0, export_table_lib_1.foreach)(fields, f => {
|
|
199
|
+
if (f.nameOrigin != f.name) {
|
|
200
|
+
return `
|
|
201
|
+
protected static Dictionary<int, ${RowClass}> _tempDictBy${convMemberName(f.name)};
|
|
202
|
+
public static ${RowClass} GetConfigBy${convMemberName(f.name)}(int ${convMemberName(f.name)})
|
|
203
|
+
{
|
|
204
|
+
if (_tempDictBy${convMemberName(f.name)} == null)
|
|
205
|
+
{
|
|
206
|
+
_tempDictBy${convMemberName(f.name)} = new Dictionary<int, ${RowClass}>();
|
|
207
|
+
Configs.ForEach(c =>
|
|
208
|
+
{
|
|
209
|
+
_tempDictBy${convMemberName(f.name)}.Add(c.${convMemberName(f.name)}, c);
|
|
210
|
+
});
|
|
211
|
+
}
|
|
212
|
+
return _tempDictBy${convMemberName(f.name)}.GetValueOrDefault(${convMemberName(f.name)});
|
|
213
|
+
}
|
|
214
|
+
`;
|
|
215
|
+
}
|
|
216
|
+
else {
|
|
217
|
+
return "";
|
|
218
|
+
}
|
|
219
|
+
})}
|
|
220
|
+
|
|
221
|
+
#endregion uid map
|
|
222
|
+
|
|
223
|
+
#region 生成fk.get/set
|
|
197
224
|
${(0, export_table_lib_1.foreach)(fields, f => `
|
|
198
225
|
${(0, export_table_lib_1.iff)(f.type == "fk", () => `
|
|
199
226
|
${(0, export_table_lib_1.iff)(getFkFieldType(f).toLowerCase() != "uid", () => `
|
|
@@ -239,7 +266,7 @@ ${(0, export_table_lib_1.iff)(f.type == "fk[]", () => `
|
|
|
239
266
|
if(null==this.${convMemberName(f.name)}){
|
|
240
267
|
this._fk${convMemberName(f.name)} = new ${convMemberName(f.fkTableName)}[0];
|
|
241
268
|
}else{
|
|
242
|
-
this._fk${convMemberName(f.name)}=
|
|
269
|
+
this._fk${convMemberName(f.name)}=MEEC.ExportedConfigs.${convMemberName(f.fkTableName)}.Configs.FindAll(a=>a.${convMemberName(f.fkFieldName)}!=null && this.${convMemberName(f.name)}!.Contains(a.${convMemberName(f.fkFieldName)})).ToArray();
|
|
243
270
|
}
|
|
244
271
|
}
|
|
245
272
|
return this._fk${convMemberName(f.name)};
|
|
@@ -247,7 +274,8 @@ ${(0, export_table_lib_1.iff)(f.type == "fk[]", () => `
|
|
|
247
274
|
}
|
|
248
275
|
`)}
|
|
249
276
|
`)}
|
|
250
|
-
|
|
277
|
+
#endregion 生成fk.get/set
|
|
278
|
+
}
|
|
251
279
|
}
|
|
252
280
|
`;
|
|
253
281
|
return temp;
|
package/package.json
CHANGED
package/src/index.ts
CHANGED
|
@@ -117,6 +117,7 @@ export function export_stuff(paras: HandleSheetParams): string | null {
|
|
|
117
117
|
using System.Collections.Generic;
|
|
118
118
|
using System.Linq;
|
|
119
119
|
|
|
120
|
+
namespace MEEC.ExportedConfigs{
|
|
120
121
|
public class ${RowClass} {
|
|
121
122
|
|
|
122
123
|
public static List<${RowClass}> Configs = new List<${RowClass}>()
|
|
@@ -160,7 +161,7 @@ ${foreach(getDescripts(f), line =>
|
|
|
160
161
|
)}
|
|
161
162
|
|
|
162
163
|
${cmm(/**生成get字段 */)}
|
|
163
|
-
|
|
164
|
+
#region get字段
|
|
164
165
|
${foreach(fields, f => {
|
|
165
166
|
if (f.nameOrigin != f.name) {
|
|
166
167
|
return ` public ${getFieldType(f)} ${getTitle(f).replace(" ", "_")} => ${convMemberName(f.name)};`
|
|
@@ -169,9 +170,35 @@ ${foreach(fields, f => {
|
|
|
169
170
|
}
|
|
170
171
|
}
|
|
171
172
|
)}
|
|
172
|
-
|
|
173
|
+
#endregion
|
|
173
174
|
|
|
174
|
-
|
|
175
|
+
#region uid map
|
|
176
|
+
${foreach(fields, f => {
|
|
177
|
+
if (f.nameOrigin != f.name) {
|
|
178
|
+
return `
|
|
179
|
+
protected static Dictionary<int, ${RowClass}> _tempDictBy${convMemberName(f.name)};
|
|
180
|
+
public static ${RowClass} GetConfigBy${convMemberName(f.name)}(int ${convMemberName(f.name)})
|
|
181
|
+
{
|
|
182
|
+
if (_tempDictBy${convMemberName(f.name)} == null)
|
|
183
|
+
{
|
|
184
|
+
_tempDictBy${convMemberName(f.name)} = new Dictionary<int, ${RowClass}>();
|
|
185
|
+
Configs.ForEach(c =>
|
|
186
|
+
{
|
|
187
|
+
_tempDictBy${convMemberName(f.name)}.Add(c.${convMemberName(f.name)}, c);
|
|
188
|
+
});
|
|
189
|
+
}
|
|
190
|
+
return _tempDictBy${convMemberName(f.name)}.GetValueOrDefault(${convMemberName(f.name)});
|
|
191
|
+
}
|
|
192
|
+
`
|
|
193
|
+
} else {
|
|
194
|
+
return ""
|
|
195
|
+
}
|
|
196
|
+
}
|
|
197
|
+
)}
|
|
198
|
+
|
|
199
|
+
#endregion uid map
|
|
200
|
+
|
|
201
|
+
#region 生成fk.get/set
|
|
175
202
|
${foreach(fields, f => `
|
|
176
203
|
${iff(f.type == "fk", () => `
|
|
177
204
|
${iff(getFkFieldType(f).toLowerCase() != "uid", () => `
|
|
@@ -217,7 +244,7 @@ ${iff(f.type == "fk[]", () => `
|
|
|
217
244
|
if(null==this.${convMemberName(f.name)}){
|
|
218
245
|
this._fk${convMemberName(f.name)} = new ${convMemberName(f.fkTableName!)}[0];
|
|
219
246
|
}else{
|
|
220
|
-
this._fk${convMemberName(f.name)}=
|
|
247
|
+
this._fk${convMemberName(f.name)}=MEEC.ExportedConfigs.${convMemberName(f.fkTableName!)}.Configs.FindAll(a=>a.${convMemberName(f.fkFieldName!)}!=null && this.${convMemberName(f.name)}!.Contains(a.${convMemberName(f.fkFieldName!)})).ToArray();
|
|
221
248
|
}
|
|
222
249
|
}
|
|
223
250
|
return this._fk${convMemberName(f.name)};
|
|
@@ -225,7 +252,8 @@ ${iff(f.type == "fk[]", () => `
|
|
|
225
252
|
}
|
|
226
253
|
`)}
|
|
227
254
|
`)}
|
|
228
|
-
|
|
255
|
+
#endregion 生成fk.get/set
|
|
256
|
+
}
|
|
229
257
|
}
|
|
230
258
|
`
|
|
231
259
|
|