Commit 40cd9be0 authored by 黄奎's avatar 黄奎

页面修改

parent 4689bd02
...@@ -23,17 +23,19 @@ namespace Edu.Repository.System ...@@ -23,17 +23,19 @@ namespace Edu.Repository.System
public List<RB_Destination_ViewModel> GetDestinationPageRepository(int pageIndex, int pageSize, RB_Destination_ViewModel where, out long count) public List<RB_Destination_ViewModel> GetDestinationPageRepository(int pageIndex, int pageSize, RB_Destination_ViewModel where, out long count)
{ {
StringBuilder sb = new StringBuilder(); StringBuilder sb = new StringBuilder();
var parameters = new DynamicParameters();
sb.AppendFormat(" SELECT * FROM RB_Destination WHERE 1=1 "); sb.AppendFormat(" SELECT * FROM RB_Destination WHERE 1=1 ");
sb.AppendFormat(" AND {0}={1} ", nameof(RB_Destination_ViewModel.Status), (int)Common.Enum.DateStateEnum.Normal); sb.AppendFormat(" AND {0}={1} ", nameof(RB_Destination_ViewModel.Status), (int)Common.Enum.DateStateEnum.Normal);
if (where != null) if (where != null)
{ {
if (where.Name != null && !string.IsNullOrEmpty(where.Name.Trim())) if (where.Name != null && !string.IsNullOrEmpty(where.Name.Trim()))
{ {
sb.AppendFormat(" AND {0} LIKE '%{1}%' ", nameof(RB_Destination_ViewModel.Name), where.Name.Trim()); sb.AppendFormat(" AND A.{0} LIKE @Name ", nameof(RB_Destination_ViewModel.Name));
parameters.Add("Name", "%" + where.Name.Trim() + "%");
} }
} }
sb.AppendFormat(" ORDER BY {0} ASC ", nameof(RB_Destination_ViewModel.ID)); sb.AppendFormat(" ORDER BY {0} ASC ", nameof(RB_Destination_ViewModel.ID));
return GetPage<RB_Destination_ViewModel>(pageIndex, pageSize, out count, sb.ToString()).ToList(); return GetPage<RB_Destination_ViewModel>(pageIndex, pageSize, out count, sb.ToString(), parameters).ToList();
} }
......
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