KhxxDaoImpl.java
上传用户:quasar007
上传日期:2022-08-11
资源大小:4067k
文件大小:8k
- package com.dao;
- import com.tool.SQLCode;
- import java.util.List;
- import java.util.ArrayList;
- import com.domain.KhxxForm;
- import com.tool.JDBConnection;
- import java.sql.ResultSet;
- import java.sql.*;
- //对客户信息表的操作
- public class KhxxDaoImpl
- implements KhxxDao {
- private JDBConnection connection = new JDBConnection();
- //查询操作
- public List khxxSelect() {
- List list = new ArrayList();
- KhxxForm form = null;
- String sql = SQLCode.getSQLCode("sql.khxx.select");
- try {
- ResultSet rs = connection.executeQuery(sql);
- while (rs.next()) {
- form = new KhxxForm();
- form.setKhxx_id(rs.getString(1));
- form.setKhxx_mc(rs.getString(2));
- form.setKhxx_qyxz(rs.getString(3));
- form.setKhxx_qylx(rs.getString(4));
- form.setKhxx_qyzx(rs.getString(5));
- form.setKhxx_qydz(rs.getString(6));
- form.setKhxx_szsf(rs.getString(7));
- form.setKhxx_szcs(rs.getString(8));
- form.setKhxx_gsyb(rs.getString(9));
- form.setKhxx_frdb(rs.getString(10));
- form.setKhxx_khyh(rs.getString(11));
- form.setKhxx_yhzh(rs.getString(12));
- form.setKhxx_nsh(rs.getString(13));
- form.setKhxx_ICcard(rs.getString(14));
- form.setKhxx_gswz(rs.getString(15));
- form.setKhxx_gsdh(rs.getString(16));
- form.setKhxx_gscz(rs.getString(17));
- form.setKhxx_lxr(rs.getString(18));
- form.setKhxx_lxrdh(rs.getString(19));
- form.setKhxx_khjb(rs.getString(20));
- form.setKhxx_bz(rs.getString(21));
- list.add(form);
- }
- }
- catch (SQLException ex) {
- }
- connection.close();
- return list;
- }
- //以客户编号去单独查询
- public KhxxForm khxxSelectOne(KhxxForm khxx) {
- KhxxForm form = null;
- String sql = SQLCode.getSQLCode("sql.khxx.selectOne");
- sql = connection.editSqlCode(sql, khxx.getKhxx_id());
- try {
- ResultSet rs = connection.executeQuery(sql);
- while (rs.next()) {
- form = new KhxxForm();
- form.setKhxx_id(rs.getString(1));
- form.setKhxx_mc(rs.getString(2));
- form.setKhxx_qyxz(rs.getString(3));
- form.setKhxx_qylx(rs.getString(4));
- form.setKhxx_qyzx(rs.getString(5));
- form.setKhxx_qydz(rs.getString(6));
- form.setKhxx_szsf(rs.getString(7));
- form.setKhxx_szcs(rs.getString(8));
- form.setKhxx_gsyb(rs.getString(9));
- form.setKhxx_frdb(rs.getString(10));
- form.setKhxx_khyh(rs.getString(11));
- form.setKhxx_yhzh(rs.getString(12));
- form.setKhxx_nsh(rs.getString(13));
- form.setKhxx_ICcard(rs.getString(14));
- form.setKhxx_gswz(rs.getString(15));
- form.setKhxx_gsdh(rs.getString(16));
- form.setKhxx_gscz(rs.getString(17));
- form.setKhxx_lxr(rs.getString(18));
- form.setKhxx_lxrdh(rs.getString(19));
- form.setKhxx_khjb(rs.getString(20));
- form.setKhxx_bz(rs.getString(21));
- }
- }
- catch (SQLException ex) {
- }
- connection.close();
- return form;
- }
- //#--以数据库中的记录数,查找出多少记录计算,以便做帐号存贮--
- public int khxxCount() {
- int iCount = 0;
- String sql = SQLCode.getSQLCode("sql.khxx.count");
- ResultSet rs = null;
- try {
- rs = connection.executeQuery(sql);
- while (rs.next()) {
- KhxxForm form = new KhxxForm();
- iCount = rs.getInt("t");
- }
- }
- catch (SQLException ex) {
- }
- connection.close();
- return iCount + 1;
- }
- //插入操作
- public void khxxInsert(KhxxForm khxx) {
- String sql = SQLCode.getSQLCode("sql.khxx.insert");
- sql = connection.editSqlCode(sql, khxx.getKhxx_id());
- sql = connection.editSqlCode(sql, khxx.getKhxx_mc());
- sql = connection.editSqlCode(sql, khxx.getKhxx_qyxz());
- sql = connection.editSqlCode(sql, khxx.getKhxx_qylx());
- sql = connection.editSqlCode(sql, khxx.getKhxx_qyzx());
- sql = connection.editSqlCode(sql, khxx.getKhxx_qydz());
- sql = connection.editSqlCode(sql, khxx.getKhxx_szsf());
- sql = connection.editSqlCode(sql, khxx.getKhxx_szcs());
- sql = connection.editSqlCode(sql, khxx.getKhxx_gsyb());
- sql = connection.editSqlCode(sql, khxx.getKhxx_frdb());
- sql = connection.editSqlCode(sql, khxx.getKhxx_khyh());
- sql = connection.editSqlCode(sql, khxx.getKhxx_yhzh());
- sql = connection.editSqlCode(sql, khxx.getKhxx_nsh());
- sql = connection.editSqlCode(sql, khxx.getKhxx_ICcard());
- sql = connection.editSqlCode(sql, khxx.getKhxx_gswz());
- sql = connection.editSqlCode(sql, khxx.getKhxx_gsdh());
- sql = connection.editSqlCode(sql, khxx.getKhxx_gscz());
- sql = connection.editSqlCode(sql, khxx.getKhxx_lxr());
- sql = connection.editSqlCode(sql, khxx.getKhxx_lxrdh());
- sql = connection.editSqlCode(sql, khxx.getKhxx_khjb());
- sql = connection.editSqlCode(sql, khxx.getKhxx_bz());
- connection.executeUpdate(sql);
- connection.close();
- }
- //删除操作
- public void khxxDelete(KhxxForm khxx) {
- String sql = SQLCode.getSQLCode("sql.khxx.delete");
- sql = connection.editSqlCode(sql, khxx.getKhxx_id());
- connection.executeUpdate(sql);
- connection.close();
- }
- //修改操作
- public void khxxUpdate(KhxxForm khxx) {
- String sql = SQLCode.getSQLCode("sql.khxx.update");
- sql = connection.editSqlCode(sql, khxx.getKhxx_mc());
- sql = connection.editSqlCode(sql, khxx.getKhxx_qyxz());
- sql = connection.editSqlCode(sql, khxx.getKhxx_qylx());
- sql = connection.editSqlCode(sql, khxx.getKhxx_qyzx());
- sql = connection.editSqlCode(sql, khxx.getKhxx_qydz());
- sql = connection.editSqlCode(sql, khxx.getKhxx_szsf());
- sql = connection.editSqlCode(sql, khxx.getKhxx_szcs());
- sql = connection.editSqlCode(sql, khxx.getKhxx_gsyb());
- sql = connection.editSqlCode(sql, khxx.getKhxx_frdb());
- sql = connection.editSqlCode(sql, khxx.getKhxx_khyh());
- sql = connection.editSqlCode(sql, khxx.getKhxx_yhzh());
- sql = connection.editSqlCode(sql, khxx.getKhxx_nsh());
- sql = connection.editSqlCode(sql, khxx.getKhxx_ICcard());
- sql = connection.editSqlCode(sql, khxx.getKhxx_gswz());
- sql = connection.editSqlCode(sql, khxx.getKhxx_gsdh());
- sql = connection.editSqlCode(sql, khxx.getKhxx_gscz());
- sql = connection.editSqlCode(sql, khxx.getKhxx_lxr());
- sql = connection.editSqlCode(sql, khxx.getKhxx_lxrdh());
- sql = connection.editSqlCode(sql, khxx.getKhxx_khjb());
- sql = connection.editSqlCode(sql, khxx.getKhxx_bz());
- sql = connection.editSqlCode(sql, khxx.getKhxx_id());
- connection.executeUpdate(sql);
- connection.close();
- }
- //根据客户名称去查询
- public KhxxForm khxxMc(KhxxForm khxx) {
- KhxxForm form = null;
- String sql = SQLCode.getSQLCode("sql.khxx.mc");
- sql = connection.editSqlCode(sql, khxx.getKhxx_mc());
- try {
- ResultSet rs = connection.executeQuery(sql);
- while (rs.next()) {
- form = new KhxxForm();
- form.setKhxx_id(rs.getString(1));
- form.setKhxx_mc(rs.getString(2));
- form.setKhxx_qyxz(rs.getString(3));
- form.setKhxx_qylx(rs.getString(4));
- form.setKhxx_qyzx(rs.getString(5));
- form.setKhxx_qydz(rs.getString(6));
- form.setKhxx_szsf(rs.getString(7));
- form.setKhxx_szcs(rs.getString(8));
- form.setKhxx_gsyb(rs.getString(9));
- form.setKhxx_frdb(rs.getString(10));
- form.setKhxx_khyh(rs.getString(11));
- form.setKhxx_yhzh(rs.getString(12));
- form.setKhxx_nsh(rs.getString(13));
- form.setKhxx_ICcard(rs.getString(14));
- form.setKhxx_gswz(rs.getString(15));
- form.setKhxx_gsdh(rs.getString(16));
- form.setKhxx_gscz(rs.getString(17));
- form.setKhxx_lxr(rs.getString(18));
- form.setKhxx_lxrdh(rs.getString(19));
- form.setKhxx_khjb(rs.getString(20));
- form.setKhxx_bz(rs.getString(21));
- }
- }
- catch (SQLException ex) {
- }
- connection.close();
- return form;
- }
- }