KhxxDaoImpl.java
上传用户:quasar007
上传日期:2022-08-11
资源大小:4067k
文件大小:8k
源码类别:

企业管理

开发平台:

Java

  1. package com.dao;
  2. import com.tool.SQLCode;
  3. import java.util.List;
  4. import java.util.ArrayList;
  5. import com.domain.KhxxForm;
  6. import com.tool.JDBConnection;
  7. import java.sql.ResultSet;
  8. import java.sql.*;
  9. //对客户信息表的操作
  10. public class KhxxDaoImpl
  11.     implements KhxxDao {
  12.   private JDBConnection connection = new JDBConnection();
  13. //查询操作
  14.   public List khxxSelect() {
  15.     List list = new ArrayList();
  16.     KhxxForm form = null;
  17.     String sql = SQLCode.getSQLCode("sql.khxx.select");
  18.     try {
  19.       ResultSet rs = connection.executeQuery(sql);
  20.       while (rs.next()) {
  21.         form = new KhxxForm();
  22.         form.setKhxx_id(rs.getString(1));
  23.         form.setKhxx_mc(rs.getString(2));
  24.         form.setKhxx_qyxz(rs.getString(3));
  25.         form.setKhxx_qylx(rs.getString(4));
  26.         form.setKhxx_qyzx(rs.getString(5));
  27.         form.setKhxx_qydz(rs.getString(6));
  28.         form.setKhxx_szsf(rs.getString(7));
  29.         form.setKhxx_szcs(rs.getString(8));
  30.         form.setKhxx_gsyb(rs.getString(9));
  31.         form.setKhxx_frdb(rs.getString(10));
  32.         form.setKhxx_khyh(rs.getString(11));
  33.         form.setKhxx_yhzh(rs.getString(12));
  34.         form.setKhxx_nsh(rs.getString(13));
  35.         form.setKhxx_ICcard(rs.getString(14));
  36.         form.setKhxx_gswz(rs.getString(15));
  37.         form.setKhxx_gsdh(rs.getString(16));
  38.         form.setKhxx_gscz(rs.getString(17));
  39.         form.setKhxx_lxr(rs.getString(18));
  40.         form.setKhxx_lxrdh(rs.getString(19));
  41.         form.setKhxx_khjb(rs.getString(20));
  42.         form.setKhxx_bz(rs.getString(21));
  43.         list.add(form);
  44.       }
  45.     }
  46.     catch (SQLException ex) {
  47.     }
  48.     connection.close();
  49.     return list;
  50.   }
  51. //以客户编号去单独查询
  52.   public KhxxForm khxxSelectOne(KhxxForm khxx) {
  53.     KhxxForm form = null;
  54.     String sql = SQLCode.getSQLCode("sql.khxx.selectOne");
  55.     sql = connection.editSqlCode(sql, khxx.getKhxx_id());
  56.     try {
  57.       ResultSet rs = connection.executeQuery(sql);
  58.       while (rs.next()) {
  59.         form = new KhxxForm();
  60.         form.setKhxx_id(rs.getString(1));
  61.         form.setKhxx_mc(rs.getString(2));
  62.         form.setKhxx_qyxz(rs.getString(3));
  63.         form.setKhxx_qylx(rs.getString(4));
  64.         form.setKhxx_qyzx(rs.getString(5));
  65.         form.setKhxx_qydz(rs.getString(6));
  66.         form.setKhxx_szsf(rs.getString(7));
  67.         form.setKhxx_szcs(rs.getString(8));
  68.         form.setKhxx_gsyb(rs.getString(9));
  69.         form.setKhxx_frdb(rs.getString(10));
  70.         form.setKhxx_khyh(rs.getString(11));
  71.         form.setKhxx_yhzh(rs.getString(12));
  72.         form.setKhxx_nsh(rs.getString(13));
  73.         form.setKhxx_ICcard(rs.getString(14));
  74.         form.setKhxx_gswz(rs.getString(15));
  75.         form.setKhxx_gsdh(rs.getString(16));
  76.         form.setKhxx_gscz(rs.getString(17));
  77.         form.setKhxx_lxr(rs.getString(18));
  78.         form.setKhxx_lxrdh(rs.getString(19));
  79.         form.setKhxx_khjb(rs.getString(20));
  80.         form.setKhxx_bz(rs.getString(21));
  81.       }
  82.     }
  83.     catch (SQLException ex) {
  84.     }
  85.     connection.close();
  86.     return form;
  87.   }
  88. //#--以数据库中的记录数,查找出多少记录计算,以便做帐号存贮--
  89.   public int khxxCount() {
  90.     int iCount = 0;
  91.     String sql = SQLCode.getSQLCode("sql.khxx.count");
  92.     ResultSet rs = null;
  93.     try {
  94.       rs = connection.executeQuery(sql);
  95.       while (rs.next()) {
  96.         KhxxForm form = new KhxxForm();
  97.         iCount = rs.getInt("t");
  98.       }
  99.     }
  100.     catch (SQLException ex) {
  101.     }
  102.     connection.close();
  103.     return iCount + 1;
  104.   }
  105. //插入操作
  106.   public void khxxInsert(KhxxForm khxx) {
  107.     String sql = SQLCode.getSQLCode("sql.khxx.insert");
  108.     sql = connection.editSqlCode(sql, khxx.getKhxx_id());
  109.     sql = connection.editSqlCode(sql, khxx.getKhxx_mc());
  110.     sql = connection.editSqlCode(sql, khxx.getKhxx_qyxz());
  111.     sql = connection.editSqlCode(sql, khxx.getKhxx_qylx());
  112.     sql = connection.editSqlCode(sql, khxx.getKhxx_qyzx());
  113.     sql = connection.editSqlCode(sql, khxx.getKhxx_qydz());
  114.     sql = connection.editSqlCode(sql, khxx.getKhxx_szsf());
  115.     sql = connection.editSqlCode(sql, khxx.getKhxx_szcs());
  116.     sql = connection.editSqlCode(sql, khxx.getKhxx_gsyb());
  117.     sql = connection.editSqlCode(sql, khxx.getKhxx_frdb());
  118.     sql = connection.editSqlCode(sql, khxx.getKhxx_khyh());
  119.     sql = connection.editSqlCode(sql, khxx.getKhxx_yhzh());
  120.     sql = connection.editSqlCode(sql, khxx.getKhxx_nsh());
  121.     sql = connection.editSqlCode(sql, khxx.getKhxx_ICcard());
  122.     sql = connection.editSqlCode(sql, khxx.getKhxx_gswz());
  123.     sql = connection.editSqlCode(sql, khxx.getKhxx_gsdh());
  124.     sql = connection.editSqlCode(sql, khxx.getKhxx_gscz());
  125.     sql = connection.editSqlCode(sql, khxx.getKhxx_lxr());
  126.     sql = connection.editSqlCode(sql, khxx.getKhxx_lxrdh());
  127.     sql = connection.editSqlCode(sql, khxx.getKhxx_khjb());
  128.     sql = connection.editSqlCode(sql, khxx.getKhxx_bz());
  129.     connection.executeUpdate(sql);
  130.     connection.close();
  131.   }
  132. //删除操作
  133.   public void khxxDelete(KhxxForm khxx) {
  134.     String sql = SQLCode.getSQLCode("sql.khxx.delete");
  135.     sql = connection.editSqlCode(sql, khxx.getKhxx_id());
  136.     connection.executeUpdate(sql);
  137.     connection.close();
  138.   }
  139. //修改操作
  140.   public void khxxUpdate(KhxxForm khxx) {
  141.     String sql = SQLCode.getSQLCode("sql.khxx.update");
  142.     sql = connection.editSqlCode(sql, khxx.getKhxx_mc());
  143.     sql = connection.editSqlCode(sql, khxx.getKhxx_qyxz());
  144.     sql = connection.editSqlCode(sql, khxx.getKhxx_qylx());
  145.     sql = connection.editSqlCode(sql, khxx.getKhxx_qyzx());
  146.     sql = connection.editSqlCode(sql, khxx.getKhxx_qydz());
  147.     sql = connection.editSqlCode(sql, khxx.getKhxx_szsf());
  148.     sql = connection.editSqlCode(sql, khxx.getKhxx_szcs());
  149.     sql = connection.editSqlCode(sql, khxx.getKhxx_gsyb());
  150.     sql = connection.editSqlCode(sql, khxx.getKhxx_frdb());
  151.     sql = connection.editSqlCode(sql, khxx.getKhxx_khyh());
  152.     sql = connection.editSqlCode(sql, khxx.getKhxx_yhzh());
  153.     sql = connection.editSqlCode(sql, khxx.getKhxx_nsh());
  154.     sql = connection.editSqlCode(sql, khxx.getKhxx_ICcard());
  155.     sql = connection.editSqlCode(sql, khxx.getKhxx_gswz());
  156.     sql = connection.editSqlCode(sql, khxx.getKhxx_gsdh());
  157.     sql = connection.editSqlCode(sql, khxx.getKhxx_gscz());
  158.     sql = connection.editSqlCode(sql, khxx.getKhxx_lxr());
  159.     sql = connection.editSqlCode(sql, khxx.getKhxx_lxrdh());
  160.     sql = connection.editSqlCode(sql, khxx.getKhxx_khjb());
  161.     sql = connection.editSqlCode(sql, khxx.getKhxx_bz());
  162.      sql = connection.editSqlCode(sql, khxx.getKhxx_id());
  163.     connection.executeUpdate(sql);
  164.     connection.close();
  165.   }
  166. //根据客户名称去查询
  167.   public KhxxForm khxxMc(KhxxForm khxx) {
  168.     KhxxForm form = null;
  169.      String sql = SQLCode.getSQLCode("sql.khxx.mc");
  170.      sql = connection.editSqlCode(sql, khxx.getKhxx_mc());
  171.      try {
  172.        ResultSet rs = connection.executeQuery(sql);
  173.        while (rs.next()) {
  174.          form = new KhxxForm();
  175.          form.setKhxx_id(rs.getString(1));
  176.          form.setKhxx_mc(rs.getString(2));
  177.          form.setKhxx_qyxz(rs.getString(3));
  178.          form.setKhxx_qylx(rs.getString(4));
  179.          form.setKhxx_qyzx(rs.getString(5));
  180.          form.setKhxx_qydz(rs.getString(6));
  181.          form.setKhxx_szsf(rs.getString(7));
  182.          form.setKhxx_szcs(rs.getString(8));
  183.          form.setKhxx_gsyb(rs.getString(9));
  184.          form.setKhxx_frdb(rs.getString(10));
  185.          form.setKhxx_khyh(rs.getString(11));
  186.          form.setKhxx_yhzh(rs.getString(12));
  187.          form.setKhxx_nsh(rs.getString(13));
  188.          form.setKhxx_ICcard(rs.getString(14));
  189.          form.setKhxx_gswz(rs.getString(15));
  190.          form.setKhxx_gsdh(rs.getString(16));
  191.          form.setKhxx_gscz(rs.getString(17));
  192.          form.setKhxx_lxr(rs.getString(18));
  193.          form.setKhxx_lxrdh(rs.getString(19));
  194.          form.setKhxx_khjb(rs.getString(20));
  195.          form.setKhxx_bz(rs.getString(21));
  196.        }
  197.      }
  198.      catch (SQLException ex) {
  199.      }
  200.      connection.close();
  201.      return form;
  202.   }
  203. }