zoukankan      html  css  js  c++  java
  • abp中linq的应用

     private IQueryable<MembershipEntity> SelectOrScrrenMember(GetMemberInput input)
            {
                string[] userDefinedFilter = null;
    
                if (!input.UserDefinedFilter.IsNullOrWhiteSpace())
                {
                    userDefinedFilter = input.UserDefinedFilter.Split(new string[] { "," }, StringSplitOptions.RemoveEmptyEntries);//不保留空元素
                }
    
                var query = from m in _memberRepository.GetAll()
                            join s in _VipcardRepository.GetAll() on m.Id equals s.MEMBER_CODE
                            join g in _VipcardgradeRepository.GetAll() on s.VIP_CARD_GRADE equals g.CARDGRADECODE
                            select new MembershipEntity
                            {
                                Id = m.Id,
                                ENGLISH_NAME = m.ENGLISH_NAME,
                                CHINESE_NAME = m.CHINESE_NAME,
                                E_MAIL = m.E_MAIL,
                                PHONE_NO_MOBILE = m.PHONE_NO_MOBILE,
                                PHONE_NO_HOME = m.PHONE_NO_HOME,
                                PHONE_NO_OFFICE = m.PHONE_NO_OFFICE,
                                ID_NO = m.ID_NO,
                                REMARK = m.REMARK,
                                CARD_NO = s.CARD_NO,
                                VIP_CARD_GROUP = s.VIP_CARD_GROUP,
                                VIP_CARD_GRADE = s.VIP_CARD_GRADE,
                                CARDGRADEDESC = g.CARDGRADEDESC,
                                IS_ARTIST = m.IS_ARTIST,
                                STATUS = m.STATUS,
                                UserDefinedField = m.USER_DEFINED_FIELD
                            };
                query = query.WhereIf(!input.ENGLISH_NAME.IsNullOrWhiteSpace(), item => item.ENGLISH_NAME.Contains(input.ENGLISH_NAME))
                    .WhereIf(!input.MEMBER_CODE.IsNullOrWhiteSpace(), item => item.Id.Contains(input.MEMBER_CODE))
                    .WhereIf(!input.PHONE_NO_HOME.IsNullOrWhiteSpace(), item => item.PHONE_NO_HOME.Contains(input.PHONE_NO_HOME))
                    .WhereIf(!input.PHONE_NO_MOBILE.IsNullOrWhiteSpace(), item => item.PHONE_NO_MOBILE.Contains(input.PHONE_NO_MOBILE));
    
                if (userDefinedFilter != null)
                {
                    foreach (var filter in userDefinedFilter)
                    {
                        query = query.Where(item => item.UserDefinedField.Contains(filter));
                    }
                }
    
                return query;
    
    
            }
  • 相关阅读:
    iozone
    2019-11-23-WPF-使用-RawInput-接收裸数据
    2019-11-22-Roslyn-在多开发框架让-msbuild-的-Target-仅运行一次
    2019-3-1-C#-json-转-xml-字符串
    2018-11-19-visualStudio-无法登陆
    2019-4-21-Roslyn-通过-NuGet-库修改应用程序入口函数
    2019-8-31-dotnet-core-集成到-Mattermost-聊天工具
    2019-7-29-win10-UWP-使用-MD5算法
    2018-8-10-C#-TimeSpan-时间计算
    2019-6-15-WPF-触摸到事件
  • 原文地址:https://www.cnblogs.com/huanhuan55/p/10245760.html
Copyright © 2011-2022 走看看