---
title: "3.3 分部、部门浏览按钮自定义查询"
docId: "405545687795630080"
source: "https://weapp.eteams.cn/build/techdoc/wdoc/index.html#/public/repository/91f5067f-775e-48f4-93a2-ce84ca0b9c2e/doc/405545687795630080"
---
### 1. 入参拦截

- 二开标识
  
  ```java
  二开标识：HRM_DEPARTMENT_002
  ```
  
    - 入参说明（Map<String, Object>，从request中获取 params）
      
      | 参数 | 类型 | 说明 |
      | --- | --- | --- |
      | params | Map<String, Object> | 查询参数 |
    - 出参说明，在result中提供 params；内容是想自定义查询的sql片段
- 示例
  
  ```java
   @Override
      public WeaHookResponse handle(WeaHookRequest request, WeaHookResponse response, AppInfo appInfo) throws Exception {
          Map<String, Object> params = request.getParams();
          ObjectMapper objectMapper = new ObjectMapper();
          Map<String, Object> resultMap = objectMapper.convertValue(
                  params.get("result"), new TypeReference<Map<String, Object>>() {
                  }
          );
  
          HashMap<Object, Object> result = new HashMap<>();
  
          Map<String, Object> paramsMap = (Map<String, Object>) resultMap.get("params");
  
  
          String sql = "" ;
          String cz = (String) querySingleValue(sql);
          if (StringUtils.isNotEmpty(cz)) {
              List<Map<String, Object>> resultData = new ArrayList<>();
              List<String> list = Arrays.asList(cz.split(","));
              result.put("customSql", " id not in (" + String.join(",", list) + ")");
          }
  
          response.setResult(ImmutableMapUtil.of("result", result));
          return response;
      }
  ```
