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;
    
    
            }
  • 相关阅读:
    Postman初探
    web页面和本地数据对比问题
    Katalon Recorder初探
    Flask入门
    自我实现预言
    gulp 安装 依赖
    maven环境
    加解密 生成 X.509格式,DER编码,后缀名.cer。加密公钥证书
    我的魔法 公式找回中
    gulp 自动ftp至服务器时,处理开发 测试服务器地址问题
  • 原文地址:https://www.cnblogs.com/huanhuan55/p/10245760.html
Copyright © 2011-2022 走看看