using System.Linq.Expressions;
|
|
namespace CMS.Plugin.HIAWms.Domain.WmsPlaces
|
{
|
/// <summary>
|
/// WmsPlace规约
|
/// </summary>
|
public class WmsPlaceSpecification : Volo.Abp.Specifications.Specification<WmsPlace>
|
{
|
private readonly string _placeNo;
|
|
/// <summary>
|
/// Initializes a new instance of the <see cref="WmsPlaceSpecification"/> class.
|
/// </summary>
|
public WmsPlaceSpecification()
|
{
|
}
|
|
/// <summary>
|
/// Initializes a new instance of the <see cref="WmsPlaceSpecification"/> class.
|
/// </summary>
|
/// <param name="placeNo">The name.</param>
|
public WmsPlaceSpecification(string placeNo = null)
|
{
|
_placeNo = placeNo;
|
}
|
|
/// <inheritdoc />
|
public override Expression<Func<WmsPlace, bool>> ToExpression()
|
{
|
Expression<Func<WmsPlace, bool>> expression = c => 1 == 1;
|
|
if (_placeNo != null)
|
{
|
expression = expression.And(c => c.PlaceNo == _placeNo);
|
}
|
|
return expression;
|
}
|
}
|
}
|