Example #1
0
 /// <summary>
 /// 导出员工信息
 /// </summary>
 public Jinher.AMP.BTP.Deploy.CustomDTO.ResultDTO <Jinher.AMP.BTP.Deploy.CustomDTO.ListResult <Jinher.AMP.BTP.Deploy.YJEmployeeDTO> > ExportYJEmployeeListExt(Jinher.AMP.BTP.Deploy.CustomDTO.YJEmployee.YJEmployeeSearchDTO input)
 {
     try
     {
         var query = YJEmployee.ObjectSet().Where(_ => _.IsDel == 0 && _.AppId == input.AppId).AsQueryable();
         if (!string.IsNullOrWhiteSpace(input.UserCode))
         {
             query = query.Where(_ => _.UserCode == input.UserCode);
         }
         if (!string.IsNullOrWhiteSpace(input.UserAccount))
         {
             query = query.Where(_ => _.UserAccount == input.UserAccount);
         }
         if (!string.IsNullOrWhiteSpace(input.UserName))
         {
             query = query.Where(_ => _.UserName.Contains(input.UserName) || input.Phone.Contains(_.UserName));
         }
         if (!string.IsNullOrWhiteSpace(input.Phone))
         {
             query = query.Where(_ => _.Phone == input.Phone);
         }
         if (!string.IsNullOrWhiteSpace(input.Area))
         {
             query = query.Where(_ => _.Area == input.Area);
         }
         if (!string.IsNullOrWhiteSpace(input.Area))
         {
             query = query.Where(_ => _.Area == input.Area);
         }
         if (!string.IsNullOrWhiteSpace(input.StationCode))
         {
             query = query.Where(_ => _.StationCode.Contains(input.StationCode) || input.StationCode.Contains(_.StationCode));
         }
         if (!string.IsNullOrWhiteSpace(input.StationName))
         {
             query = query.Where(_ => _.StationName.Contains(input.StationName) || input.StationName.Contains(_.StationName));
         }
         if (input.IsManager > 0)
         {
             query = query.Where(_ => _.IsManager == input.IsManager);
         }
         if (!string.IsNullOrWhiteSpace(input.Department))
         {
             query = query.Where(_ => _.Department == input.Department);
         }
         if (!string.IsNullOrWhiteSpace(input.Station))
         {
             query = query.Where(_ => _.Station == input.Station);
         }
         var count = query.Count();
         var data  = (from n in query
                      select new Jinher.AMP.BTP.Deploy.YJEmployeeDTO
         {
             Id = n.Id,
             UserCode = n.UserCode,
             UserAccount = n.UserAccount,
             UserName = n.UserName,
             IdentityNum = n.IdentityNum,
             Phone = n.Phone,
             Area = n.Area,
             StationCode = n.StationCode,
             StationName = n.StationName,
             SubOn = n.SubOn,
             IsManager = n.IsManager,
             Department = n.Department,
             Station = n.Station
         }).OrderByDescending(q => q.SubOn).ToList();
         return(new ResultDTO <ListResult <Jinher.AMP.BTP.Deploy.YJEmployeeDTO> >
         {
             isSuccess = true,
             Data = new ListResult <Jinher.AMP.BTP.Deploy.YJEmployeeDTO> {
                 List = data, Count = count
             }
         });
     }
     catch (Exception ex)
     {
         LogHelper.Error("YJEmployeeBP.ExportYJEmployeeListExt 异常", ex);
         return(new ResultDTO <ListResult <Jinher.AMP.BTP.Deploy.YJEmployeeDTO> > {
             isSuccess = false, Data = null
         });
     }
 }
Example #2
0
        /// <summary>
        /// 查询员工信息
        /// </summary>
        public Jinher.AMP.BTP.Deploy.CustomDTO.ResultDTO <Jinher.AMP.BTP.Deploy.CustomDTO.ListResult <Jinher.AMP.BTP.Deploy.YJEmployeeDTO> > GetYJEmployeeListExt(Jinher.AMP.BTP.Deploy.CustomDTO.YJEmployee.YJEmployeeSearchDTO input)
        {
            var query = YJEmployee.ObjectSet().Where(_ => _.AppId == input.AppId && _.IsDel == 0).AsQueryable();

            if (!string.IsNullOrWhiteSpace(input.UserCode))
            {
                query = query.Where(_ => _.UserCode == input.UserCode);
            }
            if (!string.IsNullOrWhiteSpace(input.UserAccount))
            {
                query = query.Where(_ => _.UserAccount == input.UserAccount);
            }
            if (!string.IsNullOrWhiteSpace(input.UserName))
            {
                query = query.Where(_ => _.UserName.Contains(input.UserName) || input.Phone.Contains(_.UserName));
            }
            if (!string.IsNullOrWhiteSpace(input.Phone))
            {
                query = query.Where(_ => _.Phone == input.Phone);
            }
            if (!string.IsNullOrWhiteSpace(input.Area))
            {
                query = query.Where(_ => input.Area.Contains(_.Area) || _.Area.Contains(input.Area));
            }
            if (!string.IsNullOrWhiteSpace(input.StationCode))
            {
                query = query.Where(_ => _.StationCode.Contains(input.StationCode) || input.StationCode.Contains(_.StationCode));
            }
            if (!string.IsNullOrWhiteSpace(input.StationName))
            {
                query = query.Where(_ => _.StationName.Contains(input.StationName) || input.StationName.Contains(_.StationName));
            }
            if (!string.IsNullOrWhiteSpace(input.IdentityNum))
            {
                query = query.Where(_ => _.IdentityNum == input.IdentityNum);
            }
            if (input.IsManager > 0)
            {
                query = query.Where(_ => _.IsManager == input.IsManager);
            }
            if (!string.IsNullOrWhiteSpace(input.Department))
            {
                query = query.Where(_ => input.Department.Contains(_.Department) || _.Department.Contains(input.Department));
            }
            if (!string.IsNullOrWhiteSpace(input.Station))
            {
                query = query.Where(_ => input.Station.Contains(_.Station) || _.Station.Contains(input.Station));
            }
            var count = query.Count();
            var data  = (from n in query
                         select new Jinher.AMP.BTP.Deploy.YJEmployeeDTO
            {
                Id = n.Id,
                UserCode = n.UserCode,
                UserAccount = n.UserAccount,
                UserName = n.UserName,
                IdentityNum = n.IdentityNum,
                Phone = n.Phone,
                Area = n.Area,
                StationCode = n.StationCode,
                StationName = n.StationName,
                SubOn = n.SubOn,
                IsManager = n.IsManager,
                Department = n.Department,
                Station = n.Station
            }).OrderByDescending(q => q.SubOn).Skip((input.PageIndex - 1) * input.PageSize).Take(input.PageSize).ToList();

            return(new ResultDTO <ListResult <Jinher.AMP.BTP.Deploy.YJEmployeeDTO> >
            {
                isSuccess = true,
                Data = new ListResult <Jinher.AMP.BTP.Deploy.YJEmployeeDTO> {
                    List = data, Count = count
                }
            });
        }