Files
U8-Import/NX.ERP.U8/Base/WarehouseDAL.cs

66 lines
1.6 KiB
C#
Raw Normal View History

2021-01-05 11:11:28 +08:00
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Dapper;
using NX.ERP.Model;
namespace NX.ERP.U8
{
public class WarehouseDAL
{
2021-01-11 09:07:29 +08:00
public IEnumerable<Warehouse> GetList(string strWhere = "", object Param = null)
2021-01-05 11:11:28 +08:00
{
2021-01-19 10:19:10 +08:00
2021-01-25 09:47:41 +08:00
using (var conn = U8LoginContext.Instance.Connection)
2021-01-05 11:11:28 +08:00
{
2021-06-04 11:22:42 +08:00
var sql = "select cWhCode as WarehouseCode,cWhName as WarehouseName,CONVERT(BIGINT,pubufts) AS pubufts from Warehouse";
2021-01-11 09:07:29 +08:00
if (!string.IsNullOrEmpty(strWhere))
{
sql += $" where {strWhere}";
}
return conn.Query<Warehouse>(sql, Param);
2021-01-05 11:11:28 +08:00
}
}
2021-06-04 11:22:42 +08:00
public IEnumerable<Warehouse> GetList(long Pubufts)
{
return this.GetList("CONVERT(BIGINT,pubufts) > @Pubufts", new { Pubufts });
}
2021-01-19 10:19:10 +08:00
public IEnumerable<Warehouse> GetList(NX.ERP.Model.Request.Warehouse Params)
{
List<string> where = new List<string>();
if (!string.IsNullOrEmpty(Params.WarehouseCode))
{
where.Add(" cWhCode like @WarehouseCode");
}
if (!string.IsNullOrEmpty(Params.WarehouseName))
{
where.Add(" cWhName like @WarehouseName");
}
return this.GetList(string.Join(" and ", where.ToArray()), new
{
WarehouseCode = $"%{Params.WarehouseCode}%",
WarehouseName = $"%{Params.WarehouseName}%"
});
}
2021-01-05 11:11:28 +08:00
}
}