www.pudn.com > WSMS.rar > Util.java


//Source file: D:\\WORK\\1G项目实践\\WSMS\\CI\\CODE\\src\\com\\intacpurun\\wsms\\comm\\Util.java 
 
package com.intacpurun.wsms.comm; 
 
import java.sql.*; 
import java.util.*; 
 
import com.intacpurun.wsms.comm.db.*; 
import com.intacpurun.wsms.comm.vo.*; 
 
/** 
 * 工具类 
 */ 
public class Util 
{ 
 
   /** 
    * @roseuid 44CF192C0232 
    */ 
   private Util() 
   { 
 
   } 
 
   /** 
    * 获得城市列表 
    * @return List 
    * @roseuid 44CEC89C000F 
    */ 
   public static List getCityList() 
   { 
     List cityList = new ArrayList(); 
 
     String sql = "select cityid,cityname "+ 
                  "from cityinfo "+ 
                  "order by cityid"; 
 
     DbUtil db = DbUtil.open(); 
     ResultSet rs = db.executeQuery(sql); 
 
    try 
    { 
      while (rs.next()) 
      { 
        ListNode node = new ListNode(); 
        node.setId(rs.getString("cityid")); 
        node.setName(rs.getString("cityName")); 
 
        cityList.add(node); 
      } 
    } catch (SQLException ex) 
    { 
      System.out.println(ex); 
      ex.printStackTrace(); 
    }finally 
    { 
      db.close(); 
    } 
 
    return cityList; 
   } 
}