From a9d5514343680bba6550b18a8e13768a439cf127 Mon Sep 17 00:00:00 2001 From: ndbs Date: Tue, 12 Jul 2022 15:35:36 +0800 Subject: [PATCH] =?UTF-8?q?=E5=BD=92=E5=AE=BF=E7=BB=9F=E8=AE=A1=E6=9F=A5?= =?UTF-8?q?=E8=AF=A2=E9=87=8D=E5=A4=8D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Accommodation/AccommodationBLL.cs | 62 +++++++++++++++++-- .../Accommodation/AccommodationService.cs | 40 ++++++++++++ 2 files changed, 98 insertions(+), 4 deletions(-) diff --git a/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.TwoDevelopment/LogisticsManagement/Accommodation/AccommodationBLL.cs b/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.TwoDevelopment/LogisticsManagement/Accommodation/AccommodationBLL.cs index 3252d1a1e..cfa96ee63 100644 --- a/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.TwoDevelopment/LogisticsManagement/Accommodation/AccommodationBLL.cs +++ b/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.TwoDevelopment/LogisticsManagement/Accommodation/AccommodationBLL.cs @@ -311,11 +311,66 @@ namespace Learun.Application.TwoDevelopment.LogisticsManagement } } + //public List GetDept() + //{ + // try + // { + // return accommodationService.GetSelectData("").Select(x => new Acc_DormitoryBuildEntity { Dept = x.Dept, DeptName = x.DeptName }).Distinct().ToList(); + // } + // catch (Exception ex) + // { + // if (ex is ExceptionEx) + // { + // throw; + // } + // else + // { + // throw ExceptionEx.ThrowBusinessException(ex); + // } + // } + //} + //public List GetMajor(string strWhere) + //{ + // try + // { + // return accommodationService.GetSelectData(strWhere).Select(x => new Acc_DormitoryBuildEntity { Major = x.Major, MajorName = x.MajorName }).Distinct().ToList(); + // } + // catch (Exception ex) + // { + // if (ex is ExceptionEx) + // { + // throw; + // } + // else + // { + // throw ExceptionEx.ThrowBusinessException(ex); + // } + // } + //} + //public List GetClass(string strWhere) + //{ + // try + // { + // return accommodationService.GetSelectData(strWhere).Select(x => new Acc_DormitoryBuildEntity { Class = x.Class, ClassName = x.ClassName }).Distinct().ToList(); + // } + // catch (Exception ex) + // { + // if (ex is ExceptionEx) + // { + // throw; + // } + // else + // { + // throw ExceptionEx.ThrowBusinessException(ex); + // } + // } + //} + public List GetDept() { try { - return accommodationService.GetSelectData("").Select(x => new Acc_DormitoryBuildEntity { Dept = x.Dept, DeptName = x.DeptName }).Distinct().ToList(); + return accommodationService.GetDeptOrMajorOrClass("").Select(x => new Acc_DormitoryBuildEntity { Dept = x.Dept, DeptName = x.DeptName }).Distinct().ToList(); } catch (Exception ex) { @@ -333,7 +388,7 @@ namespace Learun.Application.TwoDevelopment.LogisticsManagement { try { - return accommodationService.GetSelectData(strWhere).Select(x => new Acc_DormitoryBuildEntity { Major = x.Major, MajorName = x.MajorName }).Distinct().ToList(); + return accommodationService.GetDeptOrMajorOrClass(strWhere).Select(x => new Acc_DormitoryBuildEntity { Major = x.Major, MajorName = x.MajorName }).Distinct().ToList(); } catch (Exception ex) { @@ -351,7 +406,7 @@ namespace Learun.Application.TwoDevelopment.LogisticsManagement { try { - return accommodationService.GetSelectData(strWhere).Select(x => new Acc_DormitoryBuildEntity { Class = x.Class, ClassName = x.ClassName }).Distinct().ToList(); + return accommodationService.GetDeptOrMajorOrClass(strWhere).Select(x => new Acc_DormitoryBuildEntity { Class = x.Class, ClassName = x.ClassName }).Distinct().ToList(); } catch (Exception ex) { @@ -365,7 +420,6 @@ namespace Learun.Application.TwoDevelopment.LogisticsManagement } } } - /// /// 获取左侧树形数据 /// diff --git a/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.TwoDevelopment/LogisticsManagement/Accommodation/AccommodationService.cs b/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.TwoDevelopment/LogisticsManagement/Accommodation/AccommodationService.cs index 6eed65103..05b5b1f0e 100644 --- a/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.TwoDevelopment/LogisticsManagement/Accommodation/AccommodationService.cs +++ b/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.TwoDevelopment/LogisticsManagement/Accommodation/AccommodationService.cs @@ -1887,6 +1887,46 @@ where ID='{ParentID}' } } } + + + public List GetDeptOrMajorOrClass(string strWhere) + { + try + { + string sql1 = " select distinct dept,d.DeptName from Acc_DormitoryBuild t join CdDept d on t.dept=d.deptno"; + string sql2 = " select distinct major,m.MajorName from Acc_DormitoryBuild t join CdMajor m on t.major=m.majorno"; + string sql3 = " select distinct class,c.ClassName from Acc_DormitoryBuild t join ClassInfo c on t.class=c.classno"; + string sql = @" where t.ID in ( + select parentid from[dbo].[Acc_DormitoryBuild] where BuildType = '5' and(studentid is not null and len(studentid) > 0) + )"; + if (string.IsNullOrEmpty(strWhere)) + { + sql = sql1 + sql; + } + else if (strWhere.Contains("deptno")) + { + sql = sql2 + sql + " and " + strWhere; + } + else if (strWhere.Contains("majorno")) + { + sql = sql3 + sql + " and " + strWhere; + } + return this.BaseRepository("CollegeMIS").FindList(sql).ToList(); + + } + catch (Exception ex) + { + if (ex is ExceptionEx) + { + throw; + } + else + { + throw ExceptionEx.ThrowServiceException(ex); + } + } + } + #endregion 提交数据 } } \ No newline at end of file