diff --git a/Edu.Model/Entity/User/RB_Assist.cs b/Edu.Model/Entity/User/RB_Assist.cs index ff084934aadb151e1e747a5b96c56c2e3e015694..0509f6473d082bbc6258314e0d8920430360a52d 100644 --- a/Edu.Model/Entity/User/RB_Assist.cs +++ b/Edu.Model/Entity/User/RB_Assist.cs @@ -87,5 +87,16 @@ namespace Edu.Model.Entity.User /// é›†å›¢ç¼–å· /// </summary> public int Group_Id { get; set; } + + + /// <summary> + /// éƒ¨é—¨ç¼–å· + /// </summary> + public int Dept_Id { get; set; } + + /// <summary> + /// å²—ä½ç¼–å· + /// </summary> + public int Post_Id { get; set; } } } \ No newline at end of file diff --git a/Edu.Model/ViewModel/System/RB_Destination_ViewModel.cs b/Edu.Model/ViewModel/System/RB_Destination_ViewModel.cs index 3f3fdf08778121ff83fbbcf86ad223d0b168b706..82003c64e59801089b59ecf015c61ad576686a1a 100644 --- a/Edu.Model/ViewModel/System/RB_Destination_ViewModel.cs +++ b/Edu.Model/ViewModel/System/RB_Destination_ViewModel.cs @@ -11,7 +11,7 @@ public string NameStr { get; set; } /// <summary> - /// 多个编å·ã€é€—å·åˆ†å‰²ã€‘ + /// 多个编å·ã€é€—å·åˆ†å‰²ã€‘ /// </summary> public string Ids { get; set; } } diff --git a/Edu.Model/ViewModel/User/RB_Assist_ViewModel.cs b/Edu.Model/ViewModel/User/RB_Assist_ViewModel.cs index 22a9249fd1226284a1ff37191154710d5c6cfb8e..982382a63f020d6eb0f19ef14a30cf4b3e17b491 100644 --- a/Edu.Model/ViewModel/User/RB_Assist_ViewModel.cs +++ b/Edu.Model/ViewModel/User/RB_Assist_ViewModel.cs @@ -64,5 +64,15 @@ namespace Edu.Model.ViewModel.User /// åŠ©æ•™ç™»å½•è´¦å· /// </summary> public string AssistAccount { get; set; } + + /// <summary> + /// 部门å称 + /// </summary> + public string DeptName { get; set; } + + /// <summary> + /// å²—ä½å称 + /// </summary> + public string PostName { get; set; } } } \ No newline at end of file diff --git a/Edu.Model/ViewModel/User/RB_Manager_ViewModel.cs b/Edu.Model/ViewModel/User/RB_Manager_ViewModel.cs index 9771e10ceaf7fd6392c87639ebe8bd509121ab0e..05adcbf00c90815d290d4620b73bcfbb2daacba7 100644 --- a/Edu.Model/ViewModel/User/RB_Manager_ViewModel.cs +++ b/Edu.Model/ViewModel/User/RB_Manager_ViewModel.cs @@ -49,5 +49,15 @@ namespace Edu.Model.ViewModel.User /// 管ç†è€…è´¦å· /// </summary> public string ManagerAccount { get; set; } + + /// <summary> + /// 部门å称 + /// </summary> + public string DeptName { get; set; } + + /// <summary> + /// å²—ä½å称 + /// </summary> + public string PostName { get; set; } } } diff --git a/Edu.Model/ViewModel/User/RB_Post_ViewModel.cs b/Edu.Model/ViewModel/User/RB_Post_ViewModel.cs index 98511c60ec58e23addbd17907ed1639ef1a2464f..27635acd5325c89031eeac575303d3e66b3a612c 100644 --- a/Edu.Model/ViewModel/User/RB_Post_ViewModel.cs +++ b/Edu.Model/ViewModel/User/RB_Post_ViewModel.cs @@ -45,5 +45,10 @@ namespace Edu.Model.ViewModel.User /// 所属部门 /// </summary> public string DeptName { get; set; } + + /// <summary> + /// å²—ä½ç¼–å·æŸ¥è¯¢ + /// </summary> + public string QPostIds { get; set; } } } diff --git a/Edu.Model/ViewModel/User/RB_Teacher_ViewModel.cs b/Edu.Model/ViewModel/User/RB_Teacher_ViewModel.cs index 7f4c694ce62fd5b19cb39d1814c353d126da5041..4436698ef2dda6ade6dcd2fc79c3a78d28c3a330 100644 --- a/Edu.Model/ViewModel/User/RB_Teacher_ViewModel.cs +++ b/Edu.Model/ViewModel/User/RB_Teacher_ViewModel.cs @@ -64,5 +64,15 @@ namespace Edu.Model.ViewModel.User /// æ•™å¸ˆè´¦å· /// </summary> public string TeacherAccount { get; set; } + + /// <summary> + /// 部门å称 + /// </summary> + public string DeptName { get; set; } + + /// <summary> + /// å²—ä½å称 + /// </summary> + public string PostName { get; set; } } } \ No newline at end of file diff --git a/Edu.Module.User/AssistModule.cs b/Edu.Module.User/AssistModule.cs index b70dcb5bf9c34a27c459ae89a9ad491776d951cd..88fd046435ae80a714be2a9c6daba38be4fd2330 100644 --- a/Edu.Module.User/AssistModule.cs +++ b/Edu.Module.User/AssistModule.cs @@ -27,6 +27,16 @@ namespace Edu.Module.User /// </summary> private readonly AccountModule accountModule = new AccountModule(); + /// <summary> + /// 部门仓储层对象 + /// </summary> + private readonly RB_DepartmentRepository departmentRepository = new RB_DepartmentRepository(); + + /// <summary> + /// å²—ä½ä»“储层对象 + /// </summary> + private readonly RB_PostRepository postRepository = new RB_PostRepository(); + /// <summary> /// 获å–助教列表 /// </summary> @@ -48,7 +58,28 @@ namespace Edu.Module.User /// <returns></returns> public List<RB_Assist_ViewModel> GetAssistPageListModule(int pageIndex, int pageSize, out long rowsCount, RB_Assist_ViewModel query) { - return assistRepository.GetAssistPageListRepository(pageIndex, pageSize, out rowsCount, query); + var list= assistRepository.GetAssistPageListRepository(pageIndex, pageSize, out rowsCount, query); + if (list != null && list.Count > 0) + { + string postIds = string.Join(",", list.Where(qitem => qitem.Post_Id > 0).Select(qitem => qitem.Post_Id)); + string deptIds = string.Join(",", list.Where(qitem => qitem.Dept_Id > 0).Select(qitem => qitem.Dept_Id)); + List<RB_Post_ViewModel> postList = new List<RB_Post_ViewModel>(); + List<RB_Department_ViewModel> deptList = new List<RB_Department_ViewModel>(); + if (!string.IsNullOrEmpty(postIds)) + { + postList = postRepository.GetPostListRepository(new RB_Post_ViewModel() { QPostIds = postIds }); + } + if (!string.IsNullOrEmpty(deptIds)) + { + deptList = departmentRepository.GetDepartmentListRepository(new RB_Department_ViewModel() { QDeptIds = deptIds }); + } + foreach (var item in list) + { + item.DeptName = deptList?.Where(qitem => qitem.DeptId == item.Dept_Id)?.FirstOrDefault()?.DeptName ?? ""; + item.PostName = postList?.Where(qitem => qitem.PostId == item.Post_Id)?.FirstOrDefault()?.PostName ?? ""; + } + } + return list; } /// <summary> @@ -71,6 +102,8 @@ namespace Edu.Module.User {nameof(RB_Assist.AssistIntro),model.AssistIntro }, {nameof(RB_Assist.UpdateBy),model.UpdateBy }, {nameof(RB_Assist.UpdateTime),model.UpdateTime }, + {nameof(RB_Teacher_ViewModel.Dept_Id),model.Dept_Id }, + {nameof(RB_Teacher_ViewModel.Post_Id),model.Post_Id }, }; flag = assistRepository.Update(fileds, new WhereHelper(nameof(RB_Assist.AId), model.AId)); } diff --git a/Edu.Module.User/ManagerModule.cs b/Edu.Module.User/ManagerModule.cs index e9a915b1e03996c6b08512edef2cad1f3d826fd1..a85aa9a5e47c8dc3c3ecfc3fc5dc562c7153fc90 100644 --- a/Edu.Module.User/ManagerModule.cs +++ b/Edu.Module.User/ManagerModule.cs @@ -6,6 +6,7 @@ using Edu.Model.ViewModel.User; using Edu.Repository.User; using System; using System.Collections.Generic; +using System.Linq; using VT.FW.DB; namespace Edu.Module.User @@ -25,6 +26,16 @@ namespace Edu.Module.User /// </summary> private readonly AccountModule accountModule = new AccountModule(); + /// <summary> + /// å²—ä½ä»“储层对象 + /// </summary> + private readonly RB_PostRepository postRepository = new RB_PostRepository(); + + /// <summary> + /// 部门仓储层对象 + /// </summary> + private readonly RB_DepartmentRepository departmentRepository = new RB_DepartmentRepository(); + /// <summary> /// 获å–管ç†è€…列表 /// </summary> @@ -45,7 +56,28 @@ namespace Edu.Module.User /// <returns></returns> public List<RB_Manager_ViewModel> GetManagerPageListModule(int pageIndex, int pageSize, out long rowsCount, RB_Manager_ViewModel query) { - return managerRepository.GetManagerPageListRepository(pageIndex, pageSize, out rowsCount, query); + var list= managerRepository.GetManagerPageListRepository(pageIndex, pageSize, out rowsCount, query); + if (list != null && list.Count > 0) + { + string postIds = string.Join(",", list.Where(qitem => qitem.Post_Id > 0).Select(qitem => qitem.Post_Id)); + string deptIds = string.Join(",", list.Where(qitem => qitem.Dept_Id > 0).Select(qitem => qitem.Dept_Id)); + List<RB_Post_ViewModel> postList = new List<RB_Post_ViewModel>(); + List<RB_Department_ViewModel> deptList = new List<RB_Department_ViewModel>(); + if (!string.IsNullOrEmpty(postIds)) + { + postList= postRepository.GetPostListRepository(new RB_Post_ViewModel() { QPostIds = postIds }); + } + if (!string.IsNullOrEmpty(deptIds)) + { + deptList= departmentRepository.GetDepartmentListRepository(new RB_Department_ViewModel() { QDeptIds = deptIds }); + } + foreach (var item in list) + { + item.DeptName = deptList?.Where(qitem => qitem.DeptId == item.Dept_Id)?.FirstOrDefault()?.DeptName ?? ""; + item.PostName = postList?.Where(qitem => qitem.PostId == item.Post_Id)?.FirstOrDefault()?.PostName ?? ""; + } + } + return list; } /// <summary> @@ -66,6 +98,8 @@ namespace Edu.Module.User { nameof(RB_Manager_ViewModel.UpdateBy),model.UpdateBy }, { nameof(RB_Manager_ViewModel.UpdateTime),model.UpdateTime }, { nameof(RB_Manager_ViewModel.RoleAuth),model.RoleAuth }, + { nameof(RB_Manager_ViewModel.Dept_Id),model.Dept_Id }, + { nameof(RB_Manager_ViewModel.Post_Id),model.Post_Id }, }; flag = managerRepository.Update(fileds, new WhereHelper(nameof(RB_Manager_ViewModel.MId), model.MId)); } @@ -157,7 +191,7 @@ namespace Edu.Module.User UpdateTime = DateTime.Now, Group_Id = model.Group_Id, School_Id = model.School_Id, - Status=model.Status, + Status = model.Status, }); } } diff --git a/Edu.Module.User/TeacherModule.cs b/Edu.Module.User/TeacherModule.cs index 734ee34f210eadeae6c951d7ed9e42c421d7e37f..76cb4b0c53b5c38a66a2917d467d31fb690b5dc0 100644 --- a/Edu.Module.User/TeacherModule.cs +++ b/Edu.Module.User/TeacherModule.cs @@ -27,6 +27,16 @@ namespace Edu.Module.User /// </summary> private readonly AccountModule accountModule = new AccountModule(); + /// <summary> + /// å²—ä½ç®¡ç†ä»“储层对象 + /// </summary> + private readonly RB_PostRepository postRepository = new RB_PostRepository(); + + /// <summary> + /// 部门管ç†ä»“储层对象 + /// </summary> + private readonly RB_DepartmentRepository departmentRepository = new RB_DepartmentRepository(); + /// <summary> /// 获å–讲师列表 /// </summary> @@ -48,7 +58,28 @@ namespace Edu.Module.User /// <returns></returns> public List<RB_Teacher_ViewModel> GetTeacherPageListModule(int pageIndex, int pageSize, out long rowsCount, RB_Teacher_ViewModel query) { - return teacherRepository.GetTeacherPageListRepository(pageIndex, pageSize, out rowsCount, query); + var list= teacherRepository.GetTeacherPageListRepository(pageIndex, pageSize, out rowsCount, query); + if (list != null && list.Count > 0) + { + string postIds=string.Join(",",list.Where(qitem=>qitem.Post_Id>0).Select(qitem=>qitem.Post_Id)); + string deptIds = string.Join(",", list.Where(qitem => qitem.Dept_Id > 0).Select(qitem => qitem.Dept_Id)); + List<RB_Post_ViewModel> postList = new List<RB_Post_ViewModel>(); + List<RB_Department_ViewModel> deptList = new List<RB_Department_ViewModel>(); + if (!string.IsNullOrEmpty(postIds)) + { + postList = postRepository.GetPostListRepository(new RB_Post_ViewModel() { QPostIds = postIds }); + } + if (!string.IsNullOrEmpty(deptIds)) + { + deptList = departmentRepository.GetDepartmentListRepository(new RB_Department_ViewModel() { QDeptIds = deptIds }); + } + foreach (var item in list) + { + item.DeptName = deptList?.Where(qitem => qitem.DeptId == item.Dept_Id)?.FirstOrDefault()?.DeptName ?? ""; + item.PostName = postList?.Where(qitem => qitem.PostId == item.Post_Id)?.FirstOrDefault()?.PostName ?? ""; + } + } + return list; } /// <summary> @@ -76,6 +107,8 @@ namespace Edu.Module.User {nameof(RB_Teacher_ViewModel.UpdateTime),model.UpdateTime }, {nameof(RB_Teacher_ViewModel.TeachTag),model.TeachTag }, {nameof(RB_Teacher_ViewModel.School_Id),model.School_Id }, + {nameof(RB_Teacher_ViewModel.Dept_Id),model.Dept_Id }, + {nameof(RB_Teacher_ViewModel.Post_Id),model.Post_Id }, }; flag = teacherRepository.Update(fileds, new WhereHelper(nameof(RB_Teacher_ViewModel.TId), model.TId)); } diff --git a/Edu.Repository/User/RB_PostRepository.cs b/Edu.Repository/User/RB_PostRepository.cs index f62315023fb1ab77edf9fbbce48bd43f3cd00f4d..46b15a8e628cb05c3c0ffc6d10abaae6fcc3cac4 100644 --- a/Edu.Repository/User/RB_PostRepository.cs +++ b/Edu.Repository/User/RB_PostRepository.cs @@ -83,6 +83,14 @@ WHERE 1=1 { builder.Append($" AND A.{nameof(RB_Post_ViewModel.PostId)}={query.PostId} "); } + if (query.RB_Dept_Id > 0) + { + builder.Append($" AND A.{nameof(RB_Post_ViewModel.RB_Dept_Id)}={query.RB_Dept_Id} "); + } + if (!string.IsNullOrEmpty(query.QPostIds)) + { + builder.Append($" AND A.{nameof(RB_Post_ViewModel.PostId)} IN({query.QPostIds}) "); + } if (!string.IsNullOrEmpty(query.PostName)) { builder.Append($" AND A.{nameof(RB_Post_ViewModel.PostName)} LIKE @PostName "); diff --git a/Edu.WebApi/Controllers/User/UserController.cs b/Edu.WebApi/Controllers/User/UserController.cs index 399cb1492f001334824d59fe9c67e463689b8884..016cdb5508a319bcbc304a27850d3f3865dd66ac 100644 --- a/Edu.WebApi/Controllers/User/UserController.cs +++ b/Edu.WebApi/Controllers/User/UserController.cs @@ -78,10 +78,10 @@ namespace Edu.WebApi.Controllers.User if (int.TryParse(RequestParm.Uid, out int uid)) { viewModel.Group_Id = UserReidsCache.GetUserLoginInfo(uid).Group_Id; - var result = accountModule.SetResetPassword(viewModel); - if (result.reuslt) + var (reuslt, newPass) = accountModule.SetResetPassword(viewModel); + if (reuslt) { - return ApiResult.Success($"密ç é‡ç½®æˆåŠŸï¼Œç”¨æˆ·æ–°å¯†ç 为ã€{result.newPass}】,请å¤åˆ¶ä¿å˜"); + return ApiResult.Success($"密ç é‡ç½®æˆåŠŸï¼Œç”¨æˆ·æ–°å¯†ç 为ã€{newPass}】,请å¤åˆ¶ä¿å˜"); } else {