@@ -315,7 +315,7 @@ namespace Learun.Application.TwoDevelopment.LogisticsManagement | |||||
{ | { | ||||
try | 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) | catch (Exception ex) | ||||
{ | { | ||||
@@ -333,7 +333,7 @@ namespace Learun.Application.TwoDevelopment.LogisticsManagement | |||||
{ | { | ||||
try | 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) | catch (Exception ex) | ||||
{ | { | ||||
@@ -351,7 +351,7 @@ namespace Learun.Application.TwoDevelopment.LogisticsManagement | |||||
{ | { | ||||
try | 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) | catch (Exception ex) | ||||
{ | { | ||||
@@ -823,6 +823,45 @@ a.name as ApartmentName,b.name as UnitName,c.Name as FloorName | |||||
} | } | ||||
} | } | ||||
public List<Acc_DormitoryBuildEntity> 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<Acc_DormitoryBuildEntity>(sql).ToList(); | |||||
} | |||||
catch (Exception ex) | |||||
{ | |||||
if (ex is ExceptionEx) | |||||
{ | |||||
throw; | |||||
} | |||||
else | |||||
{ | |||||
throw ExceptionEx.ThrowServiceException(ex); | |||||
} | |||||
} | |||||
} | |||||
/// <summary> | /// <summary> | ||||
/// 获取非空床的系部专业 班级 | /// 获取非空床的系部专业 班级 | ||||
/// </summary> | /// </summary> | ||||