66 lines
1.6 KiB
C#
66 lines
1.6 KiB
C#
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
|
|
{
|
|
public IEnumerable<Warehouse> GetList(string strWhere = "", object Param = null)
|
|
{
|
|
|
|
|
|
using (var conn = U8LoginContext.Instance.Connection)
|
|
{
|
|
var sql = "select cWhCode as WarehouseCode,cWhName as WarehouseName,CONVERT(BIGINT,pubufts) AS pubufts from Warehouse";
|
|
if (!string.IsNullOrEmpty(strWhere))
|
|
{
|
|
sql += $" where {strWhere}";
|
|
}
|
|
return conn.Query<Warehouse>(sql, Param);
|
|
}
|
|
}
|
|
|
|
|
|
|
|
public IEnumerable<Warehouse> GetList(long Pubufts)
|
|
{
|
|
|
|
return this.GetList("CONVERT(BIGINT,pubufts) > @Pubufts", new { Pubufts });
|
|
}
|
|
|
|
|
|
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}%"
|
|
});
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
}
|
|
}
|