UserGzbwDaoImpl.java
上传用户:quasar007
上传日期:2022-08-11
资源大小:4067k
文件大小:4k
- package com.dao;
- import java.util.List;
- import com.domain.UserGzbwForm;
- import com.tool.JDBConnection;
- import java.util.ArrayList;
- import com.tool.SQLCode;
- import java.sql.ResultSet;
- import java.sql.*;
- /**
- * <p>Title: </p>
- *
- * <p>Description: </p>
- *
- * <p>Copyright: Copyright (c) 2005</p>
- *
- * <p>Company: </p>
- *
- * @author not attributable
- * @version 1.0
- */
- //工作备忘
- public class UserGzbwDaoImpl
- implements UserGzbwDao {
- private JDBConnection connection = new JDBConnection();
- //查询工作备忘记录
- public List userGzbwselect(UserGzbwForm form) {
- List list = new ArrayList();
- UserGzbwForm gzbw = null;
- String sql = SQLCode.getSQLCode("sql.userGzbw.select");
- sql = connection.editSqlCode(sql, form.getGzbw_manager());
- try {
- ResultSet rs = connection.executeQuery(sql);
- while (rs.next()) {
- gzbw = new UserGzbwForm();
- gzbw.setGzbw_id(rs.getString(1));
- gzbw.setGzbw_bt(rs.getString(2));
- gzbw.setGzbw_nr(rs.getString(3));
- gzbw.setGzbw_jsrq(rs.getString(4));
- gzbw.setGzbw_bz(rs.getString(5));
- gzbw.setGzbw_manager(rs.getString(6));
- gzbw.setId(Integer.valueOf(rs.getString(7)));
- list.add(gzbw);
- }
- }
- catch (SQLException ex) {
- }
- connection.close();
- return list;
- }
- //帐号的唯一性
- public int countID() {
- int iCount = 0;
- String sql = SQLCode.getSQLCode("sql.userGzbw.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 userGzbwInsert(UserGzbwForm form) {
- String sql = SQLCode.getSQLCode("sql.userGzbw.insert");
- sql = connection.editSqlCode(sql, form.getGzbw_id());
- sql = connection.editSqlCode(sql, form.getGzbw_bt());
- sql = connection.editSqlCode(sql, form.getGzbw_nr());
- sql = connection.editSqlCode(sql, form.getGzbw_jsrq());
- sql = connection.editSqlCode(sql, form.getGzbw_bz());
- sql = connection.editSqlCode(sql, form.getGzbw_manager());
- connection.executeUpdate(sql);
- connection.close();
- }
- //删除操作
- public void userGzbwDelete(UserGzbwForm form) {
- String sql = SQLCode.getSQLCode("sql.userGzbw.delete");
- sql = connection.editSqlCode(sql, form.getId());
- connection.executeUpdate(sql);
- connection.close();
- }
- //单独查询
- public UserGzbwForm userGzbwSelectOne(UserGzbwForm form) {
- UserGzbwForm gzbw = null;
- String sql = SQLCode.getSQLCode("sql.userGzbw.selectOne");
- sql = connection.editSqlCode(sql, form.getId());
- try {
- ResultSet rs = connection.executeQuery(sql);
- while (rs.next()) {
- gzbw = new UserGzbwForm();
- gzbw.setGzbw_id(rs.getString(1));
- gzbw.setGzbw_bt(rs.getString(2));
- gzbw.setGzbw_nr(rs.getString(3));
- gzbw.setGzbw_jsrq(rs.getString(4));
- gzbw.setGzbw_bz(rs.getString(5));
- gzbw.setGzbw_manager(rs.getString(6));
- gzbw.setId(Integer.valueOf(rs.getString(7)));
- }
- }
- catch (SQLException ex) {
- }
- connection.close();
- return gzbw;
- }
- //修改操作
- public void userGzbwUpdate(UserGzbwForm form) {
- String sql = SQLCode.getSQLCode("sql.userGzbw.update");
- sql = connection.editSqlCode(sql, form.getGzbw_bt());
- sql = connection.editSqlCode(sql, form.getGzbw_nr());
- sql = connection.editSqlCode(sql, form.getGzbw_bz());
- sql = connection.editSqlCode(sql, form.getGzbw_jsrq());
- sql = connection.editSqlCode(sql, form.getId());
- connection.executeUpdate(sql);
- connection.close();
- }
- }