public BasePageList<CommentListModel> GetCommentPageList(CommentQueryModel query)
{
const string spName = "sp_common_pager";
const string tableName = @" settled_comment as a left join settled_info as b on b.innerid =a.companyid";
const string fields = @"a.innerid, a.companyid, ifnull(a.mobile,'') as mobile, a.headportrait, a.score, a.ip, ifnull(a.commentdesc,'') as commentdesc, a.createdtime,b.companyname,a.pictures";
var orderField = string.IsNullOrWhiteSpace(query.Order) ? " createdtime desc" : query.Order;
//查詢條件
var sqlWhere = new StringBuilder(" 1=1 and (isdelete <>1 or isdelete is null) ");
if (!string.IsNullOrWhiteSpace(query.Companyid))
{
sqlWhere.Append($" and companyid='{query.Companyid}'");
}
if (!string.IsNullOrWhiteSpace(query.CompanyName))
{
sqlWhere.Append($" and companyname like '%{query.CompanyName}%'");
}
if (query.OnlyLow)
{
sqlWhere.Append(" and score<=2");
}
var model = new PagingModel(spName, tableName, fields, orderField, sqlWhere.ToString(), query.PageSize, query.PageIndex);
var list = Helper.ExecutePaging<CommentListModel>(model, query.Echo);
return list;
}