Exemplo n.º 1
0
  /**
   * 修改专业信息
   *
   * @param specialty
   * @return
   */
  @RequestMapping("/college/editSpecialty")
  @ResponseBody
  public String editSpecialty(HttpSession session, Specialty specialty) {
    College college = (College) session.getAttribute("user");
    Specialty spec = specialtyService.getByName(specialty.getName(), college);

    if (spec != null) {
      return "isexist";
    }

    return specialtyService.edit(specialty);
  }
Exemplo n.º 2
0
  /**
   * 添加专业
   *
   * @param name
   * @param session
   * @return
   */
  @RequestMapping("/college/addSpec")
  @ResponseBody
  public String addSpec(String name, HttpSession session) {
    College college = (College) session.getAttribute("user");
    Specialty specialty = specialtyService.getByName(name, college);
    if (specialty == null) { // 专业不存在
      // 添加专业
      boolean res = specialtyService.add(name, college);
      return res == true ? "success" : "fail";

    } else { // 专业存在
      return "isexist";
    }
  }