zs
2025-04-28 1f32ea02c1910c417f159cba81a296e66ae7484c
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
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;
        }
    }
}