示例#1
0
        /// <summary>
        /// 未查询到数据时返回 null
        /// </summary>
        public static TUserBasicInfo DbSelect(this TUserBasicInfo entity, DbSession session, params PDMDbProperty[] fields)
        {
            var           query   = IORMProvider.GetDbQueryBuilder(session);
            SelectBuilder builder = new SelectBuilder();

            if (fields.Count() == 0)
            {
                builder.ComponentSelect.Add(TUserBasicInfoProperties.UserName);
                builder.ComponentSelect.Add(TUserBasicInfoProperties.Gender);
                builder.ComponentSelect.Add(TUserBasicInfoProperties.Birthday);
                builder.ComponentSelect.Add(TUserBasicInfoProperties.Mobile);
                builder.ComponentSelect.Add(TUserBasicInfoProperties.Email);
                builder.ComponentSelect.Add(TUserBasicInfoProperties.IdCardNumber);
            }
            else
            {
                builder.ComponentSelect.Add(TUserBasicInfoProperties.UserName);
                foreach (var field in fields)
                {
                    builder.ComponentSelect.Add(field);
                }
            }
            builder.ComponentWhere.Add(new ComponentValueOfWhere(TUserBasicInfoProperties.UserName, entity.UserName, LocateType.Equal));
            query.SelectBuilders.Add(builder);
            return(IORMProvider.GetQueryOperator(session).Select <TUserBasicInfo>(session, query));
        }
示例#2
0
        public static bool DbDelete(this TUserBasicInfo entity, DbSession session)
        {
            var query = IORMProvider.GetDbQueryBuilder(session);

            query.DeleteBuilder.ComponentWhere.Add(new ComponentValueOfWhere(TUserBasicInfoProperties.UserName, entity.UserName, LocateType.Equal));
            return(IORMProvider.GetQueryOperator(session).Delete <TUserBasicInfo>(session, query));
        }
        public static bool DbUpdate(this List <TCreatureQuality> entities, DbSession session, params PDMDbProperty[] fields)
        {
            var query = IORMProvider.GetDbQueryBuilder(session);

            foreach (var entity in entities)
            {
                UpdateBuilder builder = new UpdateBuilder();
                builder.ComponentWhere.Add(new ComponentValueOfWhere(TCreatureQualityProperties.CreatureId, entity.CreatureId, LocateType.Equal));
                if (fields == null || fields.Length == 0)
                {
                    builder.ComponentSet.Add(new ComponentValueOfSet(TCreatureQualityProperties.CreatureId, entity.CreatureId));
                    builder.ComponentSet.Add(new ComponentValueOfSet(TCreatureQualityProperties.FirstLevelQuality, entity.FirstLevelQuality));
                    builder.ComponentSet.Add(new ComponentValueOfSet(TCreatureQualityProperties.SecondLevelQuality, entity.SecondLevelQuality));
                    builder.ComponentSet.Add(new ComponentValueOfSet(TCreatureQualityProperties.ThirdLevelQuality, entity.ThirdLevelQuality));
                }
                else
                {
                    if (fields.Contains(TCreatureQualityProperties.FirstLevelQuality))
                    {
                        builder.ComponentSet.Add(new ComponentValueOfSet(TCreatureQualityProperties.FirstLevelQuality, entity.FirstLevelQuality));
                    }
                    if (fields.Contains(TCreatureQualityProperties.SecondLevelQuality))
                    {
                        builder.ComponentSet.Add(new ComponentValueOfSet(TCreatureQualityProperties.SecondLevelQuality, entity.SecondLevelQuality));
                    }
                    if (fields.Contains(TCreatureQualityProperties.ThirdLevelQuality))
                    {
                        builder.ComponentSet.Add(new ComponentValueOfSet(TCreatureQualityProperties.ThirdLevelQuality, entity.ThirdLevelQuality));
                    }
                }
                query.UpdateBuilders.Add(builder);
            }
            return(IORMProvider.GetQueryOperator(session).UpdateAll <TCreatureQuality>(session, query));
        }
示例#4
0
        public static bool FetchTUser(this TUserBasicInfo tUserBasicInfo, DbSession session)
        {
            var           query   = IORMProvider.GetDbQueryBuilder(session);
            SelectBuilder builder = new SelectBuilder();

            if (tUserBasicInfo.UserId == Guid.Empty)
            {
                var subselect = new SelectBuilder();
                subselect.TableName = nameof(TUserBasicInfo);
                subselect.ComponentSelect.Add(TUserBasicInfoProperties.UserId);
                subselect.ComponentWhere.Add(new ComponentValueOfWhere(TUserBasicInfoProperties.UserId, tUserBasicInfo.UserId, LocateType.Equal));
                builder.ComponentWhere.Add(new ComponentValueOfWhere(TUserProperties.UserId, subselect, LocateType.Equal));
            }
            else
            {
                builder.ComponentWhere.Add(new ComponentValueOfWhere(TUserProperties.UserId, tUserBasicInfo.UserId, LocateType.Equal));
            }
            query.SelectBuilders.Add(builder);
            tUserBasicInfo.User = IORMProvider.GetQueryOperator(session).Select <TUser>(session, query);
            if (tUserBasicInfo.User == null)
            {
                throw new NotImplementedException(string.Format("1..* 关联未查询到匹配数据, Parent:{0}; Child: {1}", nameof(TUserBasicInfo), nameof(TUser)));
            }
            return(true);
        }
示例#5
0
        public static bool DbInsert(this TPrototypeCreature entity, DbSession session)
        {
            var           query   = IORMProvider.GetDbQueryBuilder(session);
            InsertBuilder builder = new InsertBuilder();

            builder.ComponentInsert.Add(new ComponentValueOfInsert(TPrototypeCreatureProperties.CreatureId, entity.CreatureId));
            builder.ComponentInsert.Add(new ComponentValueOfInsert(TPrototypeCreatureProperties.CreatureType, entity.CreatureType));
            builder.ComponentInsert.Add(new ComponentValueOfInsert(TPrototypeCreatureProperties.CreatureUseType, entity.CreatureUseType));
            if (entity.Name == null)
            {
                throw new NotImplementedException("缺少必填的参数项值, 参数项: " + nameof(entity.Name));
            }
            builder.ComponentInsert.Add(new ComponentValueOfInsert(TPrototypeCreatureProperties.Name, entity.Name));
            builder.ComponentInsert.Add(new ComponentValueOfInsert(TPrototypeCreatureProperties.Level, entity.Level));
            builder.ComponentInsert.Add(new ComponentValueOfInsert(TPrototypeCreatureProperties.Profession, entity.Profession));
            if (entity.Properties == null)
            {
                throw new NotImplementedException("缺少必填的参数项值, 参数项: " + nameof(entity.Properties));
            }
            builder.ComponentInsert.Add(new ComponentValueOfInsert(TPrototypeCreatureProperties.Properties, entity.Properties));
            if (entity.Skills == null)
            {
                throw new NotImplementedException("缺少必填的参数项值, 参数项: " + nameof(entity.Skills));
            }
            builder.ComponentInsert.Add(new ComponentValueOfInsert(TPrototypeCreatureProperties.Skills, entity.Skills));
            if (entity.Qualities == null)
            {
                throw new NotImplementedException("缺少必填的参数项值, 参数项: " + nameof(entity.Qualities));
            }
            builder.ComponentInsert.Add(new ComponentValueOfInsert(TPrototypeCreatureProperties.Qualities, entity.Qualities));
            query.InsertBuilders.Add(builder);
            return(IORMProvider.GetQueryOperator(session).Insert <TPrototypeCreature>(session, query));
        }
示例#6
0
        public static bool DbInsert(this List <TArea> entities, DbSession session)
        {
            var query = IORMProvider.GetDbQueryBuilder(session);

            foreach (var entity in entities)
            {
                InsertBuilder builder = new InsertBuilder();
                builder.ComponentInsert.Add(new ComponentValueOfInsert(TAreaProperties.AreaId, entity.AreaId));
                if (entity.AreaName == null)
                {
                    throw new NotImplementedException("缺少必填的参数项值, 参数项: " + nameof(entity.AreaName));
                }
                builder.ComponentInsert.Add(new ComponentValueOfInsert(TAreaProperties.AreaName, entity.AreaName));
                builder.ComponentInsert.Add(new ComponentValueOfInsert(TAreaProperties.AreaLevel, entity.AreaLevel));
                builder.ComponentInsert.Add(new ComponentValueOfInsert(TAreaProperties.AreaType, entity.AreaType));
                if (entity.Description == null)
                {
                    throw new NotImplementedException("缺少必填的参数项值, 参数项: " + nameof(entity.Description));
                }
                builder.ComponentInsert.Add(new ComponentValueOfInsert(TAreaProperties.Description, entity.Description));
                if (entity.DescriptionEx == null)
                {
                    throw new NotImplementedException("缺少必填的参数项值, 参数项: " + nameof(entity.DescriptionEx));
                }
                builder.ComponentInsert.Add(new ComponentValueOfInsert(TAreaProperties.DescriptionEx, entity.DescriptionEx));
                query.InsertBuilders.Add(builder);
            }
            return(IORMProvider.GetQueryOperator(session).InsertAll <TArea>(session, query));
        }
示例#7
0
        /// <summary>
        /// 未查询到数据时返回 null
        /// </summary>
        public static List <TUserBasicInfo> DbSelect(this List <TUserBasicInfo> entities, DbSession session, params PDMDbProperty[] fields)
        {
            var           query   = IORMProvider.GetDbQueryBuilder(session);
            SelectBuilder builder = new SelectBuilder();

            if (fields.Count() == 0)
            {
                builder.ComponentSelect.Add(TUserBasicInfoProperties.UserId);
                builder.ComponentSelect.Add(TUserBasicInfoProperties.Gender);
                builder.ComponentSelect.Add(TUserBasicInfoProperties.Birthday);
                builder.ComponentSelect.Add(TUserBasicInfoProperties.Mobile);
                builder.ComponentSelect.Add(TUserBasicInfoProperties.Email);
                builder.ComponentSelect.Add(TUserBasicInfoProperties.IdCardNumber);
            }
            else
            {
                builder.ComponentSelect.Add(TUserBasicInfoProperties.UserId);
                foreach (var field in fields)
                {
                    builder.ComponentSelect.Add(field);
                }
            }
            var Ids = entities.Select(c => c.UserId);

            if (Ids.Count() != 0)
            {
                builder.ComponentWhere.Add(new ComponentValueOfWhere(TUserBasicInfoProperties.UserId, Ids, LocateType.In));
            }
            query.SelectBuilders.Add(builder);
            return(IORMProvider.GetQueryOperator(session).SelectAll <TUserBasicInfo>(session, query));
        }
示例#8
0
        public static bool DbInsert(this List <TUserBasicInfo> entities, DbSession session)
        {
            var query = IORMProvider.GetDbQueryBuilder(session);

            foreach (var entity in entities)
            {
                InsertBuilder builder = new InsertBuilder();
                builder.ComponentInsert.Add(new ComponentValueOfInsert(TUserBasicInfoProperties.UserId, entity.UserId));
                builder.ComponentInsert.Add(new ComponentValueOfInsert(TUserBasicInfoProperties.Gender, entity.Gender));
                if (entity.Birthday.HasValue)
                {
                    builder.ComponentInsert.Add(new ComponentValueOfInsert(TUserBasicInfoProperties.Birthday, entity.Birthday.Value));
                }
                if (entity.Mobile.HasValue)
                {
                    builder.ComponentInsert.Add(new ComponentValueOfInsert(TUserBasicInfoProperties.Mobile, entity.Mobile.Value));
                }
                if (entity.Email == null)
                {
                    throw new NotImplementedException("缺少必填的参数项值, 参数项: " + nameof(entity.Email));
                }
                builder.ComponentInsert.Add(new ComponentValueOfInsert(TUserBasicInfoProperties.Email, entity.Email));
                if (entity.IdCardNumber == null)
                {
                    throw new NotImplementedException("缺少必填的参数项值, 参数项: " + nameof(entity.IdCardNumber));
                }
                builder.ComponentInsert.Add(new ComponentValueOfInsert(TUserBasicInfoProperties.IdCardNumber, entity.IdCardNumber));
                query.InsertBuilders.Add(builder);
            }
            return(IORMProvider.GetQueryOperator(session).InsertAll <TUserBasicInfo>(session, query));
        }
示例#9
0
        public static List <TCreatureSkill> DbSelect(this List <TCreatureSkill> entities, DbSession session, params PDMDbProperty[] fields)
        {
            var           query   = IORMProvider.GetDbQueryBuilder(session);
            SelectBuilder builder = new SelectBuilder();

            if (fields.Count() == 0)
            {
                builder.ComponentSelect.Add(TCreatureSkillProperties.CreatureId);
                builder.ComponentSelect.Add(TCreatureSkillProperties.SurvivalSkill);
                builder.ComponentSelect.Add(TCreatureSkillProperties.WarriorSkills);
                builder.ComponentSelect.Add(TCreatureSkillProperties.ExplorerSkills);
                builder.ComponentSelect.Add(TCreatureSkillProperties.FarmingSkills);
                builder.ComponentSelect.Add(TCreatureSkillProperties.RasingSkills);
                builder.ComponentSelect.Add(TCreatureSkillProperties.BowmanSkills);
                builder.ComponentSelect.Add(TCreatureSkillProperties.FishingSkills);
            }
            else
            {
                builder.ComponentSelect.Add(TCreatureSkillProperties.CreatureId);
                foreach (var field in fields)
                {
                    builder.ComponentSelect.Add(field);
                }
            }
            var Ids = entities.Select(c => c.CreatureId);

            if (Ids.Count() != 0)
            {
                builder.ComponentWhere.Add(new ComponentValueOfWhere(TCreatureSkillProperties.CreatureId, Ids, LocateType.In));
            }
            query.SelectBuilders.Add(builder);
            return(IORMProvider.GetQueryOperator(session).SelectAll <TCreatureSkill>(session, query));
        }
示例#10
0
        /// <summary>
        /// 未查询到数据时返回 null
        /// </summary>
        public static TUserBasicInfo DbSelect(this TUserBasicInfo entity, DbSession session, SelectBuilder select)
        {
            var query = IORMProvider.GetDbQueryBuilder(session);

            query.SelectBuilder = select;
            return(IORMProvider.GetQueryOperator(session).Select <TUserBasicInfo>(session, query));
        }
示例#11
0
        public static bool DbUpdate(this TUser entity, DbSession session, params PDMDbProperty[] fields)
        {
            var           query   = IORMProvider.GetDbQueryBuilder(session);
            UpdateBuilder builder = new UpdateBuilder();

            builder.ComponentWhere.Add(new ComponentValueOfWhere(TUserProperties.UserId, entity.UserId, LocateType.Equal));
            if (fields == null || fields.Length == 0)
            {
                builder.ComponentSet.Add(new ComponentValueOfSet(TUserProperties.UserId, entity.UserId));
                builder.ComponentSet.Add(new ComponentValueOfSet(TUserProperties.UserName, entity.UserName));
                builder.ComponentSet.Add(new ComponentValueOfSet(TUserProperties.Password, entity.Password));
                builder.ComponentSet.Add(new ComponentValueOfSet(TUserProperties.CreateTime, entity.CreateTime));
            }
            else
            {
                if (fields.Contains(TUserProperties.UserName))
                {
                    builder.ComponentSet.Add(new ComponentValueOfSet(TUserProperties.UserName, entity.UserName));
                }
                if (fields.Contains(TUserProperties.Password))
                {
                    builder.ComponentSet.Add(new ComponentValueOfSet(TUserProperties.Password, entity.Password));
                }
                if (fields.Contains(TUserProperties.CreateTime))
                {
                    builder.ComponentSet.Add(new ComponentValueOfSet(TUserProperties.CreateTime, entity.CreateTime));
                }
            }
            query.UpdateBuilders.Add(builder);
            return(IORMProvider.GetQueryOperator(session).Update <TUser>(session, query));
        }
示例#12
0
        /// <summary>
        /// 未查询到数据时返回 null
        /// </summary>
        public static TGrabList DbSelect(this TGrabList entity, DbSession session, params PDMDbProperty[] fields)
        {
            var           query   = IORMProvider.GetDbQueryBuilder(session);
            SelectBuilder builder = new SelectBuilder();

            if (fields.Count() == 0)
            {
                builder.ComponentSelect.Add(TGrabListProperties.ListItemId);
                builder.ComponentSelect.Add(TGrabListProperties.SpiderId);
                builder.ComponentSelect.Add(TGrabListProperties.IssueName);
                builder.ComponentSelect.Add(TGrabListProperties.OrderNumber);
                builder.ComponentSelect.Add(TGrabListProperties.Title);
                builder.ComponentSelect.Add(TGrabListProperties.URL);
                builder.ComponentSelect.Add(TGrabListProperties.Remark);
                builder.ComponentSelect.Add(TGrabListProperties.DetailFilePath);
            }
            else
            {
                builder.ComponentSelect.Add(TGrabListProperties.SpiderId);
                builder.ComponentSelect.Add(TGrabListProperties.IssueName);
                builder.ComponentSelect.Add(TGrabListProperties.OrderNumber);
                foreach (var field in fields)
                {
                    builder.ComponentSelect.Add(field);
                }
            }
            builder.ComponentWhere.Add(new ComponentValueOfWhere(TGrabListProperties.SpiderId, entity.SpiderId, LocateType.Equal));
            builder.ComponentWhere.Add(new ComponentValueOfWhere(TGrabListProperties.IssueName, entity.IssueName, LocateType.Equal));
            builder.ComponentWhere.Add(new ComponentValueOfWhere(TGrabListProperties.OrderNumber, entity.OrderNumber, LocateType.Equal));
            query.SelectBuilders.Add(builder);
            return(IORMProvider.GetQueryOperator(session).Select <TGrabList>(session, query));
        }
        public static bool FetchTMSAlgorithm(this TMSAlgorithmSettings tMSAlgorithmSettings, DbSession session)
        {
            var           query   = IORMProvider.GetDbQueryBuilder(session);
            SelectBuilder builder = new SelectBuilder();

            if (tMSAlgorithmSettings.AlgorithmId == Guid.Empty)
            {
                var subselect = new SelectBuilder();
                subselect.TableName = nameof(TMSAlgorithmSettings);
                subselect.ComponentSelect.Add(TMSAlgorithmSettingsProperties.AlgorithmId);
                subselect.ComponentWhere.Add(new ComponentValueOfWhere(TMSAlgorithmSettingsProperties.SubWeightType, tMSAlgorithmSettings.SubWeightType, LocateType.Equal));
                builder.ComponentWhere.Add(new ComponentValueOfWhere(TMSAlgorithmProperties.AlgorithmId, subselect, LocateType.Equal));
            }
            else
            {
                builder.ComponentWhere.Add(new ComponentValueOfWhere(TMSAlgorithmProperties.AlgorithmId, tMSAlgorithmSettings.AlgorithmId, LocateType.Equal));
            }
            query.SelectBuilders.Add(builder);
            tMSAlgorithmSettings.MSAlgorithm = IORMProvider.GetQueryOperator(session).Select <TMSAlgorithm>(session, query);
            if (tMSAlgorithmSettings.MSAlgorithm == null)
            {
                throw new NotImplementedException(string.Format("1..* 关联未查询到匹配数据, Parent:{0}; Child: {1}", nameof(TMSAlgorithmSettings), nameof(TMSAlgorithm)));
            }
            return(true);
        }
        /// <summary>
        /// 未查询到数据时返回 null
        /// </summary>
        public static List <TGrabRequest> DbSelect(this List <TGrabRequest> entities, DbSession session, params PDMDbProperty[] fields)
        {
            var           query   = IORMProvider.GetDbQueryBuilder(session);
            SelectBuilder builder = new SelectBuilder();

            if (fields.Count() == 0)
            {
                builder.ComponentSelect.Add(TGrabRequestProperties.RequestId);
                builder.ComponentSelect.Add(TGrabRequestProperties.SpiderId);
                builder.ComponentSelect.Add(TGrabRequestProperties.GrabType);
                builder.ComponentSelect.Add(TGrabRequestProperties.IssueName);
                builder.ComponentSelect.Add(TGrabRequestProperties.SpiderName);
                builder.ComponentSelect.Add(TGrabRequestProperties.ProcessStatus);
                builder.ComponentSelect.Add(TGrabRequestProperties.Message);
            }
            else
            {
                builder.ComponentSelect.Add(TGrabRequestProperties.SpiderId);
                builder.ComponentSelect.Add(TGrabRequestProperties.GrabType);
                builder.ComponentSelect.Add(TGrabRequestProperties.IssueName);
                foreach (var field in fields)
                {
                    builder.ComponentSelect.Add(field);
                }
            }
            var Ids = entities.Select(c => c.SpiderId);

            if (Ids.Count() != 0)
            {
                builder.ComponentWhere.Add(new ComponentValueOfWhere(TGrabRequestProperties.SpiderId, Ids, LocateType.In));
            }
            query.SelectBuilders.Add(builder);
            return(IORMProvider.GetQueryOperator(session).SelectAll <TGrabRequest>(session, query));
        }
示例#15
0
        public static List <TCreatureProperty> DbSelect(this List <TCreatureProperty> entities, DbSession session, params PDMDbProperty[] fields)
        {
            var           query   = IORMProvider.GetDbQueryBuilder(session);
            SelectBuilder builder = new SelectBuilder();

            if (fields.Count() == 0)
            {
                builder.ComponentSelect.Add(TCreaturePropertyProperties.CreatureId);
                builder.ComponentSelect.Add(TCreaturePropertyProperties.HitPoint);
                builder.ComponentSelect.Add(TCreaturePropertyProperties.MagicPoint);
                builder.ComponentSelect.Add(TCreaturePropertyProperties.Strength);
                builder.ComponentSelect.Add(TCreaturePropertyProperties.Stamina);
                builder.ComponentSelect.Add(TCreaturePropertyProperties.Agility);
                builder.ComponentSelect.Add(TCreaturePropertyProperties.Intelligence);
                builder.ComponentSelect.Add(TCreaturePropertyProperties.Mentality);
            }
            else
            {
                builder.ComponentSelect.Add(TCreaturePropertyProperties.CreatureId);
                foreach (var field in fields)
                {
                    builder.ComponentSelect.Add(field);
                }
            }
            var Ids = entities.Select(c => c.CreatureId);

            if (Ids.Count() != 0)
            {
                builder.ComponentWhere.Add(new ComponentValueOfWhere(TCreaturePropertyProperties.CreatureId, Ids, LocateType.In));
            }
            query.SelectBuilders.Add(builder);
            return(IORMProvider.GetQueryOperator(session).SelectAll <TCreatureProperty>(session, query));
        }
示例#16
0
        public static bool DbUpdate(this List <TMSAlgorithmSettings> entities, DbSession session, params PDMDbProperty[] fields)
        {
            var query = IORMProvider.GetDbQueryBuilder(session);

            foreach (var entity in entities)
            {
                UpdateBuilder builder = new UpdateBuilder();
                builder.ComponentWhere.Add(new ComponentValueOfWhere(TMSAlgorithmSettingsProperties.AlgorithmId, entity.AlgorithmId, LocateType.Equal));
                builder.ComponentWhere.Add(new ComponentValueOfWhere(TMSAlgorithmSettingsProperties.TopWeightType, entity.TopWeightType, LocateType.Equal));
                builder.ComponentWhere.Add(new ComponentValueOfWhere(TMSAlgorithmSettingsProperties.SubWeightType, entity.SubWeightType, LocateType.Equal));
                if (fields == null || fields.Length == 0)
                {
                    builder.ComponentSet.Add(new ComponentValueOfSet(TMSAlgorithmSettingsProperties.AlgorithmId, entity.AlgorithmId));
                    builder.ComponentSet.Add(new ComponentValueOfSet(TMSAlgorithmSettingsProperties.TopWeightType, entity.TopWeightType));
                    builder.ComponentSet.Add(new ComponentValueOfSet(TMSAlgorithmSettingsProperties.SubWeightType, entity.SubWeightType));
                    builder.ComponentSet.Add(new ComponentValueOfSet(TMSAlgorithmSettingsProperties.ResultType, entity.ResultType));
                    builder.ComponentSet.Add(new ComponentValueOfSet(TMSAlgorithmSettingsProperties.WeightValue, entity.WeightValue));
                }
                else
                {
                    if (fields.Contains(TMSAlgorithmSettingsProperties.ResultType))
                    {
                        builder.ComponentSet.Add(new ComponentValueOfSet(TMSAlgorithmSettingsProperties.ResultType, entity.ResultType));
                    }
                    if (fields.Contains(TMSAlgorithmSettingsProperties.WeightValue))
                    {
                        builder.ComponentSet.Add(new ComponentValueOfSet(TMSAlgorithmSettingsProperties.WeightValue, entity.WeightValue));
                    }
                }
                query.UpdateBuilders.Add(builder);
            }
            return(IORMProvider.GetQueryOperator(session).UpdateAll <TMSAlgorithmSettings>(session, query));
        }
示例#17
0
        public static List <TMSAlgorithmSettings> DbSelect(this List <TMSAlgorithmSettings> entities, DbSession session, params PDMDbProperty[] fields)
        {
            var           query   = IORMProvider.GetDbQueryBuilder(session);
            SelectBuilder builder = new SelectBuilder();

            if (fields.Count() == 0)
            {
                builder.ComponentSelect.Add(TMSAlgorithmSettingsProperties.AlgorithmId);
                builder.ComponentSelect.Add(TMSAlgorithmSettingsProperties.TopWeightType);
                builder.ComponentSelect.Add(TMSAlgorithmSettingsProperties.SubWeightType);
                builder.ComponentSelect.Add(TMSAlgorithmSettingsProperties.ResultType);
                builder.ComponentSelect.Add(TMSAlgorithmSettingsProperties.WeightValue);
            }
            else
            {
                builder.ComponentSelect.Add(TMSAlgorithmSettingsProperties.AlgorithmId);
                builder.ComponentSelect.Add(TMSAlgorithmSettingsProperties.TopWeightType);
                builder.ComponentSelect.Add(TMSAlgorithmSettingsProperties.SubWeightType);
                foreach (var field in fields)
                {
                    builder.ComponentSelect.Add(field);
                }
            }
            var Ids = entities.Select(c => c.AlgorithmId);

            if (Ids.Count() != 0)
            {
                builder.ComponentWhere.Add(new ComponentValueOfWhere(TMSAlgorithmSettingsProperties.AlgorithmId, Ids, LocateType.In));
            }
            query.SelectBuilders.Add(builder);
            return(IORMProvider.GetQueryOperator(session).SelectAll <TMSAlgorithmSettings>(session, query));
        }
示例#18
0
        public static bool DbDelete(this TCreature entity, DbSession session)
        {
            var query = IORMProvider.GetDbQueryBuilder(session);

            query.DeleteBuilder.ComponentWhere.Add(new ComponentValueOfWhere(TCreatureProperties.CreatureId, entity.CreatureId, LocateType.Equal));
            return(IORMProvider.GetQueryOperator(session).Delete <TCreature>(session, query));
        }
示例#19
0
        public static TMSAlgorithmSettings DbSelect(this TMSAlgorithmSettings entity, DbSession session, params PDMDbProperty[] fields)
        {
            var           query   = IORMProvider.GetDbQueryBuilder(session);
            SelectBuilder builder = new SelectBuilder();

            if (fields.Count() == 0)
            {
                builder.ComponentSelect.Add(TMSAlgorithmSettingsProperties.AlgorithmId);
                builder.ComponentSelect.Add(TMSAlgorithmSettingsProperties.TopWeightType);
                builder.ComponentSelect.Add(TMSAlgorithmSettingsProperties.SubWeightType);
                builder.ComponentSelect.Add(TMSAlgorithmSettingsProperties.ResultType);
                builder.ComponentSelect.Add(TMSAlgorithmSettingsProperties.WeightValue);
            }
            else
            {
                builder.ComponentSelect.Add(TMSAlgorithmSettingsProperties.AlgorithmId);
                builder.ComponentSelect.Add(TMSAlgorithmSettingsProperties.TopWeightType);
                builder.ComponentSelect.Add(TMSAlgorithmSettingsProperties.SubWeightType);
                foreach (var field in fields)
                {
                    builder.ComponentSelect.Add(field);
                }
            }
            builder.ComponentWhere.Add(new ComponentValueOfWhere(TMSAlgorithmSettingsProperties.AlgorithmId, entity.AlgorithmId, LocateType.Equal));
            builder.ComponentWhere.Add(new ComponentValueOfWhere(TMSAlgorithmSettingsProperties.TopWeightType, entity.TopWeightType, LocateType.Equal));
            builder.ComponentWhere.Add(new ComponentValueOfWhere(TMSAlgorithmSettingsProperties.SubWeightType, entity.SubWeightType, LocateType.Equal));
            query.SelectBuilders.Add(builder);
            return(IORMProvider.GetQueryOperator(session).Select <TMSAlgorithmSettings>(session, query));
        }
        public static bool DbInsert(this List <TGrabRequest> entities, DbSession session)
        {
            var query = IORMProvider.GetDbQueryBuilder(session);

            foreach (var entity in entities)
            {
                InsertBuilder builder = new InsertBuilder();
                builder.ComponentInsert.Add(new ComponentValueOfInsert(TGrabRequestProperties.RequestId, entity.RequestId));
                builder.ComponentInsert.Add(new ComponentValueOfInsert(TGrabRequestProperties.SpiderId, entity.SpiderId));
                builder.ComponentInsert.Add(new ComponentValueOfInsert(TGrabRequestProperties.GrabType, entity.GrabType));
                if (entity.IssueName == null)
                {
                    throw new NotImplementedException("缺少必填的参数项值, 参数项: " + nameof(entity.IssueName));
                }
                builder.ComponentInsert.Add(new ComponentValueOfInsert(TGrabRequestProperties.IssueName, entity.IssueName));
                if (entity.SpiderName == null)
                {
                    throw new NotImplementedException("缺少必填的参数项值, 参数项: " + nameof(entity.SpiderName));
                }
                builder.ComponentInsert.Add(new ComponentValueOfInsert(TGrabRequestProperties.SpiderName, entity.SpiderName));
                builder.ComponentInsert.Add(new ComponentValueOfInsert(TGrabRequestProperties.ProcessStatus, entity.ProcessStatus));
                if (entity.Message == null)
                {
                    throw new NotImplementedException("缺少必填的参数项值, 参数项: " + nameof(entity.Message));
                }
                builder.ComponentInsert.Add(new ComponentValueOfInsert(TGrabRequestProperties.Message, entity.Message));
                query.InsertBuilders.Add(builder);
            }
            return(IORMProvider.GetQueryOperator(session).InsertAll <TGrabRequest>(session, query));
        }
示例#21
0
        public static List <TCreature> DbSelect(this List <TCreature> entities, DbSession session, params PDMDbProperty[] fields)
        {
            var           query   = IORMProvider.GetDbQueryBuilder(session);
            SelectBuilder builder = new SelectBuilder();

            if (fields.Count() == 0)
            {
                builder.ComponentSelect.Add(TCreatureProperties.CreatureId);
                builder.ComponentSelect.Add(TCreatureProperties.CreatureType);
                builder.ComponentSelect.Add(TCreatureProperties.Name);
                builder.ComponentSelect.Add(TCreatureProperties.Experience);
                builder.ComponentSelect.Add(TCreatureProperties.Level);
                builder.ComponentSelect.Add(TCreatureProperties.Profession);
            }
            else
            {
                builder.ComponentSelect.Add(TCreatureProperties.CreatureId);
                foreach (var field in fields)
                {
                    builder.ComponentSelect.Add(field);
                }
            }
            var Ids = entities.Select(c => c.CreatureId);

            if (Ids.Count() != 0)
            {
                builder.ComponentWhere.Add(new ComponentValueOfWhere(TCreatureProperties.CreatureId, Ids, LocateType.In));
            }
            query.SelectBuilders.Add(builder);
            return(IORMProvider.GetQueryOperator(session).SelectAll <TCreature>(session, query));
        }
示例#22
0
        public static TCreature DbSelect(this TCreature entity, DbSession session, params PDMDbProperty[] fields)
        {
            var           query   = IORMProvider.GetDbQueryBuilder(session);
            SelectBuilder builder = new SelectBuilder();

            if (fields.Count() == 0)
            {
                builder.ComponentSelect.Add(TCreatureProperties.CreatureId);
                builder.ComponentSelect.Add(TCreatureProperties.CreatureType);
                builder.ComponentSelect.Add(TCreatureProperties.Name);
                builder.ComponentSelect.Add(TCreatureProperties.Experience);
                builder.ComponentSelect.Add(TCreatureProperties.Level);
                builder.ComponentSelect.Add(TCreatureProperties.Profession);
            }
            else
            {
                builder.ComponentSelect.Add(TCreatureProperties.CreatureId);
                foreach (var field in fields)
                {
                    builder.ComponentSelect.Add(field);
                }
            }
            builder.ComponentWhere.Add(new ComponentValueOfWhere(TCreatureProperties.CreatureId, entity.CreatureId, LocateType.Equal));
            query.SelectBuilders.Add(builder);
            return(IORMProvider.GetQueryOperator(session).Select <TCreature>(session, query));
        }
示例#23
0
        public static bool DbUpdate(this List <TEvent> entities, DbSession session, params PDMDbProperty[] fields)
        {
            var query = IORMProvider.GetDbQueryBuilder(session);

            foreach (var entity in entities)
            {
                UpdateBuilder builder = new UpdateBuilder();
                builder.ComponentWhere.Add(new ComponentValueOfWhere(TEventProperties.EventId, entity.EventId, LocateType.Equal));
                if (fields == null || fields.Length == 0)
                {
                    builder.ComponentSet.Add(new ComponentValueOfSet(TEventProperties.AreaId, entity.AreaId));
                    builder.ComponentSet.Add(new ComponentValueOfSet(TEventProperties.EventId, entity.EventId));
                    builder.ComponentSet.Add(new ComponentValueOfSet(TEventProperties.Occurrence, entity.Occurrence));
                }
                else
                {
                    if (fields.Contains(TEventProperties.AreaId))
                    {
                        builder.ComponentSet.Add(new ComponentValueOfSet(TEventProperties.AreaId, entity.AreaId));
                    }
                    if (fields.Contains(TEventProperties.Occurrence))
                    {
                        builder.ComponentSet.Add(new ComponentValueOfSet(TEventProperties.Occurrence, entity.Occurrence));
                    }
                }
                query.UpdateBuilders.Add(builder);
            }
            return(IORMProvider.GetQueryOperator(session).UpdateAll <TEvent>(session, query));
        }
示例#24
0
        public static TAreaEvent DbSelect(this TAreaEvent entity, DbSession session, params PDMDbProperty[] fields)
        {
            var           query   = IORMProvider.GetDbQueryBuilder(session);
            SelectBuilder builder = new SelectBuilder();

            if (fields.Count() == 0)
            {
                builder.ComponentSelect.Add(TAreaEventProperties.AreaId);
                builder.ComponentSelect.Add(TAreaEventProperties.EventId);
                builder.ComponentSelect.Add(TAreaEventProperties.RoundNum);
            }
            else
            {
                builder.ComponentSelect.Add(TAreaEventProperties.AreaId);
                builder.ComponentSelect.Add(TAreaEventProperties.EventId);
                builder.ComponentSelect.Add(TAreaEventProperties.RoundNum);
                foreach (var field in fields)
                {
                    builder.ComponentSelect.Add(field);
                }
            }
            builder.ComponentWhere.Add(new ComponentValueOfWhere(TAreaEventProperties.AreaId, entity.AreaId, LocateType.Equal));
            builder.ComponentWhere.Add(new ComponentValueOfWhere(TAreaEventProperties.EventId, entity.EventId, LocateType.Equal));
            builder.ComponentWhere.Add(new ComponentValueOfWhere(TAreaEventProperties.RoundNum, entity.RoundNum, LocateType.Equal));
            query.SelectBuilders.Add(builder);
            return(IORMProvider.GetQueryOperator(session).Select <TAreaEvent>(session, query));
        }
示例#25
0
        public static bool DbUpdate(this List <TPrototypeCreature> entities, DbSession session, params PDMDbProperty[] fields)
        {
            var query = IORMProvider.GetDbQueryBuilder(session);

            foreach (var entity in entities)
            {
                UpdateBuilder builder = new UpdateBuilder();
                builder.ComponentWhere.Add(new ComponentValueOfWhere(TPrototypeCreatureProperties.CreatureId, entity.CreatureId, LocateType.Equal));
                if (fields == null || fields.Length == 0)
                {
                    builder.ComponentSet.Add(new ComponentValueOfSet(TPrototypeCreatureProperties.CreatureId, entity.CreatureId));
                    builder.ComponentSet.Add(new ComponentValueOfSet(TPrototypeCreatureProperties.CreatureType, entity.CreatureType));
                    builder.ComponentSet.Add(new ComponentValueOfSet(TPrototypeCreatureProperties.CreatureUseType, entity.CreatureUseType));
                    builder.ComponentSet.Add(new ComponentValueOfSet(TPrototypeCreatureProperties.Name, entity.Name));
                    builder.ComponentSet.Add(new ComponentValueOfSet(TPrototypeCreatureProperties.Level, entity.Level));
                    builder.ComponentSet.Add(new ComponentValueOfSet(TPrototypeCreatureProperties.Profession, entity.Profession));
                    builder.ComponentSet.Add(new ComponentValueOfSet(TPrototypeCreatureProperties.Properties, entity.Properties));
                    builder.ComponentSet.Add(new ComponentValueOfSet(TPrototypeCreatureProperties.Skills, entity.Skills));
                    builder.ComponentSet.Add(new ComponentValueOfSet(TPrototypeCreatureProperties.Qualities, entity.Qualities));
                }
                else
                {
                    if (fields.Contains(TPrototypeCreatureProperties.CreatureType))
                    {
                        builder.ComponentSet.Add(new ComponentValueOfSet(TPrototypeCreatureProperties.CreatureType, entity.CreatureType));
                    }
                    if (fields.Contains(TPrototypeCreatureProperties.CreatureUseType))
                    {
                        builder.ComponentSet.Add(new ComponentValueOfSet(TPrototypeCreatureProperties.CreatureUseType, entity.CreatureUseType));
                    }
                    if (fields.Contains(TPrototypeCreatureProperties.Name))
                    {
                        builder.ComponentSet.Add(new ComponentValueOfSet(TPrototypeCreatureProperties.Name, entity.Name));
                    }
                    if (fields.Contains(TPrototypeCreatureProperties.Level))
                    {
                        builder.ComponentSet.Add(new ComponentValueOfSet(TPrototypeCreatureProperties.Level, entity.Level));
                    }
                    if (fields.Contains(TPrototypeCreatureProperties.Profession))
                    {
                        builder.ComponentSet.Add(new ComponentValueOfSet(TPrototypeCreatureProperties.Profession, entity.Profession));
                    }
                    if (fields.Contains(TPrototypeCreatureProperties.Properties))
                    {
                        builder.ComponentSet.Add(new ComponentValueOfSet(TPrototypeCreatureProperties.Properties, entity.Properties));
                    }
                    if (fields.Contains(TPrototypeCreatureProperties.Skills))
                    {
                        builder.ComponentSet.Add(new ComponentValueOfSet(TPrototypeCreatureProperties.Skills, entity.Skills));
                    }
                    if (fields.Contains(TPrototypeCreatureProperties.Qualities))
                    {
                        builder.ComponentSet.Add(new ComponentValueOfSet(TPrototypeCreatureProperties.Qualities, entity.Qualities));
                    }
                }
                query.UpdateBuilders.Add(builder);
            }
            return(IORMProvider.GetQueryOperator(session).UpdateAll <TPrototypeCreature>(session, query));
        }
示例#26
0
        public static bool DbDelete(this List <TUserBasicInfo> entities, DbSession session)
        {
            var query = IORMProvider.GetDbQueryBuilder(session);
            var Ids   = entities.Select(c => c.UserName);

            query.DeleteBuilder.ComponentWhere.Add(new ComponentValueOfWhere(TUserBasicInfoProperties.UserName, Ids, LocateType.In));
            return(IORMProvider.GetQueryOperator(session).Delete <TUserBasicInfo>(session, query));
        }
        public static bool DbDelete(this List <TGrabRequest> entities, DbSession session)
        {
            var query = IORMProvider.GetDbQueryBuilder(session);
            var Ids   = entities.Select(c => c.SpiderId);

            query.DeleteBuilder.ComponentWhere.Add(new ComponentValueOfWhere(TGrabRequestProperties.SpiderId, Ids, LocateType.In));
            return(IORMProvider.GetQueryOperator(session).Delete <TGrabRequest>(session, query));
        }
示例#28
0
        public static bool DbDelete(this TAreaEvent entity, DbSession session)
        {
            var query = IORMProvider.GetDbQueryBuilder(session);

            query.DeleteBuilder.ComponentWhere.Add(new ComponentValueOfWhere(TAreaEventProperties.AreaId, entity.AreaId, LocateType.Equal));
            query.DeleteBuilder.ComponentWhere.Add(new ComponentValueOfWhere(TAreaEventProperties.EventId, entity.EventId, LocateType.Equal));
            query.DeleteBuilder.ComponentWhere.Add(new ComponentValueOfWhere(TAreaEventProperties.RoundNum, entity.RoundNum, LocateType.Equal));
            return(IORMProvider.GetQueryOperator(session).Delete <TAreaEvent>(session, query));
        }
示例#29
0
        public static bool DbDelete(this TMSAlgorithmSettings entity, DbSession session)
        {
            var query = IORMProvider.GetDbQueryBuilder(session);

            query.DeleteBuilder.ComponentWhere.Add(new ComponentValueOfWhere(TMSAlgorithmSettingsProperties.AlgorithmId, entity.AlgorithmId, LocateType.Equal));
            query.DeleteBuilder.ComponentWhere.Add(new ComponentValueOfWhere(TMSAlgorithmSettingsProperties.TopWeightType, entity.TopWeightType, LocateType.Equal));
            query.DeleteBuilder.ComponentWhere.Add(new ComponentValueOfWhere(TMSAlgorithmSettingsProperties.SubWeightType, entity.SubWeightType, LocateType.Equal));
            return(IORMProvider.GetQueryOperator(session).Delete <TMSAlgorithmSettings>(session, query));
        }
        public static bool DbDelete(this TGrabRequest entity, DbSession session)
        {
            var query = IORMProvider.GetDbQueryBuilder(session);

            query.DeleteBuilder.ComponentWhere.Add(new ComponentValueOfWhere(TGrabRequestProperties.SpiderId, entity.SpiderId, LocateType.Equal));
            query.DeleteBuilder.ComponentWhere.Add(new ComponentValueOfWhere(TGrabRequestProperties.GrabType, entity.GrabType, LocateType.Equal));
            query.DeleteBuilder.ComponentWhere.Add(new ComponentValueOfWhere(TGrabRequestProperties.IssueName, entity.IssueName, LocateType.Equal));
            return(IORMProvider.GetQueryOperator(session).Delete <TGrabRequest>(session, query));
        }