Пример #1
0
 // 判断是否可以插入Apply表(不可以插入当然也不可以在面试中心中申请)
 public boolean canInsert(Staff staff, Integer pid2) {
   // Apply表中是否有重复记录
   Set set = staff.getApplies();
   boolean insert = true; // 判断是否可以插入
   if (set.isEmpty()) { // 说明该面试人未面试任何岗位		
     insert = true;
   } else {
     Iterator iterator = set.iterator();
     while (iterator.hasNext()) {
       Apply apply = (Apply) iterator.next();
       Position position = apply.getPosition();
       // if(position.getPid() == position2.getPid())
       if (position.getPid().equals(pid2)) insert = false;
     }
   }
   return insert;
 }
Пример #2
0
 // 面试中心找到求职中心中所有的岗位
 public String showAllPosition() {
   List<Position> list = positionDAO.findAll();
   // Staff staff = staffDAO.findById(1);//暂时默认该登录的人为1
   // int sid = (Integer) ServletActionContext.getRequest().getSession().getAttribute("sid");
   Staff staff = staffDAO.findById(1);
   int i = 0;
   for (Position position : list) {
     // 判断是否已插入到Apply表
     if (canInsert(staff, position.getPid())) { // 如果还没插入到Apply表中
       map.put(i + "isApply", false);
     } else {
       map.put(i + "isApply", true);
     }
     map.put(i + "", position.getPid());
     map.put(i + "pname", position.getPname());
     map.put(i + "dname", position.getDepartment().getDname());
     map.put(i + "amount", position.getCount());
     map.put(i + "requirement", position.getRequirement());
     map.put(i + "deadline", position.getDeadline());
     i++;
   }
   map.put("length", i);
   return SUCCESS;
 }