예제 #1
0
  /**
   * 功能描述:部门信息保存
   *
   * @throws Exception
   */
  public void save() throws Exception {
    HttpServletRequest request = this.getRequest();
    Integer parentId = ParamUtil.getIntParam(request, "parentId", -1);
    Integer manager = ParamUtil.getIntParam(request, "managerId", -1);
    try {
      if (manager > 0) {
        User user = userManageImpl.get(manager);
        department.setManager(user);
      }

      if (parentId > 0) {
        Department parent = departmentManageImpl.get(parentId);
        department.setParent(parent);

        departmentManageImpl.save(department);
      } else {
        Department parent = new Department();
        parent.setDbid(-1);
        department.setParent(parent);
        departmentManageImpl.save(department);
      }
    } catch (Exception e) {
      e.printStackTrace();
      renderErrorMsg(e, "");
    }
    renderMsg("/department/list", "保存数据成功!");
    return;
  }
예제 #2
0
 public void getDepartmentByDbid() throws Exception {
   HttpServletRequest request = this.getRequest();
   Integer dbid = ParamUtil.getIntParam(request, "dbid", -1);
   if (dbid > 0) {
     JSONObject object = new JSONObject();
     Department department2 = departmentManageImpl.get(dbid);
     if (null != department2) {
       object.put("dbid", department2.getDbid());
       object.put("name", department2.getName());
       object.put("phone", department2.getPhone());
       object.put("fax", department2.getFax());
       if (null != department2.getManager())
         object.put("manager", department2.getManager().getRealName());
       object.put("suqNo", department2.getSuqNo());
       object.put("discription", department2.getDiscription());
       renderJson(object.toString());
     } else {
       renderText("error");
       return;
     }
   } else {
     renderText("error");
     return;
   }
 }
예제 #3
0
 /**
  * 功能描述:添加部门信息
  *
  * @return
  * @throws Exception
  */
 public String edit() throws Exception {
   HttpServletRequest request = this.getRequest();
   Integer dbid = ParamUtil.getIntParam(request, "dbid", -1);
   if (dbid > 0) {
     Department department = departmentManageImpl.get(dbid);
     request.setAttribute("department", department);
   }
   return "edit";
 }
예제 #4
0
 /**
  * 功能描述:删除部门信息
  *
  * @throws Exception
  */
 public void delete() throws Exception {
   HttpServletRequest request = this.getRequest();
   Integer dbid = ParamUtil.getIntParam(request, "dbid", -1);
   try {
     departmentManageImpl.deleteById(dbid);
   } catch (Exception e) {
     e.printStackTrace();
     renderErrorMsg(e, "");
     return;
   }
   renderMsg("", "删除数据成功!");
   return;
 }