⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 departmentoperate.java~9~

📁 java+sql2000企业人力管理系统
💻 JAVA~9~
📖 第 1 页 / 共 2 页
字号:
            ptmt.setString(17, objE.getHukou());
            ptmt.setString(18, objE.getPostcode());
            ptmt.setString(19, objE.getPolice_Post());
            ptmt.setString(20, objE.getStreet_Office());
            ptmt.setString(21, objE.getHireDate());
            ptmt.setInt(22, objE.getWorking_Years());
            ptmt.setString(23, objE.getPosition());
            ptmt.setString(24, objE.getTitle());
            ptmt.setString(25, objE.getState());
            ptmt.setString(26, objE.getContract_Sign_Date());
            ptmt.setDouble(27, objE.getBase_Wage());
            ptmt.setDouble(28, objE.getBase_Prize());
            ptmt.setString(29, objE.getMemo());
            ptmt.setString(30, objE.getFillin_Person());
            ptmt.setInt(31, objE.getEmp_Id());
            ptmt.executeUpdate();
            ptmt.close();
            con.close();
            return true;
        } catch (Exception ex) {
            ex.printStackTrace();
        }
        return false;
    }

    //添加学员工作经历资料
    public boolean inserExperience(ExperienceBean objB) {
        Connection con = null;
        PreparedStatement ptmt = null;
        String sql =
                "insert into Experience (Id,Emp_Id,Start_Date,End_Date,School_Org,Title)" +
                "values(?,?,?,?,?,?)";
        DBGet objG = new DBGet();
        con = objG.getConnection();
        try {
            ptmt = con.prepareStatement(sql);
            ptmt.setInt(1, objB.getEmp_Id());
            ptmt.setInt(2, objB.getEmp_Id());
            ptmt.setString(3, objB.getStart_Date());
            ptmt.setString(4, objB.getEnd_Date());
            ptmt.setString(5, objB.getSchool_Org());
            ptmt.setString(6, objB.getTitle());
            ptmt.executeUpdate();
            ptmt.close();
            con.close();
            return true;
        } catch (SQLException ex) {
            ex.printStackTrace();
        }
        return false;
    }

//删除职员
    public boolean deleteEmployee(EmployeeBean objE) {
        Connection con = null;
        PreparedStatement ptmt = null;
        String sql = "delete from employees where emp_id=?";
        DBGet objG = new DBGet();
        try {
            con = objG.getConnection();
            ptmt = con.prepareStatement(sql);
            ptmt.setInt(1, objE.getEmp_Id());
            ptmt.executeUpdate();
            ptmt.close();
            con.close();
            return true;
        } catch (SQLException ex) {
            ex.printStackTrace();
        }
        return false;
    }

    //部门调转
    public boolean bumenChange(EmployeeBean objB) {
        Connection con = null;
        PreparedStatement ptmt = null;
        String sql = "update Employees set Dep_id=?,Title=? where emp_id=?";
        DBGet objG = new DBGet();

        try {
            con = objG.getConnection();
            ptmt = con.prepareStatement(sql);
            ptmt.setInt(1, objB.getDep_Id());
            ptmt.setString(2, objB.getTitle());
            ptmt.setInt(3, objB.getEmp_Id());
            ptmt.executeUpdate();
            ptmt.close();
            con.close();
            return true;
        } catch (SQLException ex) {
            ex.printStackTrace();
        }
        return false;
    }

    //删除职员工作学习资料
    public boolean deleteExperience(ExperienceBean objE) {
        Connection con = null;
        PreparedStatement ptmt = null;
        String sql = "delete from experience where id=?";
        DBGet objG = new DBGet();
        try {
            con = objG.getConnection();
            ptmt = con.prepareStatement(sql);
            ptmt.setInt(1, objE.getId());
            ptmt.executeUpdate();
            ptmt.close();
            con.close();
            return true;
        } catch (SQLException ex) {
            ex.printStackTrace();
        }
        return false;
    }

    //修改学习资料
    public boolean updateExperience(ExperienceBean objE) {
        Connection con = null;
        PreparedStatement ptmt = null;
        String sql =
                "update experience set Start_Date=?,End_Date=?,School_Org=?,Title=? where id=?";
        DBGet objG = new DBGet();
        con = objG.getConnection();
        try {
            ptmt = con.prepareStatement(sql);
            ptmt.setString(1, objE.getStart_Date());
            ptmt.setString(2, objE.getEnd_Date());
            ptmt.setString(3, objE.getSchool_Org());
            ptmt.setString(4, objE.getTitle());
            ptmt.setInt(5, objE.getId());
            ptmt.executeUpdate();
            ptmt.close();
            con.close();
            return true;
        } catch (Exception ex) {
            ex.printStackTrace();
        }
        return false;
    }

    /**
     * 根据用户的查询条件查询方法
     */
    public Vector getEmployeesByCondition(SearchBean objB) {
        Vector data = new Vector();
        Connection con = null;
        PreparedStatement ptmt = null;
        ResultSet rs = null;
        String condition = "";
        DBGet objG = new DBGet();
        // 如果查询Bean中包含有某个条件,则将它添加到查询条件语句中

        int emp_id = objB.getEmp_id();

            condition += " and Emp_Id = " + emp_id + " ";

            String name = objB.getName();
            if (!name.equals("")) {
                condition += " or Emp_NAME like '%" + name + "%'";
            }
            String position = objB.getPosition();
            if (!position.equals("")) {
                condition += " or Position like '%" + position + "%'";
            }
            String title = objB.getTitle();
            if (!title.equals("")) {
                condition += " or Title like '%" + title + "%'";
            }

            String strSQL = "select * from employees where 1=1 " + condition;
            try {
                con = objG.getConnection();
                ptmt = con.prepareStatement(strSQL);
                rs = ptmt.executeQuery();
                while (rs.next()) {
                    // 把结果集中的记录信息读出,并写入到data中
                    data.add(new Integer(rs.getInt(1)));
                    for (int i = 2; i <= 22; i++) {
                        data.add(rs.getString(i));
                    }
                    data.add(new Integer(rs.getInt(23)));
                    data.add(new Integer(rs.getInt(24)));
                    data.add(rs.getString(25));
                    data.add(rs.getString(26));
                    data.add(rs.getString(27));

                    data.add(rs.getString(28));
                    data.add(new Integer(rs.getInt(29)));
                    data.add(new Integer(rs.getInt(30)));
                    data.add(rs.getString(31));
                    data.add(rs.getString(32));
                    data.add(rs.getString(33));

                }
                rs.close();
                ptmt.close();
                con.close();
            } catch (Exception ex) {
                ex.printStackTrace();
            }
            return data;
    }

    private void jbInit() throws Exception {
    }

}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -