Example #1
0
 public int employeeCount(Connection con, Employee employee, String bbirthday, String ebirthday)
     throws Exception {
   StringBuffer sb =
       new StringBuffer(
           "select count(*) as total from t_employee s,t_department g where s.departmentId=g.departmentId");
   if (employee != null && !StringUtil.isEmpty(employee.getEmployeeNo())) {
     sb.append(" and s.employeeNo like '%" + employee.getEmployeeNo() + "%'");
   }
   if (employee != null && !StringUtil.isEmpty(employee.getName())) {
     sb.append(" and s.name like '%" + employee.getName() + "%'");
   }
   if (employee != null && !StringUtil.isEmpty(employee.getSex())) {
     sb.append(" and s.sex = '" + employee.getSex() + "'");
   }
   if (employee != null && !StringUtil.isEmpty(employee.getNationality())) {
     sb.append(" and s.nationality like '%" + employee.getNationality() + "%'");
   }
   if (employee != null && !StringUtil.isEmpty(employee.getEducation())) {
     sb.append(" and s.education like '%" + employee.getEducation() + "%'");
   }
   if (employee != null && !StringUtil.isEmpty(employee.getPosition())) {
     sb.append(" and s.position like '%" + employee.getPosition() + "%'");
   }
   if (employee != null && !StringUtil.isEmpty(employee.getEducation())) {
     sb.append(" and s.education like '%" + employee.getEducation() + "%'");
   }
   if (employee.getDepartmentId() != -1) {
     sb.append(" and s.departmentId ='" + employee.getDepartmentId() + "'");
   }
   if (StringUtil.isNotEmpty(bbirthday)) {
     sb.append(" and TO_DAYS(s.birthday)>=TO_DAYS('" + bbirthday + "')");
   }
   if (StringUtil.isNotEmpty(ebirthday)) {
     sb.append(" and TO_DAYS(s.birthday)<=TO_DAYS('" + ebirthday + "')");
   }
   PreparedStatement pstmt = con.prepareStatement(sb.toString());
   ResultSet rs = pstmt.executeQuery();
   if (rs.next()) {
     return rs.getInt("total");
   } else {
     return 0;
   }
 }
Example #2
0
 public ResultSet employeeList(
     Connection con, PageBean pageBean, Employee employee, String bbirthday, String ebirthday)
     throws Exception {
   StringBuffer sb =
       new StringBuffer(
           "select * from t_employee s,t_department g where s.departmentId=g.departmentId");
   if (employee != null && !StringUtil.isEmpty(employee.getEmployeeNo())) {
     sb.append(" and s.employeeNo like '%" + employee.getEmployeeNo() + "%'");
   }
   if (employee != null && !StringUtil.isEmpty(employee.getName())) {
     sb.append(" and s.name like '%" + employee.getName() + "%'");
   }
   if (employee != null && !StringUtil.isEmpty(employee.getSex())) {
     sb.append(" and s.sex = '" + employee.getSex() + "'");
   }
   if (employee != null && !StringUtil.isEmpty(employee.getNationality())) {
     sb.append(" and s.nationality like '%" + employee.getNationality() + "%'");
   }
   if (employee != null && !StringUtil.isEmpty(employee.getEducation())) {
     sb.append(" and s.education like '%" + employee.getEducation() + "%'");
   }
   if (employee != null && !StringUtil.isEmpty(employee.getPosition())) {
     sb.append(" and s.position like '%" + employee.getPosition() + "%'");
   }
   if (employee != null && !StringUtil.isEmpty(employee.getEducation())) {
     sb.append(" and s.education like '%" + employee.getEducation() + "%'");
   }
   if (employee.getDepartmentId() != -1) {
     sb.append(" and s.departmentId ='" + employee.getDepartmentId() + "'");
   }
   if (StringUtil.isNotEmpty(bbirthday)) {
     sb.append(" and TO_DAYS(s.birthday)>=TO_DAYS('" + bbirthday + "')");
   }
   if (StringUtil.isNotEmpty(ebirthday)) {
     sb.append(" and TO_DAYS(s.birthday)<=TO_DAYS('" + ebirthday + "')");
   }
   if (pageBean != null) {
     sb.append(" limit " + pageBean.getStart() + "," + pageBean.getRows());
   }
   PreparedStatement pstmt = con.prepareStatement(sb.toString());
   return pstmt.executeQuery();
 }