Exemplo n.º 1
0
  public String queryByNo(Object formBean, ControllerContext ctx) throws SQLException {
    StudentSetAction bean = (StudentSetAction) formBean;
    Student student = new Student();
    student.setStudentNo(bean.getStudentNo());
    student.setId(bean.getId());
    List<Student> students = studentDao.getStudentAnd(student);

    if (bean.getAddType() == 1) {
      if (bean.getStudentNo() == "") {

        ctx.getRequest().setAttribute(RET_CODE, RC_NOELEMENT);
        return ERROR_EMPTY;
      } else if (students.size() == 0) {

        ctx.getRequest().setAttribute(RET_CODE, RC_FAILURE);

        return ERROR_FIND;
      }

      ctx.setModel(students.get(0));
      return SUCCESS_GET;
    } else {
      if (bean.getStudentNo() == "") {

        ctx.getRequest().setAttribute(RET_CODE, RC_NOELEMENT);
        return ERROR_EMPTY_G;
      } else if (students.size() == 0) {

        ctx.getRequest().setAttribute(RET_CODE, RC_FAILURE);

        return ERROR_FIND_G;
      }

      ctx.getRequest().setAttribute(TEMI, students.get(0).getStudentNo());
      RewardPunish rewardPunish = rewardPunishDao.getRewardPunishById(bean.getRpId());

      ctx.setModel(rewardPunish);
      ctx.getRequest().setAttribute(TEM, bean.getSetTime());

      // ctx.setModel(rewardPunish);
      // ctx.getRequest().setAttribute(TEM, bean.getSetTime());
      return SUCCESS_GET_GROUP;
    }
  }
Exemplo n.º 2
0
  public String getStudentInfoForDayManage(Object formBean, ControllerContext ctx)
      throws SQLException {
    StudentSetAction bean = (StudentSetAction) formBean;
    Student student = studentDao.getStudentById(bean.getId()); // 获得该学生

    StudentDorm studentDorm = new StudentDorm();
    studentDorm.setStudentId(student.getId());
    studentDorm.setState(StudentDorm.LIVING);
    Dorm dorm = new Dorm();
    Pavilion pavilion = new Pavilion();
    List<StudentDorm> studentDorms = studentDormDao.getStudentDormAnd(studentDorm);
    if (studentDorms.size() != 0) {
      studentDorm = studentDorms.get(0); // 获得该学生所在宿舍记录
      dorm = dormDao.getDormById(studentDorm.getDormId()); // 获得所在宿舍
      pavilion = pavilionDao.getPavilionById(dorm.getPavilionId()); // 获得所在宿舍楼
    }

    bean.setDorm(dorm);
    bean.setPavilion(pavilion);
    bean.setStudent(student);
    return SUCCESS_GET_FOR_DM;
  }