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

企业管理

开发平台:

Java

  1. package com.dao;
  2. import java.util.List;
  3. import com.tool.JDBConnection;
  4. import java.util.ArrayList;
  5. import com.domain.LxrxxForm;
  6. import com.tool.SQLCode;
  7. import java.sql.ResultSet;
  8. import java.sql.*;
  9. public class LxrxxDaoImpl
  10.     implements LxrxxDao {
  11.   private JDBConnection connection = new JDBConnection();
  12. // 全部信息查询
  13.   public List select() {
  14.     List list = new ArrayList();
  15.     LxrxxForm form = null;
  16.     String sql = SQLCode.getSQLCode("sql.lxrxx.select");
  17.     try {
  18.       ResultSet rs = connection.executeQuery(sql);
  19.       while (rs.next()) {
  20.         form = new LxrxxForm();
  21.         form.setLxrxx_id(rs.getString(1));
  22.         form.setLxrxx_qymc(rs.getString(2));
  23.         form.setLxrxx_xm(rs.getString(3));
  24.         form.setLxrxx_xb(rs.getString(4));
  25.         form.setLxrxx_csny(rs.getString(5));
  26.         form.setLxrxx_nl(rs.getString(6));
  27.         form.setLxrxx_zw(rs.getString(7));
  28.         form.setLxrxx_bgdh(rs.getString(8));
  29.         form.setLxrxx_Email(rs.getString(9));
  30.         form.setLxrxx_sj(rs.getString(10));
  31.         form.setLxrxx_grjj(rs.getString(11));
  32.         form.setLxrxx_djrq(rs.getString(12));
  33.         form.setLxrxx_xxdjr(rs.getString(13));
  34.         form.setLxrxx_bs(rs.getString(14));
  35.         form.setLxrxx_bz(rs.getString(15));
  36.         form.setId(Integer.valueOf(rs.getString(16)));
  37.         list.add(form);
  38.       }
  39.     }
  40.     catch (SQLException ex) {
  41.     }
  42.     return list;
  43.   }
  44.   public int countID() {
  45.     int iCount = 0;
  46.     String sql = SQLCode.getSQLCode("sql.lxrxx.countID");
  47.     ResultSet rs = null;
  48.     try {
  49.       rs = connection.executeQuery(sql);
  50.       while (rs.next()) {
  51.         iCount = rs.getInt("t");
  52.       }
  53.     }
  54.     catch (SQLException ex) {
  55.     }
  56.     connection.close();
  57.     return iCount + 1;
  58.   }
  59. //插入操作
  60.   public void insert(LxrxxForm form) {
  61.     String sql = SQLCode.getSQLCode("sql.lxrxx.insert");
  62.     sql = connection.editSqlCode(sql, form.getLxrxx_id());
  63.     sql = connection.editSqlCode(sql, form.getLxrxx_qymc());
  64.     sql = connection.editSqlCode(sql, form.getLxrxx_xm());
  65.     sql = connection.editSqlCode(sql, form.getLxrxx_xb());
  66.     sql = connection.editSqlCode(sql, form.getLxrxx_csny());
  67.     sql = connection.editSqlCode(sql, form.getLxrxx_nl());
  68.     sql = connection.editSqlCode(sql, form.getLxrxx_zw());
  69.     sql = connection.editSqlCode(sql, form.getLxrxx_bgdh());
  70.     sql = connection.editSqlCode(sql, form.getLxrxx_Email());
  71.     sql = connection.editSqlCode(sql, form.getLxrxx_sj());
  72.     sql = connection.editSqlCode(sql, form.getLxrxx_grjj());
  73.     sql = connection.editSqlCode(sql, form.getLxrxx_djrq());
  74.     sql = connection.editSqlCode(sql, form.getLxrxx_xxdjr());
  75.     sql = connection.editSqlCode(sql, form.getLxrxx_bs());
  76.     sql = connection.editSqlCode(sql, form.getLxrxx_bz());
  77.     connection.executeUpdate(sql);
  78.     connection.close();
  79.   }
  80.   //删除操作
  81.   public void delete(LxrxxForm form) {
  82.     String sql = SQLCode.getSQLCode("sql.lxrxx.delete");
  83.     sql = connection.editSqlCode(sql, form.getId());
  84.     connection.executeUpdate(sql);
  85.     connection.close();
  86.   }
  87. //单独查询操作
  88.   public List selectOne(LxrxxForm form) {
  89.     List list = new ArrayList();
  90.     LxrxxForm lxrxxForm = null;
  91.     String sql = SQLCode.getSQLCode("sql.lxrxx.selectOne");
  92.     sql = connection.editSqlCode(sql, form.getId());
  93.     try {
  94.       ResultSet rs = connection.executeQuery(sql);
  95.       while (rs.next()) {
  96.         lxrxxForm = new LxrxxForm();
  97.         lxrxxForm.setLxrxx_id(rs.getString(1));
  98.         lxrxxForm.setLxrxx_qymc(rs.getString(2));
  99.         lxrxxForm.setLxrxx_xm(rs.getString(3));
  100.         lxrxxForm.setLxrxx_xb(rs.getString(4));
  101.         lxrxxForm.setLxrxx_csny(rs.getString(5));
  102.         lxrxxForm.setLxrxx_nl(rs.getString(6));
  103.         lxrxxForm.setLxrxx_zw(rs.getString(7));
  104.         lxrxxForm.setLxrxx_bgdh(rs.getString(8));
  105.         lxrxxForm.setLxrxx_Email(rs.getString(9));
  106.         lxrxxForm.setLxrxx_sj(rs.getString(10));
  107.         lxrxxForm.setLxrxx_grjj(rs.getString(11));
  108.         lxrxxForm.setLxrxx_djrq(rs.getString(12));
  109.         lxrxxForm.setLxrxx_xxdjr(rs.getString(13));
  110.         lxrxxForm.setLxrxx_bs(rs.getString(14));
  111.         lxrxxForm.setLxrxx_bz(rs.getString(15));
  112.         lxrxxForm.setId(Integer.valueOf(rs.getString(16)));
  113.         list.add(lxrxxForm);
  114.       }
  115.     }
  116.     catch (SQLException ex) {
  117.     }
  118.     return list;
  119.   }
  120. //修改操作
  121.   public void update(LxrxxForm form) {
  122.     String sql = SQLCode.getSQLCode("sql.lxrxx.update");
  123.     sql = connection.editSqlCode(sql, form.getLxrxx_id());
  124.     sql = connection.editSqlCode(sql, form.getLxrxx_qymc());
  125.     sql = connection.editSqlCode(sql, form.getLxrxx_xm());
  126.     sql = connection.editSqlCode(sql, form.getLxrxx_xb());
  127.     sql = connection.editSqlCode(sql, form.getLxrxx_csny());
  128.     sql = connection.editSqlCode(sql, form.getLxrxx_nl());
  129.     sql = connection.editSqlCode(sql, form.getLxrxx_zw());
  130.     sql = connection.editSqlCode(sql, form.getLxrxx_bgdh());
  131.     sql = connection.editSqlCode(sql, form.getLxrxx_Email());
  132.     sql = connection.editSqlCode(sql, form.getLxrxx_sj());
  133.     sql = connection.editSqlCode(sql, form.getLxrxx_grjj());
  134.     sql = connection.editSqlCode(sql, form.getLxrxx_djrq());
  135.     sql = connection.editSqlCode(sql, form.getLxrxx_xxdjr());
  136.     sql = connection.editSqlCode(sql, form.getLxrxx_bs());
  137.     sql = connection.editSqlCode(sql, form.getLxrxx_bz());
  138.     sql = connection.editSqlCode(sql, form.getId());
  139.     connection.executeUpdate(sql);
  140.     connection.close();
  141.   }
  142. }