1212public class FileUtil {
1313
1414 public static void main (String [] args ) {
15- method04 ();
15+ method05 ();
1616 }
1717
18- private static void method01 () {
18+ public static void method01 () {
1919
2020 try {
2121 // read file content from file
@@ -63,9 +63,8 @@ private static void method01() {
6363 // System.out.println("size:\t" + major.size());
6464 int ind = 6 ;
6565 for (String string : major ) {
66- String sql = stringBuffer .toString () + ind
67- + ", N'MajorInfo', N'M" + String .format ("%04d" , ind - 5 )
68- + "', N'" + string + "', 6, '');" ;
66+ String sql = stringBuffer .toString () + ind + ", N'MajorInfo', N'M"
67+ + String .format ("%04d" , ind - 5 ) + "', N'" + string + "', 6, '');" ;
6968 System .out .println (sql );
7069 ind ++;
7170 // System.out.println(String.format("%04d", ind));
@@ -89,7 +88,7 @@ private static void method01() {
8988
9089 }
9190
92- private static void method02 () {
91+ public static void method02 () {
9392
9493 try {
9594 // read file content from file
@@ -135,9 +134,9 @@ private static void method02() {
135134 // System.out.println("size:\t" + major.size());
136135 int ind = 1137 ;
137136 for (String string : major ) {
138- String sql = stringBuffer .toString () + ind
139- + ", N'UniversityInfo', N'U" + String .format ("%04d" , ind - 5 )
140- + "', N'" + string + "', 1136, '');" ;
137+ String sql = stringBuffer .toString () + ind + ", N'UniversityInfo', N'U"
138+ + String .format ("%04d" , ind - 5 ) + "', N'" + string
139+ + "', 1136, '');" ;
141140 System .out .println (sql );
142141 ind ++;
143142 // System.out.println(String.format("%04d", ind));
@@ -160,8 +159,8 @@ private static void method02() {
160159 }
161160
162161 }
163-
164- private static void method03 () {
162+
163+ public static void method03 () {
165164
166165 try {
167166 // read file content from file
@@ -207,9 +206,9 @@ private static void method03() {
207206 // System.out.println("size:\t" + major.size());
208207 int ind = 3566 ;
209208 for (String string : major ) {
210- String sql = stringBuffer .toString () + ind
211- + ", N'EducationInfo', N'E" + String .format ("%04d" , ind - 5 )
212- + "', N'" + string + "', 3565, '');" ;
209+ String sql = stringBuffer .toString () + ind + ", N'EducationInfo', N'E"
210+ + String .format ("%04d" , ind - 5 ) + "', N'" + string
211+ + "', 3565, '');" ;
213212 System .out .println (sql );
214213 ind ++;
215214 // System.out.println(String.format("%04d", ind));
@@ -232,54 +231,53 @@ private static void method03() {
232231 }
233232
234233 }
235-
236- private static void method04 () {
237-
238- // read file content from file
239- StringBuffer sb = new StringBuffer ("" );
240-
241-
242- String str = null ;
243- List <String > major = new ArrayList <String >();
244- major .add ("在项" );
245- major .add ("离项" );
246- major .add ("离职" );
247-
248-
249- // INSERT INTO [PDRC_Dictionary]
250- // ([ID],[Type],[KeyName],[value],[ParentID],[Remark])VALUES
251- // (<ID, int,>
252- // ,<Type, nvarchar(50),>
253- // ,<KeyName, nvarchar(50),>
254- // ,<value, nvarchar(50),>
255- // ,<ParentID, int,>
256- // ,<Remark, nvarchar(100),>);
257-
258- StringBuffer stringBuffer = new StringBuffer (
259- "INSERT INTO [PDRC_Dictionary] ([ID],[Type],[KeyName],[value],[ParentID],[Remark])VALUES (" );
260- String strParent = stringBuffer .toString ()
261- + "3570, N'EmployeeStateInfo', 'EmployeeState', 'EmployeeState', null, null );" ;
262- System .out .println (strParent );
263- // System.out.println("size:\t" + major.size());
264- int ind = 3571 ;
265- for (String string : major ) {
266- String sql = stringBuffer .toString () + ind
267- + ", N'EmployeeStateInfo', N'E" + String .format ("%04d" , ind - 5 )
268- + "', N'" + string + "', 3570, '');" ;
269- System .out .println (sql );
270- ind ++;
271- // System.out.println(String.format("%04d", ind));
272- }
273-
274234
275- // write string to file
276- // FileWriter writer = new FileWriter("c://test2.txt");
277- // BufferedWriter bw = new BufferedWriter(writer);
278- // bw.write(sb.toString());
279- //
280- // bw.close();
281- // writer.close();
235+ public static void method04 () {
236+ List <String > major = new ArrayList <String >();
237+ major .add ("在项" );
238+ major .add ("离项" );
239+ major .add ("离职" );
240+
241+ StringBuffer stringBuffer = new StringBuffer (
242+ "INSERT INTO [PDRC_Dictionary] ([ID],[Type],[KeyName],[value],[ParentID],[Remark])VALUES (" );
243+ String strParent = stringBuffer .toString ()
244+ + "3570, N'EmployeeStateInfo', 'EmployeeState', 'EmployeeState', null, null );" ;
245+ System .out .println (strParent );
246+ int ind = 3571 ;
247+ for (String string : major ) {
248+ String sql = stringBuffer .toString () + ind + ", N'EmployeeStateInfo', N'E"
249+ + String .format ("%04d" , ind - 5 ) + "', N'" + string + "', 3570, '');" ;
250+ System .out .println (sql );
251+ ind ++;
252+ // System.out.println(String.format("%04d", ind));
253+ }
254+ }
282255
256+ public static void method05 () {
257+ List <String > major = new ArrayList <String >();
258+ major .add ("武汉" );
259+ major .add ("深圳" );
260+ major .add ("东莞" );
261+ major .add ("成都" );
262+ major .add ("广州" );
263+ major .add ("上海" );
264+ major .add ("大连" );
265+ major .add ("重庆" );
266+ int index = 3574 ;
267+ StringBuffer stringBuffer = new StringBuffer (
268+ "INSERT INTO [PDRC_Dictionary] ([ID],[Type],[KeyName],[value],[ParentID],[Remark])VALUES (" );
269+ String strParent = stringBuffer .toString () + index
270+ + ", N'CandidateCityInfo', 'CandidateCity', 'CandidateCity', null, null );" ;
271+ System .out .println (strParent );
272+ int ind = index + 1 ;
273+ for (String string : major ) {
274+ String sql = stringBuffer .toString () + ind
275+ + ", N'CandidateCityInfo', N'CC" + String .format ("%02d" , ind - index )
276+ + "', N'" + string + "', " + index + ", '');" ;
277+ System .out .println (sql );
278+ ind ++;
279+ // System.out.println(String.format("%04d", ind));
280+ }
283281 }
284282
285283}
0 commit comments