Esempio n. 1
0
        /// <summary>
        /// 获取待审核歌曲
        /// </summary>
        /// <param name="pageParam"></param>
        /// <returns></returns>
        public Tuple <int, List <SongBookEntity> > GetAuditSongList(AuditSongPageParam pageParam)
        {
            string likeSql  = string.IsNullOrWhiteSpace(pageParam.Keyword) ? string.Empty : $@" and (SingerName like '%{pageParam.Keyword}%'  or SongName like '%{pageParam.Keyword}%')";
            string auditSql = string.Empty;

            switch (pageParam.AuditStatus)
            {
            case -1:
                auditSql = "(AuditStatus=1 or AuditStatus=2 or AuditStatus=3)";
                break;

            default:
                auditSql = $@"AuditStatus={pageParam.AuditStatus}";
                break;
            }
            string sql   = string.Format(@"
                select top {0} * from (select row_number() over(order by Id) as rownumber,SongBook.*
                    from SongBook  where Status=1 and {2}  {3}) temp_row
                    where temp_row.rownumber>(({1}-1)*{0})
order by   
    case AuditStatus   
    when 1 then 1     
    when 3 then 2     
    when 2 then 3     
    end  
asc;", pageParam.PageSize, pageParam.PageIndex, auditSql, likeSql);
            int    count = Convert.ToInt32(helper.QueryScalar($@"select Count(1) from SongBook where Status=1 and  {auditSql} {likeSql}"));

            return(Tuple.Create(count, helper.Query <SongBookEntity>(sql).ToList()));
        }
Esempio n. 2
0
        public ActionResult GetAuditSongList()
        {
            var page        = GetIntValFromReq("page");
            var limit       = GetIntValFromReq("limit");
            var keyword     = GetStrValFromReq("keyword");
            var auditStatus = GetIntValFromReq("auditStatus");
            var param       = new AuditSongPageParam
            {
                PageIndex   = page,
                PageSize    = limit,
                Keyword     = keyword,
                AuditStatus = auditStatus
            };
            var result = songBookRepository.GetAuditSongList(param);

            return(Json(new { code = 0, msg = "", count = result.Item1, data = result.Item2 }, JsonRequestBehavior.AllowGet));
        }