64 lines
1.6 KiB
C#
64 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 UnitDAL
|
|
{
|
|
public IEnumerable<Unit> GetList(string strWhere = "", object Param = null)
|
|
{
|
|
using (var conn = U8LoginContext.Instance.Connection)
|
|
{
|
|
var sql = @"select
|
|
cComunitCode AS UnitCode,
|
|
cComUnitName AS UnitName,bMainUnit as MainUnit,CONVERT(BIGINT,pubufts) AS pubufts, cGroupCode as GroupCode from ComputationUnit ";
|
|
if (!string.IsNullOrEmpty(strWhere))
|
|
{
|
|
sql += $" where {strWhere}";
|
|
}
|
|
return conn.Query<Unit>(sql, Param);
|
|
}
|
|
}
|
|
|
|
|
|
public IEnumerable<Unit> GetList(NX.ERP.Model.Request.Unit Params)
|
|
{
|
|
IList<string> where = new List<string>();
|
|
if (!string.IsNullOrEmpty(Params.UnitCode))
|
|
{
|
|
where.Add(" cComunitCode like @UnitCode ");
|
|
|
|
}
|
|
|
|
if (!string.IsNullOrEmpty(Params.UnitName))
|
|
{
|
|
where.Add(" cComUnitName like @UnitName ");
|
|
}
|
|
|
|
|
|
if (Params.Pubufts != null)
|
|
{
|
|
|
|
where.Add("CONVERT(BIGINT,pubufts) >=@Pubufts ");
|
|
|
|
}
|
|
|
|
|
|
|
|
return this.GetList(string.Join(" and ", where.ToArray()), new
|
|
{
|
|
UnitCode = $"%{Params.UnitCode}%",
|
|
UnitName = $"%{Params.UnitName}%",
|
|
Pubufts=Params.Pubufts
|
|
});
|
|
|
|
|
|
}
|
|
}
|
|
}
|