操作员添加部门增改
diff --git a/src/main/java/com/supwisdom/dlpay/framework/domain/TOperator.java b/src/main/java/com/supwisdom/dlpay/framework/domain/TOperator.java
index cd27497..3ab0647 100644
--- a/src/main/java/com/supwisdom/dlpay/framework/domain/TOperator.java
+++ b/src/main/java/com/supwisdom/dlpay/framework/domain/TOperator.java
@@ -59,6 +59,8 @@
   private String realname;
   @Column(name = "COMPANYID",length = 32)
   private String companyId;
+  @Column(name="DEPTCODE",length = 32)
+  private String deptcode;
 
 
   @Transient
@@ -258,4 +260,12 @@
   public void setCompanyId(String companyId) {
     this.companyId = companyId;
   }
+
+  public String getDeptcode() {
+    return deptcode;
+  }
+
+  public void setDeptcode(String deptcode) {
+    this.deptcode = deptcode;
+  }
 }
diff --git a/src/main/java/com/supwisdom/dlpay/system/bean/OperatorBean.java b/src/main/java/com/supwisdom/dlpay/system/bean/OperatorBean.java
index 890c38a..0324527 100644
--- a/src/main/java/com/supwisdom/dlpay/system/bean/OperatorBean.java
+++ b/src/main/java/com/supwisdom/dlpay/system/bean/OperatorBean.java
@@ -11,6 +11,7 @@
     private String realname;

     private String regionid;

     private String companyId;

+    private String deptcode;

 

     public String getOperid() {

         return operid;

@@ -91,4 +92,12 @@
     public void setCompanyId(String companyId) {

         this.companyId = companyId;

     }

+

+    public String getDeptcode() {

+        return deptcode;

+    }

+

+    public void setDeptcode(String deptcode) {

+        this.deptcode = deptcode;

+    }

 }

diff --git a/src/main/java/com/supwisdom/dlpay/system/bean/OperatorListBean.java b/src/main/java/com/supwisdom/dlpay/system/bean/OperatorListBean.java
index d4015ad..a72b625 100644
--- a/src/main/java/com/supwisdom/dlpay/system/bean/OperatorListBean.java
+++ b/src/main/java/com/supwisdom/dlpay/system/bean/OperatorListBean.java
@@ -18,10 +18,13 @@
     private String regionname;

     private String companyid;

     private String companyname;

+    private String deptcode;

+    private String deptname;

     private String mobile;

     private String email;

     private String foperid;

 

+

     public String getOperid() {

         return operid;

     }

@@ -141,4 +144,20 @@
     public void setCompanyname(String companyname) {

         this.companyname = companyname;

     }

+

+    public String getDeptcode() {

+        return deptcode;

+    }

+

+    public void setDeptcode(String deptcode) {

+        this.deptcode = deptcode;

+    }

+

+    public String getDeptname() {

+        return deptname;

+    }

+

+    public void setDeptname(String deptname) {

+        this.deptname = deptname;

+    }

 }

diff --git a/src/main/java/com/supwisdom/dlpay/system/controller/OperatorController.java b/src/main/java/com/supwisdom/dlpay/system/controller/OperatorController.java
index a000030..ddb2676 100644
--- a/src/main/java/com/supwisdom/dlpay/system/controller/OperatorController.java
+++ b/src/main/java/com/supwisdom/dlpay/system/controller/OperatorController.java
@@ -9,6 +9,7 @@
 import com.supwisdom.dlpay.system.bean.OperatorBean;
 import com.supwisdom.dlpay.system.bean.OperatorSearchBean;
 import com.supwisdom.dlpay.system.domain.TCompany;
+import com.supwisdom.dlpay.system.domain.TDept;
 import com.supwisdom.dlpay.system.domain.TDictionaryId;
 import com.supwisdom.dlpay.system.domain.TRegion;
 import com.supwisdom.dlpay.system.page.Pagination;
@@ -344,6 +345,10 @@
             companys = companyService.getValidCompanyList();
             map.put("companys", companys);
 
+            List<TDept> dept=null;
+            dept=systemService.findAllDept();
+            map.put("depts",dept);
+
         }catch (Exception e){
             e.printStackTrace();
         }
@@ -387,6 +392,7 @@
             operator.setFoperid(operUser.getOperid());
             operator.setRegionid(postData.getRegionid());
             operator.setCompanyId(postData.getCompanyId());
+            operator.setDeptcode(postData.getDeptcode());
 
             managerService.saveOperator(operator);
 
@@ -430,6 +436,7 @@
             operator.setFoperid(operUser.getOperid());
             operator.setRegionid(postData.getRegionid());
             operator.setCompanyId(postData.getCompanyId());
+            operator.setDeptcode(postData.getDeptcode());
 
             TOperRole operRole = managerService.getTOperRoleByOperid(postData.getOperid());
             operRole.setRoleId(postData.getRoleid());
diff --git a/src/main/java/com/supwisdom/dlpay/system/dao/impl/ManagerDaoImpl.java b/src/main/java/com/supwisdom/dlpay/system/dao/impl/ManagerDaoImpl.java
index 31b5177..a0a0a82 100644
--- a/src/main/java/com/supwisdom/dlpay/system/dao/impl/ManagerDaoImpl.java
+++ b/src/main/java/com/supwisdom/dlpay/system/dao/impl/ManagerDaoImpl.java
@@ -27,12 +27,13 @@
     public Pagination getOperatorList(String operid, String realname, int pageNo, int pageSize) {

         String sql = "select a.operid,a.opername,a.opercode,case when a.opertype='P' then '超级管理员' when a.opertype='S' then '系统管理员' " +

                 " when a.opertype='H' then '区域管理员' when a.opertype='L' then '楼栋管理员' else a.opertype end opertype," +

-                "a.realname,case when a.status='normal' then '有效' else '注销' end status,a.regionid,a.mobile,a.email,a.foperid,c.roleid,c.rolename,d.regionname,a.companyId,e.companyName " +

+                "a.realname,case when a.status='normal' then '有效' else '注销' end status,a.regionid,a.mobile,a.email,a.foperid,c.roleid,c.rolename,d.regionname,a.companyId,e.companyName,f.deptcode,f.deptname " +

                 " from Tb_Operator a " +

                 " left join tb_oper_role b on a.operid = b.operid " +

                 " left join tb_role c on b.roleid = c.roleid " +

                 " left join tb_region d on a.regionid = d.regionid " +

                 " left join tb_company e on a.companyid = e.companyid " +

+                " left join tb_dept f on a.deptcode = f.deptcode " +

                 " where 1>0  ";

         if (!StringUtil.isEmpty(operid)){

             sql += " and a.operid = :operid ";

@@ -72,6 +73,7 @@
                 " left join tb_role c on b.roleid = c.roleid " +

                 " left join tb_region d on a.regionid = d.regionid " +

                 " left join tb_company e on a.companyid = e.companyid " +

+                " left join tb_dept f on a.deptcode = f.deptcode "+

                 "where 1>0 ";

 

         if (!StringUtil.isEmpty(operid)){

@@ -103,12 +105,13 @@
     public Pagination getOperOperatorList(String operatorOperid, String operid, String realname, int pageNo, int pageSize) {

         String sql = "select a.operid,a.opername,a.opercode,case when a.opertype='P' then '超级管理员' when a.opertype='S' then '系统管理员' " +

                 " when a.opertype='H' then '区域管理员' when a.opertype='L' then '楼栋管理员' else a.opertype end opertype,a.realname,case when a.status='normal' then '有效' else '注销' end status,a.regionid,a.mobile,a.email,a.foperid,c.roleid,c.rolename,d.regionname, " +

-                " a.companyid,e.companyName "+

+                " a.companyid,e.companyName,f.deptcode,f.deptname "+

                 " from Tb_Operator a " +

                 " left join tb_oper_role b on a.operid = b.operid " +

                 " left join tb_role c on b.roleid = c.roleid " +

                 " left join tb_region d on a.regionid = d.regionid " +

                 " left join tb_company e on a.companyid = e.companyid " +

+                " left join tb_dept f on a.deptcode = f.deptcode "+

                 " where 1>0 and   a.foperid=:operatorOperid ";

         if (!StringUtil.isEmpty(operid)){

             sql += " and a.operid = :operid ";

@@ -147,6 +150,7 @@
                 " left join tb_role c on b.roleid = c.roleid " +

                 " left join tb_region d on a.regionid = d.regionid " +

                 " left join tb_company e on a.companyid = e.companyid " +

+                " left join tb_dept f on a.deptcode = f.deptcode "+

                 "where   a.foperid=:operatorOperid ";

 

         if (!StringUtil.isEmpty(operid)){

diff --git a/src/main/resources/templates/system/dept/index.html b/src/main/resources/templates/system/dept/index.html
index 47683b9..a5bab59 100644
--- a/src/main/resources/templates/system/dept/index.html
+++ b/src/main/resources/templates/system/dept/index.html
@@ -45,7 +45,6 @@
 
                         align: 'center',
                         templet: function (item) {
-                            console.log(dplist);
                             for(var i=0 ;i<dplist.length;i++){
                                 if(item.fdeptcode==dplist[i].deptcode){
                                     return dplist[i].deptname;
diff --git a/src/main/resources/templates/system/operator.html b/src/main/resources/templates/system/operator.html
index 7de43bd..7ca4912 100644
--- a/src/main/resources/templates/system/operator.html
+++ b/src/main/resources/templates/system/operator.html
@@ -111,6 +111,11 @@
                             width="180">
                     </el-table-column>
                     <el-table-column
+                            prop="deptname"
+                            label="所属部门"
+                            width="180">
+                    </el-table-column>
+                    <el-table-column
                             prop="email"
                             label="邮箱"
                             width="180">
@@ -266,6 +271,21 @@
                         </el-col>
                     </el-form-item>
 
+                    <el-form-item label="所属部门:" prop="deptcode">
+                        <el-col :span="18">
+                            <el-select v-model="operatorDiaForm.deptcode" style="width: 187px;"
+                                       filterable
+                                       placeholder="请选择">
+                                <el-option
+                                        v-for="deptcode in depts"
+                                        :key="deptcode.value"
+                                        :label="deptcode.label"
+                                        :value="deptcode.value">
+                                </el-option>
+                            </el-select>
+                        </el-col>
+                    </el-form-item>
+
                 </el-form>
                 <div slot="footer" class="dialog-footer">
                     <el-button @click="resetForm('operatorDiaForm') ">取 消</el-button>
@@ -357,6 +377,7 @@
             regions:[],
             opertypes:[],
             companys:[],
+            depts:[],
             operatorDiaForm:{
                 operid:'',
                 opercode:'',
@@ -367,7 +388,8 @@
                 mobile:'',
                 email:'',
                 realname:'',
-                companyId:''
+                companyId:'',
+                deptcode:''
             },
             buildingTitle:'',
             dlgAllotBuildingVisible:false,
@@ -413,6 +435,9 @@
                 companyId: [
                     {required: true, message: '请选择所属公司', trigger: 'blur'}
                 ],
+                deptcode: [
+                    {required: true, message: '请选择所属部门', trigger: 'blur'}
+        ]
 
             },
             operatortitile:'添加操作员(默认密码为123456)',
@@ -620,6 +645,7 @@
                     _self.operatorDiaForm.realname = ret.operator.realname;
                     _self.operatorDiaForm.regionid = ret.operator.regionid;
                     _self.operatorDiaForm.companyId = ret.operator.companyId;
+                    _self.operatorDiaForm.deptcode = ret.operator.deptcode;
                     if (ret.operator.opertype == 'H') {
                         _self.regionDis = false;
                     }
@@ -648,15 +674,25 @@
 
                 var companylist = [];
                 var companys = ret.companys;
-                console.log(companys);
                 for (var k=0;k<companys.length;k++){
                     companylist.push({
                         value:companys[k]["companyId"],
                         label:companys[k]["companyName"]
                     });
                 }
-                console.log(companylist);
                 _self.companys = companylist;
+
+                var deptlist=[];
+                var depts = ret.depts;
+                for (var k=0;k<depts.length;k++){
+                    deptlist.push({
+                        value:depts[k]["deptcode"],
+                        label:depts[k]["deptname"]
+                    });
+                }
+
+                _self.depts = deptlist;
+
             }
         })
     }
diff --git a/src/main/resources/templates/system/operator/operator.html b/src/main/resources/templates/system/operator/operator.html
index a048c1a..a45b659 100644
--- a/src/main/resources/templates/system/operator/operator.html
+++ b/src/main/resources/templates/system/operator/operator.html
@@ -28,6 +28,7 @@
             <input name="mobile" placeholder="请输入手机号" type="text" class="layui-input" lay-verify="mobile" />
         </div>
     </div>
+
     <div class="layui-form-item">
         <label class="layui-form-label">邮箱</label>
         <div class="layui-input-block">