LxrxxDaoImpl.java
上传用户:quasar007
上传日期:2022-08-11
资源大小:4067k
文件大小:5k
- package com.dao;
- import java.util.List;
- import com.tool.JDBConnection;
- import java.util.ArrayList;
- import com.domain.LxrxxForm;
- import com.tool.SQLCode;
- import java.sql.ResultSet;
- import java.sql.*;
- public class LxrxxDaoImpl
- implements LxrxxDao {
- private JDBConnection connection = new JDBConnection();
- // 全部信息查询
- public List select() {
- List list = new ArrayList();
- LxrxxForm form = null;
- String sql = SQLCode.getSQLCode("sql.lxrxx.select");
- try {
- ResultSet rs = connection.executeQuery(sql);
- while (rs.next()) {
- form = new LxrxxForm();
- form.setLxrxx_id(rs.getString(1));
- form.setLxrxx_qymc(rs.getString(2));
- form.setLxrxx_xm(rs.getString(3));
- form.setLxrxx_xb(rs.getString(4));
- form.setLxrxx_csny(rs.getString(5));
- form.setLxrxx_nl(rs.getString(6));
- form.setLxrxx_zw(rs.getString(7));
- form.setLxrxx_bgdh(rs.getString(8));
- form.setLxrxx_Email(rs.getString(9));
- form.setLxrxx_sj(rs.getString(10));
- form.setLxrxx_grjj(rs.getString(11));
- form.setLxrxx_djrq(rs.getString(12));
- form.setLxrxx_xxdjr(rs.getString(13));
- form.setLxrxx_bs(rs.getString(14));
- form.setLxrxx_bz(rs.getString(15));
- form.setId(Integer.valueOf(rs.getString(16)));
- list.add(form);
- }
- }
- catch (SQLException ex) {
- }
- return list;
- }
- public int countID() {
- int iCount = 0;
- String sql = SQLCode.getSQLCode("sql.lxrxx.countID");
- ResultSet rs = null;
- try {
- rs = connection.executeQuery(sql);
- while (rs.next()) {
- iCount = rs.getInt("t");
- }
- }
- catch (SQLException ex) {
- }
- connection.close();
- return iCount + 1;
- }
- //插入操作
- public void insert(LxrxxForm form) {
- String sql = SQLCode.getSQLCode("sql.lxrxx.insert");
- sql = connection.editSqlCode(sql, form.getLxrxx_id());
- sql = connection.editSqlCode(sql, form.getLxrxx_qymc());
- sql = connection.editSqlCode(sql, form.getLxrxx_xm());
- sql = connection.editSqlCode(sql, form.getLxrxx_xb());
- sql = connection.editSqlCode(sql, form.getLxrxx_csny());
- sql = connection.editSqlCode(sql, form.getLxrxx_nl());
- sql = connection.editSqlCode(sql, form.getLxrxx_zw());
- sql = connection.editSqlCode(sql, form.getLxrxx_bgdh());
- sql = connection.editSqlCode(sql, form.getLxrxx_Email());
- sql = connection.editSqlCode(sql, form.getLxrxx_sj());
- sql = connection.editSqlCode(sql, form.getLxrxx_grjj());
- sql = connection.editSqlCode(sql, form.getLxrxx_djrq());
- sql = connection.editSqlCode(sql, form.getLxrxx_xxdjr());
- sql = connection.editSqlCode(sql, form.getLxrxx_bs());
- sql = connection.editSqlCode(sql, form.getLxrxx_bz());
- connection.executeUpdate(sql);
- connection.close();
- }
- //删除操作
- public void delete(LxrxxForm form) {
- String sql = SQLCode.getSQLCode("sql.lxrxx.delete");
- sql = connection.editSqlCode(sql, form.getId());
- connection.executeUpdate(sql);
- connection.close();
- }
- //单独查询操作
- public List selectOne(LxrxxForm form) {
- List list = new ArrayList();
- LxrxxForm lxrxxForm = null;
- String sql = SQLCode.getSQLCode("sql.lxrxx.selectOne");
- sql = connection.editSqlCode(sql, form.getId());
- try {
- ResultSet rs = connection.executeQuery(sql);
- while (rs.next()) {
- lxrxxForm = new LxrxxForm();
- lxrxxForm.setLxrxx_id(rs.getString(1));
- lxrxxForm.setLxrxx_qymc(rs.getString(2));
- lxrxxForm.setLxrxx_xm(rs.getString(3));
- lxrxxForm.setLxrxx_xb(rs.getString(4));
- lxrxxForm.setLxrxx_csny(rs.getString(5));
- lxrxxForm.setLxrxx_nl(rs.getString(6));
- lxrxxForm.setLxrxx_zw(rs.getString(7));
- lxrxxForm.setLxrxx_bgdh(rs.getString(8));
- lxrxxForm.setLxrxx_Email(rs.getString(9));
- lxrxxForm.setLxrxx_sj(rs.getString(10));
- lxrxxForm.setLxrxx_grjj(rs.getString(11));
- lxrxxForm.setLxrxx_djrq(rs.getString(12));
- lxrxxForm.setLxrxx_xxdjr(rs.getString(13));
- lxrxxForm.setLxrxx_bs(rs.getString(14));
- lxrxxForm.setLxrxx_bz(rs.getString(15));
- lxrxxForm.setId(Integer.valueOf(rs.getString(16)));
- list.add(lxrxxForm);
- }
- }
- catch (SQLException ex) {
- }
- return list;
- }
- //修改操作
- public void update(LxrxxForm form) {
- String sql = SQLCode.getSQLCode("sql.lxrxx.update");
- sql = connection.editSqlCode(sql, form.getLxrxx_id());
- sql = connection.editSqlCode(sql, form.getLxrxx_qymc());
- sql = connection.editSqlCode(sql, form.getLxrxx_xm());
- sql = connection.editSqlCode(sql, form.getLxrxx_xb());
- sql = connection.editSqlCode(sql, form.getLxrxx_csny());
- sql = connection.editSqlCode(sql, form.getLxrxx_nl());
- sql = connection.editSqlCode(sql, form.getLxrxx_zw());
- sql = connection.editSqlCode(sql, form.getLxrxx_bgdh());
- sql = connection.editSqlCode(sql, form.getLxrxx_Email());
- sql = connection.editSqlCode(sql, form.getLxrxx_sj());
- sql = connection.editSqlCode(sql, form.getLxrxx_grjj());
- sql = connection.editSqlCode(sql, form.getLxrxx_djrq());
- sql = connection.editSqlCode(sql, form.getLxrxx_xxdjr());
- sql = connection.editSqlCode(sql, form.getLxrxx_bs());
- sql = connection.editSqlCode(sql, form.getLxrxx_bz());
- sql = connection.editSqlCode(sql, form.getId());
- connection.executeUpdate(sql);
- connection.close();
- }
- }