Commit d9db5492 authored by liudong1993's avatar liudong1993

1

parent 66777caf
using Mall.Common.AOP;
using System;
using System.Collections.Generic;
using System.Text;
using Mall.Model.Entity.User;
using Mall.Common.Enum.User;
namespace Mall.Model.Extend.User
{
/// <summary>
/// 会员购买表扩展实体
/// </summary>
[Serializable]
[DB(ConnectionName = "DefaultConnection")]
public class RB_Member_Buy_Extend : RB_Member_Buy
{
/// <summary>
/// 用户名称
/// </summary>
public string UserName { get; set; }
/// <summary>
/// 开始时间
/// </summary>
public string StartTime { get; set; }
/// <summary>
/// 结束时间
/// </summary>
public string EndTime { get; set; }
}
}
using Mall.Common.AOP;
using Mall.Common.Enum.MarketingCenter;
using Mall.Common.Enum.User;
using System;
using System.Collections.Generic;
using System.Text;
namespace Mall.Model.Entity.User
{
/// <summary>
/// 会员购买表实体
/// </summary>
[Serializable]
[DB(ConnectionName = "DefaultConnection")]
public class RB_Member_Buy
{
/// <summary>
/// Id
/// </summary>
public int Id
{
get;
set;
}
/// <summary>
/// 单号
/// </summary>
public string OrderNo
{
get;
set;
}
/// <summary>
/// 用户id
/// </summary>
public int? UserId
{
get;
set;
}
/// <summary>
/// 会员等级
/// </summary>
public int? GradeId
{
get;
set;
}
/// <summary>
/// 等级名称
/// </summary>
public string GradeName
{
get;
set;
}
/// <summary>
/// 支付金额
/// </summary>
public decimal? Money
{
get;
set;
}
/// <summary>
/// 支付时间
/// </summary>
public DateTime? PayTime
{
get;
set;
}
/// <summary>
/// 删除状态
/// </summary>
public int? Status
{
get;
set;
}
/// <summary>
/// 商户号
/// </summary>
public int TenantId
{
get;
set;
}
/// <summary>
/// 小程序id
/// </summary>
public int MallBaseId
{
get;
set;
}
/// <summary>
/// CreateDate
/// </summary>
public DateTime? CreateDate
{
get;
set;
}
}
}
using System;
using System.Collections.Generic;
using System.Text;
using Mall.Model.Entity.User;
using Mall.Model.Extend.User;
using System.Linq;
namespace Mall.Repository.User
{
/// <summary>
/// 用户会员购买仓储层
/// </summary>
public class RB_Member_BuyRepository : RepositoryBase<RB_Member_Buy>
{
/// <summary>
/// 分页列表
/// </summary>
/// <param name="pageIndex">页码</param>
/// <param name="pageSize">每页显示条数</param>
/// <param name="rowCount">总条数</param>
/// <param name="dmodel">查询条件</param>
/// <returns></returns>
public List<RB_Member_Buy_Extend> GetPageList(int pageIndex, int pageSize, out long rowCount, RB_Member_Buy_Extend dmodel)
{
string where = " 1=1 ";
if (dmodel.TenantId > 0)
{
where += $@" and b.{nameof(RB_Member_Buy_Extend.TenantId)}={dmodel.TenantId}";
}
if (dmodel.MallBaseId > 0)
{
where += $@" and b.{nameof(RB_Member_Buy_Extend.MallBaseId)}={dmodel.MallBaseId}";
}
if (dmodel.Id > 0)
{
where += $@" and b.{nameof(RB_Member_Buy_Extend.Id)}={dmodel.Id}";
}
if (dmodel.UserId > 0)
{
where += $@" and b.{nameof(RB_Member_Buy_Extend.UserId)}={dmodel.UserId}";
}
if (!string.IsNullOrEmpty(dmodel.UserName))
{
where += $@" and u.{nameof(RB_Member_User.Name)} like '%{dmodel.UserName}%'";
}
if (!string.IsNullOrEmpty(dmodel.StartTime)) {
where += $@" and b.{nameof(RB_Member_Buy_Extend.PayTime)} >= '{dmodel.StartTime}'";
}
if (!string.IsNullOrEmpty(dmodel.EndTime))
{
where += $@" and b.{nameof(RB_Member_Buy_Extend.PayTime)} <= '{dmodel.EndTime} 23:59:59'";
}
string sql = $@"select b.*,u.Name as UserName from RB_Member_Buy b
inner join rb_member_user u on b.UserId= u.Id
where {where} order by b.Id desc";
return GetPage<RB_Member_Buy_Extend>(pageIndex, pageSize, out rowCount, sql).ToList();
}
}
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment