Commit 23849647 authored by 黄奎's avatar 黄奎

页面修改

parent 60c8f373
......@@ -25,7 +25,8 @@ namespace Edu.Repository.User
/// <returns></returns>
public List<RB_Notice_ViewModel> GetPageList(int pageIndex,int pageSize, out long count,RB_Notice_ViewModel demodel)
{
string where = $@" 1=1 and {nameof(RB_Notice.Status)}=0 ";
var parameters = new DynamicParameters();
string where = $@" 1=1 AND {nameof(RB_Notice.Status)}=0 ";
if (demodel.Group_Id > 0)
{
where += $@" and {nameof(RB_Notice.Group_Id)} ={demodel.Group_Id}";
......@@ -36,11 +37,13 @@ namespace Edu.Repository.User
}
if (!string.IsNullOrEmpty(demodel.Title))
{
where += $@" and {nameof(RB_Notice.Title)} like '%{demodel.Title}%'";
where += $@" AND {nameof(RB_Notice.Title)} LIKE @Title ";
parameters.Add("Title", "%" + demodel.Title.Trim() + "%");
}
if (!string.IsNullOrEmpty(demodel.Number))
{
where += $@" and {nameof(RB_Notice.Number)} like '%{demodel.Number}%'";
where += $@" and {nameof(RB_Notice.Number)} LIKE @Number ";
parameters.Add("Number", "%" + demodel.Number.Trim() + "%");
}
if (demodel.NoticeState > 0)
{
......@@ -50,7 +53,8 @@ namespace Edu.Repository.User
{
where += $@" and {nameof(RB_Notice.Is_Top)} ={demodel.Is_Top}";
}
if (demodel.UpdateBy > 0) {
if (demodel.UpdateBy > 0)
{
where += $@" and {nameof(RB_Notice.UpdateBy)} ={demodel.UpdateBy}";
}
......@@ -59,12 +63,12 @@ namespace Edu.Repository.User
{
OrderBy = " UpdateTime desc";
}
else if (demodel.OrderBy == 2) {
else if (demodel.OrderBy == 2)
{
OrderBy = " Is_Top asc,UpdateTime desc";
}
string sql = $@" select * from RB_Notice where {where} order by {OrderBy}";
return GetPage<RB_Notice_ViewModel>(pageIndex, pageSize, out count, sql).ToList();
return GetPage<RB_Notice_ViewModel>(pageIndex, pageSize, out count, sql,parameters).ToList();
}
/// <summary>
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment