123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107 |
- using Interface;
- using Models;
- using Models.Entity.LottomatBaseDB;
- using Services;
- using System;
- using System.Collections.Generic;
- using System.Linq;
- using System.Web;
- namespace Business.ZX
- {
- public static class NewsBLL
- {
- private static ZXInterface services;
- static NewsBLL()
- {
- services = new ZXServic();
- }
- public static List<Base_News> GetPageList(int page, int rows, Dictionary<string, Object> queryParam, out int count, string order = null, bool isDesc = true)
- {
- List<EExpression> listexp = new List<EExpression>();
- if (queryParam!=null&&queryParam.Keys.Count > 0)
- {
- if (queryParam.ContainsKey("IsDelete"))
- {
- int IsDelete = int.Parse(queryParam["IsDelete"].ToString());
- listexp.Add(new EExpression("IsDelete", "=", IsDelete));
- }
- if (queryParam.ContainsKey("TypeId"))
- {
- int TypeId = (int)queryParam["TypeId"];
- listexp.Add(new EExpression("TypeId", "=", TypeId));
- }
- if (queryParam.ContainsKey("CategoryId"))
- {
- List<string> CategoryId = (List<string>)queryParam["CategoryId"];
- listexp.Add(new EExpression("CategoryId", EnumExpression.In, CategoryId));
- }
- if (queryParam.ContainsKey("CategoryId"))
- {
- List<string> CategoryId = (List<string>)queryParam["CategoryId"];
- listexp.Add(new EExpression("CategoryId", EnumExpression.In, CategoryId));
- }
- }
- var data = services.GetList<Base_News>(page, rows, order, listexp, isDesc);
- List<EExpression> countexp = new List<EExpression>(listexp);
-
- count = services.GetPageListCount<Base_News>(countexp);
- return data;
- }
- /// <summary>
- /// 查询咨询首页的分类下面最新的5条数据 详情看sql语句
- /// </summary>
- /// <returns></returns>
- public static List<Base_News> GetHomeNewsList(string code)
- {
- string strSql = @"select top 20 * from Base_News where CategoryId in( SELECT
- d.ItemDetailId
-
- FROM Base_DataItemDetail d
- LEFT JOIN Base_DataItem i ON i.ItemId = d.ItemId
- WHERE 1 = 1
- AND d.EnabledMark = 1
- AND d.DeleteMark = 0
- and i.ItemCode ='{0}'
- and d.ItemValue in('3DYC','P3YC','SSQYC','DLT')
- )
- AND
- IsDelete=0
- AND
- TypeId=1
- order by CreateDate desc";
- string sql = string.Format(strSql, code);
- return services.ExSqlGetList<Base_News>(sql);
- }
- public static Base_News GetItem(int NewsId)
- {
- return services.QueryItembyKey<Base_News>(NewsId);
- }
- /// <summary>
- /// 根据newsid查询实体并且前后三条
- /// </summary>
- /// <param name="NewsId"></param>
- /// <returns></returns>
- public static List<Base_News> GetGetNewsDetails(string NewsId)
- {
- string sql = @"declare @dd int=1
- set @dd=(SELECT PK
- FROM Base_News
- where NewsId='{0}')
- select * from Base_News
- where PK in ( @dd-1,@dd,@dd+1)";
- string strsql = string.Format(sql, NewsId);
- return services.ExSqlGetList<Base_News>(strsql);
- }
- public static List<Base_News> GetList(int page, int rows,List<EExpression> list,string order=null, bool isdesc = false)
- {
- return services.GetList<Base_News>(page, rows, order, list, isdesc);
- }
- }
- }
|