Commit 63a662a4 authored by 黄奎's avatar 黄奎

查询参数修改

parent 757d1c77
...@@ -4,6 +4,7 @@ using System.Text; ...@@ -4,6 +4,7 @@ using System.Text;
using Mall.Model.Entity.Product; using Mall.Model.Entity.Product;
using Mall.Model.Extend.Product; using Mall.Model.Extend.Product;
using System.Linq; using System.Linq;
using VT.FW.DB.Dapper;
namespace Mall.Repository.Product namespace Mall.Repository.Product
{ {
...@@ -23,6 +24,7 @@ namespace Mall.Repository.Product ...@@ -23,6 +24,7 @@ namespace Mall.Repository.Product
/// <returns></returns> /// <returns></returns>
public List<RB_Material_Info_Extend> GetPageList(int pageIndex, int pageSize, out long rowCount, RB_Material_Info_Extend dmodel) public List<RB_Material_Info_Extend> GetPageList(int pageIndex, int pageSize, out long rowCount, RB_Material_Info_Extend dmodel)
{ {
var parameters = new DynamicParameters();
string where = $" 1=1 and {nameof(RB_Material_Info.Status)}=0"; string where = $" 1=1 and {nameof(RB_Material_Info.Status)}=0";
if (dmodel.TenantId > 0) if (dmodel.TenantId > 0)
...@@ -37,7 +39,8 @@ namespace Mall.Repository.Product ...@@ -37,7 +39,8 @@ namespace Mall.Repository.Product
where += $@" and {nameof(RB_Material_Info.Id)}={dmodel.Id}"; where += $@" and {nameof(RB_Material_Info.Id)}={dmodel.Id}";
} }
if (!string.IsNullOrEmpty(dmodel.Name)) { if (!string.IsNullOrEmpty(dmodel.Name)) {
where += $@" and {nameof(RB_Material_Info.Name)} like '%{dmodel.Name}%'"; where += $@" and {nameof(RB_Material_Info.Name)} like @Name ";
parameters.Add("Name", "%" + dmodel.Name.Trim() + "%");
} }
if (dmodel.Type > 0) { if (dmodel.Type > 0) {
where += $@" and {nameof(RB_Material_Info.Type)}={dmodel.Type}"; where += $@" and {nameof(RB_Material_Info.Type)}={dmodel.Type}";
...@@ -51,7 +54,7 @@ namespace Mall.Repository.Product ...@@ -51,7 +54,7 @@ namespace Mall.Repository.Product
} }
string sql = $@"select * from RB_Material_Info where {where} order by Id desc"; string sql = $@"select * from RB_Material_Info where {where} order by Id desc";
return GetPage<RB_Material_Info_Extend>(pageIndex, pageSize, out rowCount, sql).ToList(); return GetPage<RB_Material_Info_Extend>(pageIndex, pageSize, out rowCount, sql, parameters).ToList();
} }
/// <summary> /// <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