Skip to content

Commit 1d62dac

Browse files
committed
add test case
1 parent 2bcc626 commit 1d62dac

File tree

2 files changed

+91
-26
lines changed

2 files changed

+91
-26
lines changed

schema/dictionary.sql

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,4 +31,16 @@ INSERT INTO [PDRC_Dictionary] ([ID],[Type],[KeyName],[value],[ParentID],[Remark]
3131
INSERT INTO [PDRC_Dictionary] ([ID],[Type],[KeyName],[value],[ParentID],[Remark])VALUES (3612, N'ProficiencyInfo', N'PR02', N'掌握', 3610, '');
3232
INSERT INTO [PDRC_Dictionary] ([ID],[Type],[KeyName],[value],[ParentID],[Remark])VALUES (3613, N'ProficiencyInfo', N'PR03', N'熟练', 3610, '');
3333
INSERT INTO [PDRC_Dictionary] ([ID],[Type],[KeyName],[value],[ParentID],[Remark])VALUES (3614, N'ProficiencyInfo', N'PR04', N'精通', 3610, '');
34+
INSERT INTO [PDRC_Dictionary] ([ID],[Type],[KeyName],[value],[ParentID],[Remark],[SortIndex])VALUES (3615, N'ReasonableObjectiveInfo', '目标合理性',N'ReasonableObjective', null, null, null );
35+
INSERT INTO [PDRC_Dictionary] ([ID],[Type],[KeyName],[value],[ParentID],[Remark],[SortIndex])VALUES (3616, N'ReasonableObjectiveInfo', N'RO01', N'质量目标合理性', 3615, 1,'');
36+
INSERT INTO [PDRC_Dictionary] ([ID],[Type],[KeyName],[value],[ParentID],[Remark],[SortIndex])VALUES (3617, N'ReasonableObjectiveInfo', N'RO02', N'计划收入计划成本合理性', 3615, 2,'');
37+
INSERT INTO [PDRC_Dictionary] ([ID],[Type],[KeyName],[value],[ParentID],[Remark],[SortIndex])VALUES (3618, N'ReasonableObjectiveInfo', N'RO03', N'变更修正合理性', 3615, 3,'');
38+
INSERT INTO [PDRC_Dictionary] ([ID],[Type],[KeyName],[value],[ParentID],[Remark],[SortIndex])VALUES (3619, N'OperationStandardInfo', '操作规范性',N'OperationStandard', null, null, null );
39+
INSERT INTO [PDRC_Dictionary] ([ID],[Type],[KeyName],[value],[ParentID],[Remark],[SortIndex])VALUES (3620, N'OperationStandardInfo', N'OS01', N'立项结项及时性', 3619, 1,'');
40+
INSERT INTO [PDRC_Dictionary] ([ID],[Type],[KeyName],[value],[ParentID],[Remark],[SortIndex])VALUES (3621, N'OperationStandardInfo', N'OS02', N'主项目子项目挂接正确性', 3619, 2,'');
41+
INSERT INTO [PDRC_Dictionary] ([ID],[Type],[KeyName],[value],[ParentID],[Remark],[SortIndex])VALUES (3622, N'OperationStandardInfo', N'OS03', N'人力挂接项目(含IDLE)正确性', 3619, 3,'');
42+
INSERT INTO [PDRC_Dictionary] ([ID],[Type],[KeyName],[value],[ParentID],[Remark],[SortIndex])VALUES (3623, N'OperationStandardInfo', N'OS04', N'项目评价合理性', 3619, 4,'');
43+
INSERT INTO [PDRC_Dictionary] ([ID],[Type],[KeyName],[value],[ParentID],[Remark],[SortIndex])VALUES (3624, N'AccurateDataInfo', '数据准确性',N'AccurateData', null, null, null );
44+
INSERT INTO [PDRC_Dictionary] ([ID],[Type],[KeyName],[value],[ParentID],[Remark],[SortIndex])VALUES (3625, N'AccurateDataInfo', N'AD01', N'质量评价数据填报准确性', 3624, 1,'');
45+
INSERT INTO [PDRC_Dictionary] ([ID],[Type],[KeyName],[value],[ParentID],[Remark],[SortIndex])VALUES (3626, N'AccurateDataInfo', N'AD02', N'人力地图数据准确性', 3624, 2,'');
3446

src/main/java/com/coderdream/util/FileUtil.java

Lines changed: 79 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,9 @@
1212
public class FileUtil {
1313

1414
public static void main(String[] args) {
15-
method06();
15+
method10();
16+
method11();
17+
method12();
1618
}
1719

1820
public static void method00() {
@@ -49,9 +51,10 @@ public static void method00() {
4951
// System.out.println("Key = " + entry.getKey() + ", Value = " +
5052
// entry.getValue());
5153

52-
String sql = stringBuffer.toString() + ind + ", N'" + name + "Info', N'EL"
53-
+ String.format("%02d", ind - index) + "', N'" + entry.getKey()
54-
+ "', " + index + ", '" + entry.getValue() + "');";
54+
String sql = stringBuffer.toString() + ind + ", N'" + name
55+
+ "Info', N'EL" + String.format("%02d", ind - index)
56+
+ "', N'" + entry.getKey() + "', " + index + ", '"
57+
+ entry.getValue() + "');";
5558
System.out.println(sql);
5659
ind++;
5760
}
@@ -60,7 +63,6 @@ public static void method00() {
6063
}
6164

6265
public static void method01() {
63-
6466
try {
6567
// read file content from file
6668
StringBuffer sb = new StringBuffer("");
@@ -107,8 +109,9 @@ public static void method01() {
107109
// System.out.println("size:\t" + major.size());
108110
int ind = 6;
109111
for (String string : major) {
110-
String sql = stringBuffer.toString() + ind + ", N'MajorInfo', N'M"
111-
+ String.format("%04d", ind - 5) + "', N'" + string + "', 6, '');";
112+
String sql = stringBuffer.toString() + ind
113+
+ ", N'MajorInfo', N'M" + String.format("%04d", ind - 5)
114+
+ "', N'" + string + "', 6, '');";
112115
System.out.println(sql);
113116
ind++;
114117
// System.out.println(String.format("%04d", ind));
@@ -133,7 +136,6 @@ public static void method01() {
133136
}
134137

135138
public static void method02() {
136-
137139
try {
138140
// read file content from file
139141
StringBuffer sb = new StringBuffer("");
@@ -179,7 +181,8 @@ public static void method02() {
179181
// System.out.println("size:\t" + major.size());
180182
int ind = 1137;
181183
for (String string : major) {
182-
String sql = stringBuffer.toString() + ind + ", N'UniversityInfo', N'U"
184+
String sql = stringBuffer.toString() + ind
185+
+ ", N'UniversityInfo', N'U"
183186
+ String.format("%04d", ind - 5) + "', N'" + string
184187
+ "', 1136, '');";
185188
System.out.println(sql);
@@ -206,7 +209,6 @@ public static void method02() {
206209
}
207210

208211
public static void method03() {
209-
210212
try {
211213
// read file content from file
212214
StringBuffer sb = new StringBuffer("");
@@ -229,7 +231,6 @@ public static void method03() {
229231
String string = strArray[i];
230232
major.add(string);
231233
}
232-
233234
// System.out.println(str);
234235
}
235236
}
@@ -251,7 +252,8 @@ public static void method03() {
251252
// System.out.println("size:\t" + major.size());
252253
int ind = 3566;
253254
for (String string : major) {
254-
String sql = stringBuffer.toString() + ind + ", N'EducationInfo', N'E"
255+
String sql = stringBuffer.toString() + ind
256+
+ ", N'EducationInfo', N'E"
255257
+ String.format("%04d", ind - 5) + "', N'" + string
256258
+ "', 3565, '');";
257259
System.out.println(sql);
@@ -286,7 +288,7 @@ public static void method04() {
286288
String name = "EmployeeState";
287289
String prefix = "CC";
288290
int index = 3570;
289-
genSql(major, name, prefix, index);
291+
genSql(major, name, name, prefix, index);
290292
}
291293

292294
public static void method05() {
@@ -302,7 +304,7 @@ public static void method05() {
302304
int index = 3574;
303305
String name = "CandidateCity";
304306
String prefix = "CC";
305-
genSql(major, name, prefix, index);
307+
genSql(major, name, name, prefix, index);
306308
}
307309

308310
public static void method06() {
@@ -318,7 +320,7 @@ public static void method06() {
318320
int index = 3583;
319321
String name = "Skill";
320322
String prefix = "S";
321-
genSql(major, name, prefix, index);
323+
genSql(major, name, name, prefix, index);
322324
}
323325

324326
public static void method07() {
@@ -334,7 +336,7 @@ public static void method07() {
334336
String name = "Domain";
335337
int index = 3601;
336338
String prefix = "D";
337-
genSql(major, name, prefix, index);
339+
genSql(major, name, name, prefix, index);
338340
}
339341

340342
// 开启/结束
@@ -351,21 +353,22 @@ public static void method08() {
351353
String name = "TaskState";
352354
int index = 3607;
353355
String prefix = "TS";
354-
genSql(major, name, prefix, index);
356+
genSql(major, name, name, prefix, index);
355357
}
356358

357-
private static void genSql(List<String> major, String name, String prefix,
358-
int index) {
359+
private static void genSql(List<String> major, String name, String value,
360+
String prefix, int index) {
359361
StringBuffer stringBuffer = new StringBuffer(
360362
"INSERT INTO [PDRC_Dictionary] ([ID],[Type],[KeyName],[value],[ParentID],[Remark],[SortIndex])VALUES (");
361363
String strParent = stringBuffer.toString() + index + ", N'" + name
362-
+ "Info', '" + name + "',N'" + name + "', null, null, null );";
364+
+ "Info', '" + value + "',N'" + name + "', null, null, null );";
363365
System.out.println(strParent);
364366
int ind = index + 1;
365367
for (String string : major) {
366-
String sql = stringBuffer.toString() + ind + ", N'" + name + "Info', N'"
367-
+ prefix + String.format("%02d", ind - index) + "', N'" + string
368-
+ "', " + index + ", " + (ind - index) + ",'');";
368+
String sql = stringBuffer.toString() + ind + ", N'" + name
369+
+ "Info', N'" + prefix + String.format("%02d", ind - index)
370+
+ "', N'" + string + "', " + index + ", " + (ind - index)
371+
+ ",'');";
369372
System.out.println(sql);
370373
ind++;
371374
// System.out.println(String.format("%04d", ind));
@@ -374,18 +377,68 @@ private static void genSql(List<String> major, String name, String prefix,
374377

375378
// 了解:掌握:熟练:精通
376379
public static void method09() {
377-
List<String> major = new ArrayList<String>();
380+
List<String> items = new ArrayList<String>();
378381
String str = "了解:掌握:熟练:精通";
379382
String[] strArray = str.split(":");
380383
int len = strArray.length;
381384
for (int i = 0; i < len; i++) {
382385
String string = strArray[i];
383-
major.add(string);
386+
items.add(string);
384387
}
385388

386389
String name = "Proficiency";
387390
int index = 3610;
388391
String prefix = "P";
389-
genSql(major, name, prefix, index);
392+
genSql(items, name, name, prefix, index);
393+
}
394+
395+
/**
396+
* 目标合理性
397+
*/
398+
public static void method10() {
399+
List<String> items = new ArrayList<String>();
400+
items.add("质量目标合理性");
401+
items.add("计划收入计划成本合理性");
402+
items.add("变更修正合理性");
403+
404+
String name = "ReasonableObjective";
405+
String value = "目标合理性";
406+
int index = 3615;
407+
String prefix = "RO";
408+
genSql(items, name, value, prefix, index);
409+
}
410+
411+
// 了解:掌握:熟练:精通
412+
/**
413+
* 操作规范性
414+
*/
415+
public static void method11() {
416+
List<String> items = new ArrayList<String>();
417+
items.add("立项结项及时性");
418+
items.add("主项目子项目挂接正确性");
419+
items.add("人力挂接项目(含IDLE)正确性");
420+
items.add("项目评价合理性");
421+
422+
String name = "OperationStandard";
423+
String value = "操作规范性";
424+
int index = 3619;
425+
String prefix = "OS";
426+
genSql(items, name, value, prefix, index);
427+
}
428+
429+
// 了解:掌握:熟练:精通
430+
/**
431+
* 数据准确性
432+
*/
433+
public static void method12() {
434+
List<String> items = new ArrayList<String>();
435+
items.add("质量评价数据填报准确性");
436+
items.add("人力地图数据准确性");
437+
438+
String name = "AccurateData";
439+
String value = "数据准确性";
440+
int index = 3624;
441+
String prefix = "AD";
442+
genSql(items, name, value, prefix, index);
390443
}
391444
}

0 commit comments

Comments
 (0)