Dao/SwitchDutyREpository.cs

(开头部分) 4KB

这里只显示每个文件的开头 60 行。登录后可以解锁完整代码。

using Domain;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Entity.Common;
using System.Linq.Expressions;
using PWMIS.DataProvider.Data;
using PWMIS.DataProvider.Adapter;
using Common;
using IDao;
using System.Data;
using System.Globalization;
using PWMIS.DataMap.Entity;

namespace Dao
{
    public class SwitchDutyRepository : Repository<SwitchDutyMdl>, ISwitchDutyRepository
    {
        public List<SwitchdutyUserMdl> GetDynamicPagination(CommonQueryOption option, string shopid, out int totalcount)
        {
            SwitchDutyMdl sm = new SwitchDutyMdl();
            UsersMdl us = new UsersMdl();
            ShopMdl shop = new ShopMdl();

            OQL q = new OQL(sm).LeftJoin(us).On(sm.User_ID, us.ID).LeftJoin(shop).On(us.Shop_ID, shop.ID);

            OQLCompareFunc cmpFun = cmp =>
            {
                OQLCompare cmpResult = new OQLCompare(q);
                cmpResult = cmp.Comparer(sm.ID, OQLCompare.CompareType.NotEqual, Guid.Empty);

                if (!string.IsNullOrEmpty(option._ID))
                    cmpResult = cmpResult & cmp.Comparer(sm.ID, "=", Guid.Parse(option._ID));
                if (!string.IsNullOrEmpty(option._Status))
                    cmpResult = cmpResult & cmp.Comparer(sm.Status, "=", option._Status.To<int>());
                if (!string.IsNullOrEmpty(shopid))
                    cmpResult = cmpResult & cmp.Comparer(us.Shop_ID, "=", shopid);
                if (!string.IsNullOrEmpty(option._Name))
                      cmpResult = cmpResult & cmp.Comparer(us.UserName, "like", "%"+option._Name+"%");
                if (!string.IsNullOrEmpty(option._User_ID_Cashier))
                    cmpResult = cmpResult & cmp.Comparer(sm.User_ID, "=", option._User_ID_Cashier);
                if (!string.IsNullOrEmpty(option._DateStart))
                    cmpResult = cmpResult & cmp.Comparer(sm.StartDate,">=", option._DateStart.To<DateTime>());
                if (!string.IsNullOrEmpty(option._DateEnd))
                    cmpResult &= cmpResult.Comparer(sm.EndDate, "<=", option._DateEnd.To<DateTime>());

                return cmpResult;
            };

            var query = q.Limit(option.limit, option.pageNumber).Select(sm.StartDate, sm.ID,sm.SwitchDate,sm.Status, us.UserName,sm.EndDate,sm.CustomerPayTotalAmount,sm.Remark,sm.OrderTotalCount,sm.OrderTotalAmount,sm.ChangeTotalAmount,shop.ShopName).Where(cmpFun).OrderBy(sm.StartDate, "desc").END;

            var lstMol = EntityQuery<SwitchdutyUserMdl>.QueryList(query).ToList();

            OQL qCount = new OQL(sm).LeftJoin(us).On(sm.User_ID, us.ID);
            var queyCount = qCount.Select().Count(sm.OrderTotalCount, "OrderTotalCount").Where(cmpFun).END;

            sm = EntityQuery<SwitchDutyMdl>.QueryObject(queyCount);
            totalcount = sm.OrderTotalCount.To<int>();

后面还有 56 行代码,购买后查看完整代码

24 小时内免费解锁 3 个项目,之后 1 积分/个。 规则说明

AI 解读

登录后可用,每次 10 积分,解读结果公开显示在下面。

还没有人解读过这个文件。