Example #1
0
        /// <summary>
        /// 获取商家分店歌单列表
        /// </summary>
        /// <param name="param"></param>
        /// <returns></returns>
        public PagedResult <SonSongSheetParam> GetSonStoreSongSheetList(SonSongSheetListPageParam param)
        {
            string sql    = string.Format(@"
                select top {0} * from (select row_number() over(order by c.UpdateTime desc) as rownumber, 
c.Id,c.ListName,c.StoreId,c.StoreCode,b.StoreName,c.ListContent,c.UpdateTime  from PlayList c left join [User] a on c.StoreId = a.Id left join StoreDetailInfo b on a.Id=b.UserId
                            where a.StoreCode='{2}' and a.UserType=3 and c.IsPublish=1 and c.Status=1) temp_row
                    where temp_row.rownumber>(({1}-1)*{0})", param.PageSize, param.PageIndex, param.StoreCode);
            int    count  = Convert.ToInt32(helper.QueryScalar($@"select count(1) from PlayList c left join [User] a on c.StoreId = a.Id left join StoreDetailInfo b on a.Id=b.UserId
                            where a.StoreCode='{param.StoreCode}' and a.UserType=3 and c.IsPublish=1 and c.Status=1"));
            var    result = helper.Query <SonSongSheetParam>(sql).ToList();

            foreach (var item in result)
            {
                item.SongCount = 0;
                var temp = item.ListContent;
                if (temp == null || string.IsNullOrEmpty(temp))
                {
                    item.SongCount = 0;
                }
                else
                {
                    var arr = temp.Split(',');
                    foreach (var arrItem in arr)
                    {
                        if (!string.IsNullOrEmpty(arrItem))
                        {
                            item.SongCount++;
                        }
                    }
                }
            }
            return(new PagedResult <SonSongSheetParam>
            {
                Total = count,
                Results = result,
                Page = param.PageIndex,
                PageSize = param.PageSize
            });
        }
Example #2
0
        public ResponseResultDto <PagedResult <SonSongSheetParam> > GetSonStoreSongSheetList(SonSongSheetListPageParam param)
        {
            var result = songSheetApiRepository.GetSonStoreSongSheetList(param);

            return(new ResponseResultDto <PagedResult <SonSongSheetParam> >
            {
                IsSuccess = true,
                ErrorMessage = String.Empty,
                Result = result
            });
        }