人员查询按操作员部门筛选
diff --git a/src/main/java/com/supwisdom/dlpay/customer/bean/CustomerSearchBean.java b/src/main/java/com/supwisdom/dlpay/customer/bean/CustomerSearchBean.java
index ee53c17..54ca392 100644
--- a/src/main/java/com/supwisdom/dlpay/customer/bean/CustomerSearchBean.java
+++ b/src/main/java/com/supwisdom/dlpay/customer/bean/CustomerSearchBean.java
@@ -5,6 +5,7 @@
 public class CustomerSearchBean extends PageBean {
     private String custname;
     private String checkstatus;
+    private String deptcode;
 
     public String getCustname() {
         return custname;
@@ -14,6 +15,14 @@
         this.custname = custname;
     }
 
+    public String getDeptcode() {
+        return deptcode;
+    }
+
+    public void setDeptcode(String deptcode) {
+        this.deptcode = deptcode;
+    }
+
     public String getCheckstatus() {
         return checkstatus;
     }
diff --git a/src/main/java/com/supwisdom/dlpay/customer/controller/CustomerController.java b/src/main/java/com/supwisdom/dlpay/customer/controller/CustomerController.java
index ef6727c..bd11ebf 100644
--- a/src/main/java/com/supwisdom/dlpay/customer/controller/CustomerController.java
+++ b/src/main/java/com/supwisdom/dlpay/customer/controller/CustomerController.java
@@ -12,6 +12,7 @@
 import com.supwisdom.dlpay.framework.domain.TOperator;
 import com.supwisdom.dlpay.framework.util.DateUtil;
 import com.supwisdom.dlpay.framework.util.PageResult;
+import com.supwisdom.dlpay.framework.util.StringUtil;
 import com.supwisdom.dlpay.framework.util.WebConstant;
 import com.supwisdom.dlpay.mainservice.service.WebInterfaceService;
 import com.supwisdom.dlpay.paysdk.proxy.UserProxy;
@@ -55,7 +56,8 @@
     @ResponseBody
     public PageResult<TCustomerInfo> getDataList(@RequestParam("page") Integer pageNo,
                                                  @RequestParam("limit") Integer pageSize,
-                                                 @RequestParam(value = "searchkey", required = false) String searchKey) {
+                                                 @RequestParam(value = "searchkey", required = false) String searchKey,
+                                                 @AuthenticationPrincipal TOperator operUser) {
         try {
             if (null == pageNo || pageNo < 1) pageNo = WebConstant.PAGENO_DEFAULT;
             if (null == pageSize || pageSize < 1) pageSize = WebConstant.PAGESIZE_DEFAULT;
@@ -63,6 +65,11 @@
             searchBean.setPageNo(pageNo);
             searchBean.setCustname(searchKey);
             searchBean.setPageSize(pageSize);
+            String deptcode=operUser.getDeptcode();
+            if(!StringUtil.isEmpty(deptcode)){
+                searchBean.setDeptcode(deptcode);
+            }
+
             PageResult<TCustomerInfo> bean= webInterfaceService.getCustomerInfoPage(searchBean);
 
             return bean;
diff --git a/src/main/java/com/supwisdom/dlpay/mainservice/dao/impl/CustomerDaoImpl.java b/src/main/java/com/supwisdom/dlpay/mainservice/dao/impl/CustomerDaoImpl.java
index 2e7c8de..6894c2f 100644
--- a/src/main/java/com/supwisdom/dlpay/mainservice/dao/impl/CustomerDaoImpl.java
+++ b/src/main/java/com/supwisdom/dlpay/mainservice/dao/impl/CustomerDaoImpl.java
@@ -6,6 +6,7 @@
 import com.supwisdom.dlpay.framework.util.StringUtil;

 import com.supwisdom.dlpay.mainservice.dao.CustomerDao;

 import com.supwisdom.dlpay.mainservice.domain.TCustomer;

+import org.apache.commons.lang3.StringUtils;

 import org.hibernate.query.internal.NativeQueryImpl;

 import org.hibernate.transform.Transformers;

 import org.springframework.stereotype.Repository;

@@ -97,6 +98,18 @@
     @Override

     public PageResult<TCustomerInfo> getCustomerInfoPage(CustomerSearchBean param) {

 

+        List<String> childdplist=null;

+        String deptcode=param.getDeptcode();

+        if (!StringUtil.isEmpty(deptcode)&&!"0".equals(deptcode)) {

+            Query chirdGroupQuery = entityManager.createNativeQuery("WITH RECURSIVE r AS(" +

+                    "SELECT * FROM tb_dept WHERE deptcode =:deptcode " +

+                    "union ALL " +

+                    "SELECT t.* FROM tb_dept t, r WHERE t.fdeptcode = r.deptcode) " +

+                    "select deptcode from r order by deptno");

+            chirdGroupQuery.setParameter("deptcode", deptcode);

+            childdplist = chirdGroupQuery.getResultList(); //递归查询所有的子节点

+        }

+

         String perName=param.getCustname();

         String sql = "select a.custid,a.custname,a.deptcode,a.custtypeid,b.cardno,b.bankcardno,b.cardphyid,b.expiredate from T_Customer a left join t_card b on a.custid = b.custid " +

                 " where a.status='1' and b.status='normal' and b.transtatus='normal' ";

@@ -107,6 +120,12 @@
             sql += " and a.custname like :perName ";

             countSql += " and a.custname like :perName ";

         }

+        if (!StringUtil.isEmpty(childdplist)) {

+            sql+=" and a.deptcode in ('"+ StringUtils.join(childdplist.toArray(),"','")+"') ";

+            countSql+=" and a.deptcode in ('"+ StringUtils.join(childdplist.toArray(),"','")+"') ";

+

+        }

+

         sql +=" order by b.cardno desc ";

 

 

diff --git a/src/main/resources/templates/system/operator.html b/src/main/resources/templates/system/operator.html
index 7ca4912..157dca1 100644
--- a/src/main/resources/templates/system/operator.html
+++ b/src/main/resources/templates/system/operator.html
@@ -639,7 +639,7 @@
                     _self.operatorDiaForm.opercode = ret.operator.opercode;
                     _self.operatorDiaForm.opername = ret.operator.opername;
                     _self.operatorDiaForm.opertype = ret.operator.opertype;
-                    _self.operatorDiaForm.roleid = ret.operatorroleid;
+                    _self.operatorDiaForm.roleid = ret.operator.roleid;
                     _self.operatorDiaForm.mobile = ret.operator.mobile;
                     _self.operatorDiaForm.email = ret.operator.email;
                     _self.operatorDiaForm.realname = ret.operator.realname;
@@ -684,6 +684,10 @@
 
                 var deptlist=[];
                 var depts = ret.depts;
+                deptlist.push({
+                    value:"0",
+                    label:"全部"
+                });
                 for (var k=0;k<depts.length;k++){
                     deptlist.push({
                         value:depts[k]["deptcode"],