/**
   * @param request
   * @param sEcho
   * @param iDisplayStart
   * @param iDisplayLength
   * @param iTotalRows
   * @param sAction
   * @param sGroupActionName
   * @return 角色列表.
   */
  @RequestMapping("/getUserAccountList")
  @ResponseBody
  public Map<String, Object> getUserAccountList(
      HttpServletRequest request,
      String sEcho,
      String iDisplayStart,
      String iDisplayLength,
      String iTotalRows,
      String sAction,
      String sGroupActionName) {
    Map<String, Object> data = new HashMap<String, Object>();
    Map<String, Object> map = new HashMap<String, Object>();
    if (StringUtils.isNotEmpty(sAction)) {
      // 提交
      if (DTConstants.GROUP_ACTION.equals(sAction)) {
        // 获取选中的记录id
        String idArray = request.getParameter("idArarry");
        if (idArray != null) {
          // 分割为id数组
          String[] idStrs = idArray.split(",");
          List<Integer> usbaIds = new ArrayList<Integer>();
          for (String idStr : idStrs) {
            usbaIds.add(Integer.parseInt(idStr));
          }

          if (StringUtils.equals("start", sGroupActionName)) { // 启用
            try {
              int num =
                  adminManageUserAccountService.updateUserBasicEnableByUsbaIds(
                      usbaIds, StatusConstants.OPEN);
              data.put("sStatus", "OK");
              data.put("sMessage", num + "条记录已启用");
            } catch (Exception e) {
              e.printStackTrace();
              data.put("sMessage", "启用失败,请重试...");
            }
          } else if (StringUtils.equals("disable", sGroupActionName)) { // 禁用
            try {
              int num =
                  adminManageUserAccountService.updateUserBasicEnableByUsbaIds(
                      usbaIds, StatusConstants.CLOSE);
              data.put("sStatus", "OK");
              data.put("sMessage", num + "条记录已禁用");
            } catch (Exception e) {
              e.printStackTrace();
              data.put("sMessage", "禁用失败,请重试...");
            }
          } else if (sGroupActionName.equals("delete")) { // 删除
            try {
              int num = adminManageUserAccountService.removeUserBasicByUsbaId(usbaIds);
              data.put("sStatus", "OK");
              data.put("sMessage", num + "条记录已删除");
            } catch (Exception e) {
              e.printStackTrace();
              data.put("sMessage", "删除失败,请重试...");
            }
          }
        }
      }
      // 筛选
      else if (DTConstants.FILTER_ACTION.equals(sAction)) {
        // 接收前台datatables的筛选条件.

        String depaName = request.getParameter("depa_name").trim();
        String tebaNo = request.getParameter("teba_no").trim();
        String tebaName = request.getParameter("teba_name").trim();
        String tebaProfessionalTitle = request.getParameter("teba_professional_title").trim();
        String tebaDegree = request.getParameter("teba_degree").trim();
        String tebaPosition = request.getParameter("teba_position").trim();
        String tebaAccountLocked = request.getParameter("teba_account_locked").trim();
        String tebaAccountEnable = request.getParameter("teba_account_enable").trim();
        String tebaAttribute4 = request.getParameter("teba_attribute_4").trim();
        if (StringUtils.isNotEmpty(depaName)) {
          map.put("depaName", depaName);
        }
        if (StringUtils.isNotEmpty(tebaNo)) {
          map.put("tebaNo", tebaNo);
        }
        if (StringUtils.isNotEmpty(tebaName)) {
          map.put("tebaName", tebaName);
        }
        if (StringUtils.isNotEmpty(tebaProfessionalTitle)) {
          map.put("tebaProfessionalTitle", tebaProfessionalTitle);
        }
        if (StringUtils.isNotEmpty(tebaDegree)) {
          map.put("tebaDegree", tebaDegree);
        }
        if (StringUtils.isNotEmpty(tebaPosition)) {
          map.put("tebaPosition", tebaPosition);
        }
        if (StringUtils.isNotEmpty(tebaAccountLocked)) {
          map.put("tebaAccountLocked", Byte.parseByte(tebaAccountLocked));
        }
        if (StringUtils.isNotEmpty(tebaAccountEnable)) {
          map.put("tebaAccountEnable", Byte.parseByte(tebaAccountEnable));
        }
        if (StringUtils.isNotEmpty(tebaAttribute4)) {
          map.put("tebaAttribute4", tebaAttribute4);
        }
      }
    }
    PageContext pageContext = PageUtil.setPageArgs(iDisplayStart, iDisplayLength, iTotalRows);
    List<Map<String, Object>> list = adminManageUserAccountService.getUserAccountList(map);
    data.put(DTConstants.ECHO, sEcho);
    data.put(DTConstants.TOTAL_RECORDS, pageContext.getTotalRows());
    data.put(DTConstants.TOTAL_DISPLAY_RECORDS, pageContext.getTotalRows());
    data.put(DTConstants.DATA, list);
    return data;
  }
Пример #2
0
  /**
   * @param request
   * @param sEcho
   * @param iDisplayStart
   * @param iDisplayLength
   * @param iTotalRows
   * @param sAction
   * @param sGroupActionName
   * @return 部门列表.
   */
  @RequestMapping("/getDepartmentList")
  @ResponseBody
  @ControllerLogAnnotation(description = "查询用户")
  public Map<String, Object> getDepartmentList(
      HttpServletRequest request,
      String sEcho,
      String iDisplayStart,
      String iDisplayLength,
      String iTotalRows,
      String sAction,
      String sGroupActionName) {
    Map<String, Object> data = new HashMap<String, Object>();
    Map<String, Object> map = new HashMap<String, Object>();
    if (StringUtils.isNotEmpty(sAction)) {
      // 提交
      if (DTConstants.GROUP_ACTION.equals(sAction)) {
        // 获取选中的记录id
        String idArray = request.getParameter("idArarry");
        if (idArray != null) {
          // 分割为id数组
          String[] idStrs = idArray.split(",");
          List<Integer> depaIds = new ArrayList<Integer>();
          for (String idStr : idStrs) {
            depaIds.add(Integer.parseInt(idStr));
          }
          if (sGroupActionName.equals("delete")) {
            int upNum = adminDepartmentService.batchDeleteDepartment(depaIds);
            if (upNum > 0) {
              data.put("sStatus", "OK");
              data.put("sMessage", upNum + "条记录已被删除");
            }
          }
        }
      }
      // 筛选
      else if (DTConstants.FILTER_ACTION.equals(sAction)) {
        // 接收前台datatables的筛选条件.

        String depaName = request.getParameter("depa_name").trim();
        String depaNo = request.getParameter("depa_no").trim();
        String gradGradeName = request.getParameter("grad_grade_name").trim();
        String parentDepaName = request.getParameter("parent_depa_name").trim();
        String parentDepaNo = request.getParameter("parent_depa_no").trim();
        if (StringUtils.isNotEmpty(depaName)) {
          map.put("depaName", depaName);
        }
        if (StringUtils.isNotEmpty(depaNo)) {
          map.put("depaNo", depaNo);
        }
        if (StringUtils.isNotEmpty(gradGradeName)) {
          map.put("gradGradeName", gradGradeName);
        }
        if (StringUtils.isNotEmpty(parentDepaName)) {
          map.put("parentDepaName", parentDepaName);
        }
        if (StringUtils.isNotEmpty(parentDepaNo)) {
          map.put("parentDepaNo", parentDepaNo);
        }
      }
    }
    PageContext pageContext = PageUtil.setPageArgs(iDisplayStart, iDisplayLength, iTotalRows);
    List<Map<String, Object>> list = adminDepartmentService.getDepartmentList(map);
    data.put(DTConstants.ECHO, sEcho);
    data.put(DTConstants.TOTAL_RECORDS, pageContext.getTotalRows());
    data.put(DTConstants.TOTAL_DISPLAY_RECORDS, pageContext.getTotalRows());
    data.put(DTConstants.DATA, list);
    return data;
  }