示例#1
0
        public override MiicConditionCollections visitor(PublishInfoDao publishInfoDao)
        {
            MiicConditionCollections condition = new MiicConditionCollections(MiicDBLogicSetting.No);

            MiicCondition editStatusCondition = new MiicCondition(Config.Attribute.GetSqlColumnNameByPropertyName <PublishInfo, string>(o => o.EditStatus),
                                                                  ((int)MiicYesNoSetting.No).ToString(),
                                                                  DbType.String,
                                                                  MiicDBOperatorSetting.Equal);

            condition.Add(new MiicConditionLeaf(MiicDBLogicSetting.No, editStatusCondition));

            //发表人是用户
            MiicCondition createrIDCondition = new MiicCondition(Config.Attribute.GetSqlColumnNameByPropertyName <PublishInfo, string>(o => o.CreaterID),
                                                                 this.UserID,
                                                                 DbType.String,
                                                                 MiicDBOperatorSetting.Equal);

            condition.Add(new MiicConditionLeaf(createrIDCondition));

            //默认时间倒序排列
            List <MiicOrderBy> order = new List <MiicOrderBy>();

            order.Add(new MiicOrderBy()
            {
                Desc         = false,
                PropertyName = Config.Attribute.GetSqlColumnNameByPropertyName <PublishInfo, DateTime?>(o => o.PublishTime)
            });
            condition.order = order;

            return(condition);
        }
示例#2
0
        /// <summary>
        /// 获取登录用户的行为FLAG 查询语句
        /// </summary>
        /// <param name="PublishInfoDao"></param>
        /// <returns>querySql</returns>
        public string visitor(PublishInfoDao PublishInfoDao)
        {
            string querySql = string.Empty;

            querySql = "SELECT * FROM dbo.GetMyMomentsBehaviorFlags('" + UserID + "','" + PublishID + "')";
            return(querySql);
        }
示例#3
0
        /// <summary>
        /// 朋友圈DAO访问器
        /// </summary>
        /// <param name="publishInfoDao"></param>
        /// <returns></returns>
        public MiicConditionCollections visitor(PublishInfoDao publishInfoDao)
        {
            MiicConditionCollections condition = new MiicConditionCollections();
            //编辑状态为草稿
            MiicCondition editStatusCondition = new MiicCondition(Config.Attribute.GetSqlColumnNameByPropertyName <PublishInfo, string>(o => o.EditStatus),
                                                                  ((int)MiicYesNoSetting.Yes).ToString(),
                                                                  DbType.String,
                                                                  MiicDBOperatorSetting.Equal);

            condition.Add(new MiicConditionLeaf(MiicDBLogicSetting.No, editStatusCondition));

            MiicConditionCollections keyworCondition     = new MiicConditionCollections();
            MiicCondition            microTitleCondition = new MiicCondition(Config.Attribute.GetSqlColumnNameByPropertyName <PublishInfo, string>(o => o.Title),
                                                                             Keyword,
                                                                             DbType.String,
                                                                             MiicDBOperatorSetting.Like);

            keyworCondition.Add(new MiicConditionLeaf(MiicDBLogicSetting.No, microTitleCondition));
            MiicCondition microContentCondition = new MiicCondition(Config.Attribute.GetSqlColumnNameByPropertyName <PublishInfo, string>(o => o.Content),
                                                                    Keyword,
                                                                    DbType.String,
                                                                    MiicDBOperatorSetting.Like);

            keyworCondition.Add(new MiicConditionLeaf(MiicDBLogicSetting.Or, microContentCondition));
            condition.Add(keyworCondition);

            MiicCondition createrIDCondition = new MiicCondition(Config.Attribute.GetSqlColumnNameByPropertyName <PublishInfo, string>(o => o.CreaterID),
                                                                 userID,
                                                                 DbType.String,
                                                                 MiicDBOperatorSetting.Equal);

            condition.Add(new MiicConditionLeaf(createrIDCondition));

            MiicCondition microTypeCondition = new MiicCondition(Config.Attribute.GetSqlColumnNameByPropertyName <PublishInfo, string>(o => o.PublishType),
                                                                 ((int)PublishInfoTypeSetting.Long).ToString(),
                                                                 DbType.String,
                                                                 MiicDBOperatorSetting.Equal);

            condition.Add(new MiicConditionLeaf(microTypeCondition));

            return(condition);
        }
示例#4
0
 /// <summary>
 /// 访问接口
 /// </summary>
 /// <param name="publishInfoDao"></param>
 /// <returns></returns>
 public abstract MiicConditionCollections visitor(PublishInfoDao publishInfoDao);
示例#5
0
        public override MiicConditionCollections visitor(PublishInfoDao publishInfoDao)
        {
            MiicConditionCollections condition = new MiicConditionCollections();

            MiicCondition editStatusCondition = new MiicCondition(Config.Attribute.GetSqlColumnNameByPropertyName <AddressPublishInfo, string>(o => o.EditStatus),
                                                                  ((int)MiicYesNoSetting.No).ToString(),
                                                                  DbType.String,
                                                                  MiicDBOperatorSetting.Equal);

            condition.Add(new MiicConditionLeaf(MiicDBLogicSetting.No, editStatusCondition));

            MiicConditionCollections userIDCondition = new MiicConditionCollections();
            //发表人是用户
            MiicCondition createrIDCondition = new MiicCondition(Config.Attribute.GetSqlColumnNameByPropertyName <AddressPublishInfo, string>(o => o.CreaterID),
                                                                 userID,
                                                                 DbType.String,
                                                                 MiicDBOperatorSetting.Equal);
            //发表人是通讯录好友
            MiicCondition myUserIDCondition = new MiicCondition(Config.Attribute.GetSqlColumnNameByPropertyName <AddressPublishInfo, string>(o => o.MyUserID),
                                                                userID,
                                                                DbType.String,
                                                                MiicDBOperatorSetting.Equal);

            if (Belong == PublishInfoBelongSetting.Main)
            {
                userIDCondition.Add(new MiicConditionLeaf(MiicDBLogicSetting.No, createrIDCondition));
                userIDCondition.Add(new MiicConditionLeaf(MiicDBLogicSetting.Or, myUserIDCondition));
            }
            else if (Belong == PublishInfoBelongSetting.Self)
            {
                userIDCondition.Add(new MiicConditionLeaf(MiicDBLogicSetting.No, createrIDCondition));
            }
            else if (Belong == PublishInfoBelongSetting.Other)
            {
                throw new ArgumentOutOfRangeException("个人查询top,不能传入他人页面");
            }

            condition.Add(userIDCondition);

            if (Belong == PublishInfoBelongSetting.Main)
            {
                //通讯录的好友对自己可见
                MiicConditionCollections seeCondition = new MiicConditionCollections();
                //如果是自己发表且没有好友
                MiicCondition selfNullSeeCondition = new MiicCondition(Config.Attribute.GetSqlColumnNameByPropertyName <AddressPublishInfo, string>(o => o.CanSeeAddresser),
                                                                       null,
                                                                       DbType.String,
                                                                       MiicDBOperatorSetting.IsNull);
                seeCondition.Add(new MiicConditionLeaf(MiicDBLogicSetting.No, selfNullSeeCondition));
                //有好友,那么好友对自己可见
                MiicCondition canSeeAddresserCondition = new MiicCondition(Config.Attribute.GetSqlColumnNameByPropertyName <AddressPublishInfo, string>(o => o.CanSeeAddresser),
                                                                           ((int)MiicYesNoSetting.Yes).ToString(),
                                                                           DbType.String,
                                                                           MiicDBOperatorSetting.Equal);
                seeCondition.Add(new MiicConditionLeaf(MiicDBLogicSetting.Or, canSeeAddresserCondition));
                condition.Add(seeCondition);
            }

            //默认时间倒序排列
            List <MiicOrderBy> order = new List <MiicOrderBy>();

            order.Add(new MiicOrderBy()
            {
                Desc         = false,
                PropertyName = Config.Attribute.GetSqlColumnNameByPropertyName <AddressPublishInfo, DateTime?>(o => o.PublishTime)
            });
            condition.order = order;

            return(condition);
        }