Exemplo n.º 1
0
 public int employeeAdd(Connection con, Employee employee) throws Exception {
   String sql = "insert into t_employee values(null,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?)";
   PreparedStatement pstmt = con.prepareStatement(sql);
   pstmt.setString(1, employee.getEmployeeNo());
   pstmt.setString(2, employee.getName());
   pstmt.setString(3, employee.getSex());
   pstmt.setString(4, DateUtil.formatDate(employee.getBirthday(), "yyyy-MM-dd"));
   pstmt.setString(5, employee.getNationality());
   pstmt.setString(6, employee.getEducation());
   pstmt.setString(7, employee.getProfession());
   pstmt.setInt(8, employee.getDepartmentId());
   pstmt.setString(9, employee.getPosition());
   pstmt.setFloat(10, employee.getBaseMoney());
   pstmt.setFloat(11, employee.getOvertime());
   pstmt.setFloat(12, employee.getAge());
   pstmt.setFloat(13, employee.getCheck1());
   pstmt.setFloat(14, employee.getAbsent());
   pstmt.setFloat(15, employee.getSafety());
   return pstmt.executeUpdate();
 }
Exemplo n.º 2
0
 public int employeeModify(Connection con, Employee employee) throws Exception {
   String sql =
       "update t_employee set employeeNo=?,name=?,sex=?,birthday=?,nationality=?,education=?,profession=?,departmentId=?,position=?,baseMoney=?,overtime=?,age=?,check1=?,absent=?,safety=? where employeeId=?";
   PreparedStatement pstmt = con.prepareStatement(sql);
   pstmt.setString(1, employee.getEmployeeNo());
   pstmt.setString(2, employee.getName());
   pstmt.setString(3, employee.getSex());
   pstmt.setString(4, DateUtil.formatDate(employee.getBirthday(), "yyyy-MM-dd"));
   pstmt.setString(5, employee.getNationality());
   pstmt.setString(6, employee.getEducation());
   pstmt.setString(7, employee.getProfession());
   pstmt.setInt(8, employee.getDepartmentId());
   pstmt.setString(9, employee.getPosition());
   pstmt.setFloat(10, employee.getBaseMoney());
   pstmt.setFloat(11, employee.getOvertime());
   pstmt.setFloat(12, employee.getAge());
   pstmt.setFloat(13, employee.getCheck1());
   pstmt.setFloat(14, employee.getAbsent());
   pstmt.setFloat(15, employee.getSafety());
   pstmt.setInt(16, employee.getEmployeeId());
   return pstmt.executeUpdate();
 }