Dao/CustomersVoucherLogRepository.cs

(开头部分) 12KB

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

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Domain;
using IDao;
using Domain.SearchMdl;
using System.Data;
using Common;
using PWMIS.DataProvider.Data;
using Dao.Page;
using PWMIS.DataMap.Entity;
using PWMIS.DataProvider.Adapter;

namespace Dao
{
    public class CustomersVoucherLogRepository : Repository<CustomersVoucherLogMdl>,ICustomersVoucherLogRepository
    {
        /// <summary>
        /// 代金券消费记录分页数据查询方法
        /// </summary>
        /// <param name="cqo"></param>
        /// <param name="PageCount"></param>
        /// <returns></returns>
        public IList<CustomersVoucherLogExtMdl> GetCustomersVouchersLogPageData(SerachVoucherMdl SearchMdl, out int PageCount)
        {
            string sql = "select * from (select C.*,LssueBatch,LssueMoney,L.StartDate,L.EndDate,(case when S.CreateDate is null then C.CreateDate else S.CreateDate end) as LssueDate," +
            " datediff(d,C.CreateDate,getdate()) as UseDate,datediff(d,(case when S.CreateDate is null then C.CreateDate else S.CreateDate end),getdate()) as SendDate,isnull(Order_ID,'') as OrderNo," +
            " NickName,WXID,CO.Tel,(case when L.IsEver=1 then '永久有效' else (CONVERT(nvarchar(20),StartDate,23)+'至'+Convert(nvarchar(20),EndDate,23)) end) as IsEnabled,"+
            " (case when (L.IsEver<>1 and C.IsState<>'1' and (DATEADD( minute,5,GETDATE())<L.StartDate or getdate()>L.EndDate)) then '已过期' else (case when IsState='0' then '未使用' else '已消费' end) end) as IsStateTxt" +
            " from CustomersVoucherLog as C "+
            " left join SendVoucher as S on C.LssueVouchers_ID=S.ID and C.Customer_ID=S.Customer_ID" +
            " left join LssueVouchers as L on L.ID=C.LssueVouchers_ID"+
            " left join Customer as CO on CO.ID=C.Customer_ID) as list {0}";
            string sqlwhere = " where 1=1";
            if (!string.IsNullOrEmpty(SearchMdl.LssueBatch))
                sqlwhere += " and LssueBatch like '%" + SearchMdl.LssueBatch + "%'";
            if (SearchMdl.LssueMoney!=0)
                sqlwhere += " and LssueMoney=" + SearchMdl.LssueMoney;
            if (!string.IsNullOrEmpty(SearchMdl.StartDate))
                sqlwhere += " and StartDate >='" + SearchMdl.StartDate + "'";
            if (!string.IsNullOrEmpty(SearchMdl.EndDate))
                sqlwhere += " and EndDate <='" + SearchMdl.EndDate + "'";
            if (!string.IsNullOrEmpty(SearchMdl.NickName))
                sqlwhere += " and NickName like '%" + SearchMdl.NickName + "%'";
            if (!string.IsNullOrEmpty(SearchMdl.Tel))
                sqlwhere += " and Tel like '%" + SearchMdl.Tel + "%'";
            if (!string.IsNullOrEmpty(SearchMdl.Type))
                sqlwhere += " and IsStateTxt='" + SearchMdl.Type + "'";
            if (SearchMdl.LssueDate!=0)
                sqlwhere += " and UseDate <=" + SearchMdl.LssueDate+" and UseDate>=0";
            if (SearchMdl.SendDate != 0)
                sqlwhere += " and SendDate <=" + SearchMdl.SendDate+" and SendDate>=0";
            sql = string.Format(sql, sqlwhere);
            IList<CustomersVoucherLogExtMdl> list = Dao.Page.PageHelper<CustomersVoucherLogExtMdl>.GetPageListModel(SearchMdl.limit, SearchMdl.pageNumber, sql, "CreateDate", out PageCount);
            return list;
        }

        /// <summary>
后面还有 158 行代码,购买后查看完整代码

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

AI 解读

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

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