Esempio n. 1
0
        /// <summary>
        /// 获取参赛人的投票列表
        /// </summary>
        /// <param name="query"></param>
        /// <returns></returns>
        public BasePageList<VoteLogListModel> GetVoteLogList(VoteLogQueryModel query)
        {
            const string spName = "sp_common_pager";
            const string tableName = @"activity_vote_log as a inner join wechat_friend as b on a.openid=b.openid ";
            const string fields = "a.openid,b.nickname,b.photo, a.createdtime, a.modifiedtime,a.invalid";
            var oldField = string.IsNullOrWhiteSpace(query.Order) ? " a.createdtime asc " : query.Order;

            var sqlWhere = new StringBuilder($" a.perid='{query.Perid}' ");

            if (!string.IsNullOrWhiteSpace(query.Activityid))
            {
                sqlWhere.Append($" and a.activityid='{query.Activityid}'");
            }

            if (!string.IsNullOrWhiteSpace(query.Openid))
            {
                sqlWhere.Append($" and a.openid='{query.Openid}'");
            }

            var model = new PagingModel(spName, tableName, fields, oldField, sqlWhere.ToString(), query.PageSize, query.PageIndex);
            var list = Helper.ExecutePaging<VoteLogListModel>(model, query.Echo);
            return list;
        }