BuildTable.java
上传用户:whbcdz
上传日期:2008-08-04
资源大小:7683k
文件大小:5k
源码类别:

JavaScript

开发平台:

Java

  1. package appjxc.constrol;
  2. import javax.swing.table.DefaultTableModel;
  3. import java.util.Vector;
  4. import java.util.List;
  5. import java.util.Iterator;
  6. import appjxc.dao.AdapterDao;
  7. import appjxc.model.*;
  8. public class BuildTable {
  9.     private String[] Tname = null;
  10.     private List ObjList = null;
  11.     public DefaultTableModel getGysTableModel(String queryStr){
  12.         String[] Tname = {"供应商编号","供应商名称","拼音码","供应商地址","所属地区","邮政编码","联系电话","联系人","开户银行","开户账号"};
  13.         DefaultTableModel tableModel = null;
  14.         Vector vname = new Vector();
  15.         for (int i = 0 ; i < Tname.length ; i++){
  16.             vname.addElement(Tname[i]);
  17.         }
  18.         tableModel = new DefaultTableModel(vname,0);
  19.         ObjList = AdapterDao.QueryObject(queryStr);
  20.         if(!ObjList.isEmpty()){
  21.             Iterator iterator = ObjList.iterator();
  22.             while(iterator.hasNext()){
  23.                 Vector vdata = new Vector();
  24.                 Obj_gys objgys = (Obj_gys)iterator.next();
  25.                 vdata.addElement(objgys.getGysbh());
  26.                 vdata.addElement(objgys.getGysmc());
  27.                 vdata.addElement(objgys.getPym());
  28.                 vdata.addElement(objgys.getGysdz());
  29.                 vdata.addElement(objgys.getSsdq());
  30.                 vdata.addElement(objgys.getYzbm());
  31.                 vdata.addElement(objgys.getTel());
  32.                 vdata.addElement(objgys.getLxr());
  33.                 vdata.addElement(objgys.getKhyh());
  34.                 vdata.addElement(objgys.getKhzh());
  35.                 tableModel.addRow(vdata);
  36.             }
  37.         }
  38.         return tableModel;
  39.     }
  40.     public DefaultTableModel getmedicineTableModel(String queryStr){
  41.         String[] Tname = {"药品编码","名称","药品条码","通用名","拼音码","单位","规格","剂型"
  42.                          ,"产地","包装数","有效期","质量标准","经营方式","批号","零售价格","进货价格"
  43.                          ,"批发价格","药品类名","医疗编号"};
  44.         DefaultTableModel tableModel = null;
  45.         Vector vname = new Vector();
  46.         for (int i = 0 ; i < Tname.length ; i++){
  47.             vname.addElement(Tname[i]);
  48.         }
  49.         tableModel = new DefaultTableModel(vname,0);
  50.         ObjList = AdapterDao.QueryObject(queryStr);
  51.         if(!ObjList.isEmpty()){
  52.             Iterator iterator = ObjList.iterator();
  53.             while(iterator.hasNext()){
  54.                 Vector vdata = new Vector();
  55.                /* "药品编码","名称","药品条码","通用名","拼音码","单位","规格","剂型"
  56.                          ,"产地","包装数","有效期","质量标准","经营方式","批号","零售价格","进货价格"
  57.                          ,"批发价格","药品类名","医疗编号","供应商编号"};*/
  58.                 obj_medicine object = (obj_medicine)iterator.next();
  59.                 vdata.addElement(object.getYpbh());
  60.                 vdata.addElement(object.getYpmc());
  61.                 vdata.addElement(object.getYptm());
  62.                 vdata.addElement(object.getTym());
  63.                 vdata.addElement(object.getPym());
  64.                 vdata.addElement(object.getDw());
  65.                 vdata.addElement(object.getGg());
  66.                 vdata.addElement(object.getJx());
  67.                 vdata.addElement(object.getCd());
  68.                 vdata.addElement(String.valueOf(object.getBzsl()));
  69.                 vdata.addElement(object.getYxq());
  70.                 vdata.addElement(object.getZlbz());
  71.                 vdata.addElement(object.getJyfs());
  72.                 vdata.addElement(object.getPh());
  73.                 vdata.addElement(object.getLsjg());
  74.                 vdata.addElement(object.getJhjg());
  75.                 vdata.addElement(object.getPfjg());
  76.                 vdata.addElement(object.getYplb());
  77.                 vdata.addElement(object.getYlbh());
  78.                 tableModel.addRow(vdata);
  79.             }
  80.         }
  81.         return tableModel;
  82.     }
  83.     public DefaultTableModel getClientTableModel(String queryStr){
  84.         String[] Tname = {"客户编号","客户名称","拼音码","客户地址","所属地区","邮政编码","联系电话","联系人","开户银行","开户账号"};
  85.         DefaultTableModel tableModel = null;
  86.         Vector vname = new Vector();
  87.         for (int i = 0 ; i < Tname.length ; i++){
  88.             vname.addElement(Tname[i]);
  89.         }
  90.         tableModel = new DefaultTableModel(vname,0);
  91.         ObjList = AdapterDao.QueryObject(queryStr);
  92.         if(!ObjList.isEmpty()){
  93.             Iterator iterator = ObjList.iterator();
  94.             while(iterator.hasNext()){
  95.                 Vector vdata = new Vector();
  96.                 Obj_client object = (Obj_client)iterator.next();
  97.                 vdata.addElement(object.getKhbh());
  98.                 vdata.addElement(object.getKhmc());
  99.                 vdata.addElement(object.getPym());
  100.                 vdata.addElement(object.getKhdz());
  101.                 vdata.addElement(object.getSsdq());
  102.                 vdata.addElement(object.getYzbm());
  103.                 vdata.addElement(object.getTel());
  104.                 vdata.addElement(object.getLxr());
  105.                 vdata.addElement(object.getKhyh());
  106.                 vdata.addElement(object.getKhzh());
  107.                 tableModel.addRow(vdata);
  108.             }
  109.         }
  110.         return tableModel;
  111.     }
  112. }