Master.CanYinWu.DAL/ArticleInfoDAL.cs
(开头部分) 9KB这里只显示每个文件的开头 60 行。登录后可以解锁完整代码。
using Dapper;
using Master.CanYinWu.Entity;
using Master.CanYinWu.Entity.ViewModel;
using Master.CanYinWu.Utility;
using System;
using System.Collections.Generic;
using System.Data;
using System.Text;
using System.Threading.Tasks;
namespace Master.CanYinWu.DAL
{
public class ArticleInfoDAL
{
private IDbConnection conn;
#region 文章列表
/// <summary>
/// 栏目列表
/// </summary>
/// <param name="pageIndex"></param>
/// <param name="pageSize"></param>
/// <param name="key">标题</param>
/// <param name="articleAttribute">属性</param>
/// <param name="articleColumnId">所属栏目</param>
/// <returns></returns>
public async Task<Tuple<IEnumerable<ArticleInfoViewModel>, int>> GetList(int pageIndex, int pageSize, string key, string articleAttribute=null, int articleColumnId = 0, int? PC_Collection = null, int? MIP_Collection = null, DateTime? dateStart = null, DateTime? dateEnd = null, string type = null)
{
StringBuilder sb = new StringBuilder(@"
select tab.ArticleInfoId,tab.ArticleTitle,tab.SimpleTitle,tab.Weight,tab.Thumbnail,tab.Author,tab.CreateTime,tab.ArticleAttribute,tab.TAG,
(select ColumnName from ArticleColumn as atc where atc.ArticleColumnId=tab.ArticleColumnId)as ColumnName,
(select Url from ArticleColumn as atc where atc.ArticleColumnId=tab.ArticleColumnParentId)as Url,
(select ColumnName from ArticleColumn as atc where atc.ArticleColumnId=tab.ArticleColumnParentId)as ColumnParentName,tab.BrowseNum,tab.IsCheck,
tab.PC_Collection,tab.Mip_Collection
from(
select * from(select *,ROW_NUMBER() over (order by ArticleInfoId desc) as rownumber from ArticleInfo where IsDelete =0 ");
StringBuilder sqlTotal = new StringBuilder(@"select count(1) from ArticleInfo where IsDelete =0");
if (type=="related")
{
sb.Append(" and ischeck=1 ");
sqlTotal.Append(" and ischeck=1 ");
}
DynamicParameters dp = new DynamicParameters();
dp.Add("PageIndex", pageIndex);
dp.Add("PageSize", pageSize);
DynamicParameters dpTotal = new DynamicParameters();
if (!string.IsNullOrEmpty(key))
{
sb.Append(" and ArticleTitle like '%'+@Key+'%' ");
sqlTotal.Append(" and ArticleTitle like '%'+@Key+'%' ");
dp.Add("Key", key);
dpTotal.Add("Key", key);
}
if (!string.IsNullOrEmpty(articleAttribute))
{
sb.Append(" and ArticleAttribute like '%'+@ArticleAttribute+'%' ");
sqlTotal.Append(" and ArticleAttribute like '%'+@ArticleAttribute+'%' ");
dp.Add("ArticleAttribute", articleAttribute);
dpTotal.Add("ArticleAttribute", articleAttribute);
后面还有 142 行代码,购买后查看完整代码
24 小时内免费解锁 3 个项目,之后 1 算力/个。 规则说明
AI 解读 AI
登录后可用,每次 10 算力,解读结果公开显示在下面。
还没有人解读过这个文件。
