zhoufan 7 gadi atpakaļ
vecāks
revīzija
21bf862d1c

+ 24 - 5
CallCenterApi/CallCenterApi.Interface/CallCenterApi.Interface/Controllers/UserAccountController.cs

@@ -30,6 +30,7 @@ namespace CallCenterApi.Interface.Controllers
30 30
             {
31 31
                 string Key = RequestString.GetQueryString("Key");
32 32
                 int Id = RequestString.GetInt("Id", 0);
33
+                int RoleId = RequestString.GetInt("roleid", 0);
33 34
                 string strpageindex = RequestString.GetQueryString("page");
34 35
                 int pageindex = 1;
35 36
                 string strpagesize = RequestString.GetQueryString("pagesize");
@@ -37,13 +38,17 @@ namespace CallCenterApi.Interface.Controllers
37 38
 
38 39
                 if (Id > 0)
39 40
                 {
40
-                    sql += " and F_DeptId=" + Id;
41
+                    //sql += " and F_DeptId=" + Id;
42
+
43
+                    sql += " and F_DeptId in (" + GetDeptIds(Id) + ")";
44
+                }
45
+                if (RoleId > 0)
46
+                {
47
+                    sql += " and F_RoleId=" + RoleId;
41 48
                 }
42 49
                 if (!string.IsNullOrWhiteSpace(Key))
43 50
                 {
44
-                    sql = "";
45
-                    string str = string.Format(" and (F_UserCode like '%{0}%' or F_UserName like '%{1}%')", Key, Key);
46
-                    sql += str;
51
+                    sql += string.Format(" and (F_UserCode like '%{0}%' or F_UserName like '%{1}%')", Key, Key);
47 52
                 }
48 53
                 if (strpageindex.Trim() != "")
49 54
                 {
@@ -61,7 +66,7 @@ namespace CallCenterApi.Interface.Controllers
61 66
                                         "F_UserId",
62 67
                                         "*",
63 68
                                         sql,
64
-                                        "ORDER BY F_UserId desc",
69
+                                        "ORDER BY F_RoleId, F_UserCode desc",
65 70
                                         pagesize,
66 71
                                         pageindex,
67 72
                                         true,
@@ -119,6 +124,20 @@ namespace CallCenterApi.Interface.Controllers
119 124
             }
120 125
         }
121 126
 
127
+        //获取单位下所有单位id
128
+        public string GetDeptIds(int deptid = 0)
129
+        {
130
+            string ids = deptid.ToString();
131
+
132
+            var list = departmentBLL.GetModelList("F_State=0 and F_PartentId=" + deptid);
133
+            foreach (var l in list)
134
+            {
135
+                string childids = GetDeptIds(l.F_DeptId);
136
+                ids += "," + childids;
137
+            }
138
+
139
+            return ids;
140
+        }
122 141
 
123 142
         //获取用户信息
124 143
         [Authority]