OL.FrameCore.Application/Dept/DeptService.cs

(开头部分) 6KB

这里只显示每个文件的开头 60 行。登录后可以解锁完整代码。

using OL.FrameCore.Application.Dept.Dto;
using OL.FrameCore.Domain.Entity;
using OL.FrameCore.Infrastructure.UnitOfWork;
//using OL.FrameCore.Domain.IRepository;
using System;
using System.Collections.Generic;
using System.Text;
using System.Linq;
using Microsoft.EntityFrameworkCore;
using OL.FrameCore.Repository.EF;

namespace OL.FrameCore.Application.Dept
{
    public class DeptService :  IDeptService
    {
        //IDeptRepository _repository;
        IUnitOfWork _unitOfwork;
        //IUnitOfWork<ReadOnlyDataContext> _unitOfwork;
        public DeptService(IUnitOfWork unitOfwork)
        {
            _unitOfwork = unitOfwork;
        }

        /// <summary>
        /// 获取所有部门列表
        /// </summary>
        /// <returns></returns>
        public IList<GetDeptListModel> GetAllDeptList()
        {
            var repositoryDept = _unitOfwork.GetRepository<SysDept>();
            var query = from a in repositoryDept.TableNoTracking
                        where a.IsDelete== false
                        orderby a.SortIndex
                        select new GetDeptListModel
                        {
                            Id = a.Id,
                            DeptName = a.DeptName,
                            ParentId = a.ParentId,
                            DeptLevel = a.DeptLevel,
                            SortIndex = a.SortIndex
                        };
            return query.ToList();
        }

        /// <summary>
        /// 获取部门列表
        /// </summary>
        /// <param name="request"></param>
        /// <returns></returns>
        public PageData<GetDeptListModel> GetDeptList(GetDeptListRequest request)
        {
            var repositoryDept = _unitOfwork.GetRepository<SysDept>();
            var query = from a in repositoryDept.TableNoTracking
                        join b in repositoryDept.TableNoTracking on a.ParentId equals b.Id into tmpB
                        from b in tmpB.DefaultIfEmpty()
                        where a.IsDelete == false
                        && (request.DeptId.HasValue ? a.Id == request.DeptId : true)
                        && (string.IsNullOrEmpty(request.DeptName) ? true : a.DeptName == request.DeptName)
                        && (string.IsNullOrEmpty(request.DeptCode) ? true : a.DeptCode == request.DeptCode)
                        && (request.ParentId.HasValue ? a.ParentId == request.ParentId : true)
后面还有 122 行代码,解锁后查看完整代码

24 小时内免费解锁 3 个项目,之后 1 积分/个。 规则说明

AI 解读

登录后可用,每次 10 积分,解读结果公开显示在下面。

还没有人解读过这个文件。