1
huangxiaoqiang
4 天以前 85d9ca4ec972ce4d020db046d930e8991709ae2d
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
42
43
44
45
46
using SqlSugar;
using WIDESEA_Model.Models.Order;
 
namespace WIDESEA_StorageBasicService;
 
public class StockInfoDetailService : ServiceBase<DtStockInfoDetail, IStockInfoDetailRepository>, IStockInfoDetailService
{
    public StockInfoDetailService(IStockInfoDetailRepository BaseDal) : base(BaseDal)
    {
    }
    public override PageGridData<DtStockInfoDetail> GetPageData(PageDataOptions options)
    {
        string wheres = ValidatePageOptions(options);
        //获取排序字段
        Dictionary<string, OrderByType> orderbyDic = GetPageDataSort(options, TProperties);
        List<OrderByModel> orderByModels = new List<OrderByModel>();
        foreach (var item in orderbyDic)
        {
            OrderByModel orderByModel = new()
            {
                FieldName = item.Key,
                OrderByType = item.Value
            };
            orderByModels.Add(orderByModel);
        }
 
 
        int totalCount = 0;
        List<SearchParameters> searchParametersList = new List<SearchParameters>();
        if (!string.IsNullOrEmpty(options.Wheres))
        {
            try
            {
                searchParametersList = options.Wheres.DeserializeObject<List<SearchParameters>>();
                options.Filter = searchParametersList;
            }
            catch { }
        }
        var data = BaseDal.Db.Queryable<DtStockInfoDetail>()
            .WhereIF(!wheres.IsNullOrEmpty(), wheres)
            .OrderBy(orderByModels)
            .ToPageList(options.Page, options.Rows, ref totalCount);
        var x = new PageGridData<DtStockInfoDetail>(totalCount, data);
        return new PageGridData<DtStockInfoDetail>(totalCount, data);
    }
}