123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566 |
- using System;
- using System.Collections.Generic;
- using System.Linq;
- using System.Text;
- using EMIS.DataLogic.Repositories;
- using EMIS.ViewModel;
- using System.Linq.Expressions;
- using EMIS.Entities;
- namespace EMIS.DataLogic.Common.AdministrativeOrgan
- {
- public class DepartmentDAL
- {
- public DepartmentRepository DepartmentRepository { get; set; }
- public DepartmentProfileRepository DepartmentProfileRepository { get; set; }
- public CollegeRepository CollegeRepository { get; set; }
- public UserRepository UserRepository { get; set; }
- public StaffRepository StaffRepository { get; set; }
- /// <summary>
- /// 查询对应的部门信息View
- /// </summary>
- /// <param name="expDepartment"></param>
- /// <returns></returns>
- public IQueryable<DepartmentView> GetDepartmentViewQueryable(Expression<Func<CF_Department, bool>> expDepartment)
- {
- var query = from dep in DepartmentRepository.GetList(expDepartment)
- join c in UserRepository.Entities
- on dep.CF_DepartmentProfile.DirectorID equals c.UserID
- into gu
- from guic in gu.DefaultIfEmpty()
- join d in UserRepository.Entities
- on dep.CF_DepartmentProfile.DeputyDirectorID equals d.UserID
- into gude
- from gudeic in gude.DefaultIfEmpty()
- select new DepartmentView
- {
- DepartmentID = dep.DepartmentID,
- No = dep.No,
- Name = dep.Name,
- SimpleName = dep.SimpleName,
- EnglishName = dep.EnglishName,
- CampusID = dep.CF_College.CampusID,
- CampusNo = dep.CF_College.CF_Campus.No,
- CampusName = dep.CF_College.CF_Campus.Name,
- CollegeID = dep.CollegeID,
- CollegeCode = dep.CF_College.No,
- CollegeName = dep.CF_College.Name,
- HierarchyID = dep.HierarchyID,
- DirectorID = dep.CF_DepartmentProfile.DirectorID,
- DirectorName = guic.Name,
- DeputyDirectorID = dep.CF_DepartmentProfile.DeputyDirectorID,
- DeputyDirectorName = gudeic.Name,
- FoundDate = dep.CF_DepartmentProfile.FoundDate,
- Remark = dep.Remark,
- RecordStatus = dep.RecordStatus,
- CreateUserID = dep.CreateUserID,
- CreateTime = dep.CreateTime,
- ModifyUserID = dep.ModifyUserID,
- ModifyTime = dep.ModifyTime
- };
- return query;
- }
- }
- }
|