/** * 修改用户锁定标识 * * @return */ @Action( value = "updateLockFlag", results = { @Result( type = "json", params = {"root", "entityMap", "contentType", "text/html"}) }) public String updateLockFlag() { try { entityMap = new HashMap<String, Object>(); // 多个id以逗号分隔 String Ids = request.getParameter("userId"); logger.info("update user's id: " + Ids); String[] deleteIds = Ids.split(","); if (0 <= Arrays.binarySearch(deleteIds, "" + users.getId())) { // 如果修改的包含自己,将自己的id从修改列表里清除 List<String> list = new ArrayList<String>(); for (String dId : deleteIds) list.add(dId); list.remove("" + users.getId()); deleteIds = (String[]) list.toArray(new String[list.size()]); } Long[] deleteIdLongs = ConvertUtil.arrStringToLong(deleteIds); for (Long id : deleteIdLongs) { System.out.println("update sql -->" + id); UserVO userVO = new UserVO(); userVO.setId(id); userVO.setLockFlag(0); userVO.setActiveFlag(1); userService.update(userVO); } entityMap.put("message", "解锁成功!"); } catch (Exception e) { logger.error("update user error", e); } return SUCCESS; }
/** * 删除用户(含删除多个用户情况) * * @return */ @Action( value = "deleteUser", results = { @Result( type = "json", params = {"root", "entityMap", "contentType", "text/html"}) }) public String deleteUser() { try { entityMap = new HashMap<String, Object>(); // 多个id以逗号分隔 String Ids = request.getParameter("userId"); logger.info("delete user's id: " + Ids); String[] deleteIds = Ids.split(","); if (0 <= Arrays.binarySearch(deleteIds, "" + users.getId())) { // 如果删除的包含自己,将自己的id从删除列表里清除 List<String> list = new ArrayList<String>(); for (String dId : deleteIds) list.add(dId); list.remove("" + users.getId()); deleteIds = (String[]) list.toArray(new String[list.size()]); } Long[] deleteIdLongs = ConvertUtil.arrStringToLong(deleteIds); for (Long id : deleteIdLongs) { logger.info("delete portal_user -->" + id); } userService.deleteUser(deleteIdLongs); for (Long id : deleteIdLongs) { logger.info("delete portal_user_ext -->" + id); portalUserExtService.delete(id); } } catch (Exception e) { logger.error("delete user error", e); } return SUCCESS; }