From 403833e4b6bb238de5e54d29ba48af17fd18c83d Mon Sep 17 00:00:00 2001 From: gaofei1985 <181547018@qq.com> Date: Wed, 10 Jun 2026 12:32:12 +0800 Subject: [PATCH] 1 --- SGGL/BLL/BaseInfo/PostTitleService.cs | 20 ++++ SGGL/BLL/BaseInfo/WorkPostService.cs | 28 +++++ SGGL/BLL/Person/Person_ShuntService.cs | 147 +++++++++++++++---------- SGGL/BLL/SysManage/RoleService.cs | 28 +++++ 4 files changed, 165 insertions(+), 58 deletions(-) diff --git a/SGGL/BLL/BaseInfo/PostTitleService.cs b/SGGL/BLL/BaseInfo/PostTitleService.cs index bfa43f49..0668fe8e 100644 --- a/SGGL/BLL/BaseInfo/PostTitleService.cs +++ b/SGGL/BLL/BaseInfo/PostTitleService.cs @@ -117,6 +117,26 @@ namespace BLL return PostTitleName; } + + /// + /// 根据职称ID得到职称名称 + /// + /// + /// + public static string getPostTitleNameById(Model.SGGLDB db, string PostTitleId) + { + string PostTitleName = string.Empty; + if (!string.IsNullOrEmpty(PostTitleId)) + { + var q = db.Base_PostTitle.FirstOrDefault(e => e.PostTitleId == PostTitleId); + if (q != null) + { + PostTitleName = q.PostTitleName; + } + } + + return PostTitleName; + } #endregion #region 表下拉框 diff --git a/SGGL/BLL/BaseInfo/WorkPostService.cs b/SGGL/BLL/BaseInfo/WorkPostService.cs index 73ab1e44..432acb51 100644 --- a/SGGL/BLL/BaseInfo/WorkPostService.cs +++ b/SGGL/BLL/BaseInfo/WorkPostService.cs @@ -309,6 +309,34 @@ namespace BLL return workPostName; } + + /// + /// 根据多岗位ID得到岗位名称字符串 + /// + /// + /// + public static string getWorkPostNamesWorkPostIds(Model.SGGLDB db, object workPostIds) + { + string workPostName = string.Empty; + if (workPostIds != null) + { + string[] ids = workPostIds.ToString().Split(','); + foreach (string id in ids) + { + var q = db.Base_WorkPost.FirstOrDefault(e => e.WorkPostId == id); + if (q != null) + { + workPostName += q.WorkPostName + ","; + } + } + if (workPostName != string.Empty) + { + workPostName = workPostName.Substring(0, workPostName.Length - 1); ; + } + } + + return workPostName; + } #endregion } } \ No newline at end of file diff --git a/SGGL/BLL/Person/Person_ShuntService.cs b/SGGL/BLL/Person/Person_ShuntService.cs index 91274698..0eb63821 100644 --- a/SGGL/BLL/Person/Person_ShuntService.cs +++ b/SGGL/BLL/Person/Person_ShuntService.cs @@ -38,64 +38,67 @@ namespace BLL /// public static IEnumerable getListData(string workPostId, string postTitleId, string name, string certificateId, Grid Grid1) { - IQueryable getDataList = from x in Funs.DB.Person_Persons - where x.PersonId != Const.sysglyId && x.PersonId != Const.hfnbdId && x.UnitId == Const.UnitId_SEDIN - && x.DepartId == Const.Depart_constructionId - && x.CurrentProjectId == null && (!x.IsOffice.HasValue || x.IsOffice == false) - select x; - if (!string.IsNullOrEmpty(workPostId) && workPostId != Const._Null) + using (Model.SGGLDB db = new Model.SGGLDB(Funs.ConnString)) { - getDataList = getDataList.Where(e => e.WorkPostId == workPostId); - } - if (!string.IsNullOrEmpty(postTitleId) && postTitleId != Const._Null) - { - getDataList = getDataList.Where(e => e.PostTitleId == postTitleId); - } + IQueryable getDataList = from x in db.Person_Persons + where x.PersonId != Const.sysglyId && x.PersonId != Const.hfnbdId && x.UnitId == Const.UnitId_SEDIN + && x.DepartId == Const.Depart_constructionId + && x.CurrentProjectId == null && (!x.IsOffice.HasValue || x.IsOffice == false) + select x; + if (!string.IsNullOrEmpty(workPostId) && workPostId != Const._Null) + { + getDataList = getDataList.Where(e => e.WorkPostId == workPostId); + } + if (!string.IsNullOrEmpty(postTitleId) && postTitleId != Const._Null) + { + getDataList = getDataList.Where(e => e.PostTitleId == postTitleId); + } - if (!string.IsNullOrEmpty(name)) - { - getDataList = getDataList.Where(e => e.PersonName.Contains(name)); - } - if (!string.IsNullOrEmpty(certificateId) && postTitleId != Const._Null) - { - getDataList = getDataList.Where(e => e.CertificateId.Contains(certificateId)); - } + if (!string.IsNullOrEmpty(name)) + { + getDataList = getDataList.Where(e => e.PersonName.Contains(name)); + } + if (!string.IsNullOrEmpty(certificateId) && postTitleId != Const._Null) + { + getDataList = getDataList.Where(e => e.CertificateId.Contains(certificateId)); + } - count = getDataList.Count(); - if (count == 0) - { - return null; + count = getDataList.Count(); + if (count == 0) + { + return null; + } + getDataList = SortConditionHelper.SortingAndPaging(getDataList, Grid1.SortField, Grid1.SortDirection, Grid1.PageIndex, Grid1.PageSize); + return from x in getDataList + select new + { + x.PersonId, + x.PersonName, + x.JobNum, + x.Account, + x.IdentityCard, + Sex = x.Sex ?? "1", + x.Birthday, + x.UnitId, + x.DepartId, + x.WorkPostId, + WorkPostName = WorkPostService.getWorkPostNamesWorkPostIds(db, x.WorkPostId), + x.Major, + x.PostTitleId, + PostTitleName = PostTitleService.getPostTitleNameById(db, x.PostTitleId), + x.IsOffice, + x.RoleIds, + RoleName = RoleService.getRoleNamesRoleIds(db, x.RoleIds), + x.CurrentProjectId, + LastProjectName = getCurrentProjectName(db, x.PersonId), + x.CurrentProjectWorkPostId, + LastWorkPostName = getCurrentProjectWorkPostName(db, x.PersonId), + IsPost = x.IsPost ?? true, + IsPostName = x.IsPost == false ? "否" : "是", + x.SignatureUrl, + x.CertificateId, + }; } - getDataList = SortConditionHelper.SortingAndPaging(getDataList, Grid1.SortField, Grid1.SortDirection, Grid1.PageIndex, Grid1.PageSize); - return from x in getDataList - select new - { - x.PersonId, - x.PersonName, - x.JobNum, - x.Account, - x.IdentityCard, - Sex = x.Sex ?? "1", - x.Birthday, - x.UnitId, - x.DepartId, - x.WorkPostId, - WorkPostName = WorkPostService.getWorkPostNamesWorkPostIds(x.WorkPostId), - x.Major, - x.PostTitleId, - PostTitleName = PostTitleService.getPostTitleNameById(x.PostTitleId), - x.IsOffice, - x.RoleIds, - RoleName = RoleService.getRoleNamesRoleIds(x.RoleIds), - x.CurrentProjectId, - LastProjectName = getCurrentProjectName(x.PersonId), - x.CurrentProjectWorkPostId, - LastWorkPostName = getCurrentProjectWorkPostName(x.PersonId), - IsPost = x.IsPost ?? true, - IsPostName = x.IsPost == false ? "否" : "是", - x.SignatureUrl, - x.CertificateId, - }; } #endregion @@ -125,18 +128,46 @@ namespace BLL /// /// /// - /// + /// /// /// - public static string getCurrentProjectWorkPostName(string PersonId) + public static string getCurrentProjectName(Model.SGGLDB db, string PersonId) { - var getItem = (from x in Funs.DB.SitePerson_PersonItem + var getItem = (from x in db.SitePerson_PersonItem where x.PersonId == PersonId orderby x.InTime descending select x).FirstOrDefault(); if (getItem != null) { - return WorkPostService.getWorkPostNamesWorkPostIds(getItem.WorkPostId); + string name = string.Empty; + var project = db.Base_Project.FirstOrDefault(e => e.ProjectId == getItem.ProjectId); + if (project != null) + { + name = project.ShortName; + } + return name; + } + else + { + return null; + } + } + + /// + /// + /// + /// + /// + /// + public static string getCurrentProjectWorkPostName(Model.SGGLDB db, string PersonId) + { + var getItem = (from x in db.SitePerson_PersonItem + where x.PersonId == PersonId + orderby x.InTime descending + select x).FirstOrDefault(); + if (getItem != null) + { + return WorkPostService.getWorkPostNamesWorkPostIds(db, getItem.WorkPostId); } else { diff --git a/SGGL/BLL/SysManage/RoleService.cs b/SGGL/BLL/SysManage/RoleService.cs index 53050916..51e907c6 100644 --- a/SGGL/BLL/SysManage/RoleService.cs +++ b/SGGL/BLL/SysManage/RoleService.cs @@ -151,6 +151,34 @@ return roleName; } + /// + /// 得到角色名称字符串 + /// + /// + /// + public static string getRoleNamesRoleIds(Model.SGGLDB db, object roleIds) + { + string roleName = string.Empty; + if (roleIds != null) + { + string[] roles = roleIds.ToString().Split(','); + foreach (string roleId in roles) + { + var q = db.Sys_Role.FirstOrDefault(x => x.RoleId == roleId); + if (q != null && !roleName.Contains(q.RoleName)) + { + roleName += q.RoleName + ","; + } + } + if (roleName != string.Empty) + { + roleName = roleName.Substring(0, roleName.Length - 1); ; + } + } + + return roleName; + } + /// /// 角色下拉框 ///