Commit 91e17ca4 authored by 吴春's avatar 吴春

提交

parent a04a38fb
...@@ -206,5 +206,7 @@ namespace Mall.Model.Entity.User ...@@ -206,5 +206,7 @@ namespace Mall.Model.Entity.User
/// 成为下线时间 /// 成为下线时间
/// </summary> /// </summary>
public DateTime? BeDownlineDate { get; set; } public DateTime? BeDownlineDate { get; set; }
//public int SmallShopId { get; set; }
} }
} }
...@@ -152,11 +152,11 @@ namespace Mall.Repository.User ...@@ -152,11 +152,11 @@ namespace Mall.Repository.User
} }
if (query.StartDate.HasValue) if (query.StartDate.HasValue)
{ {
builder.Append($" AND DATE_FORMAT(c.{nameof(RB_DiscountCoupon.CreateDate)},'%Y-%m-%d' )>= DATE_FORMAT('{query.StartDate}','%Y-%m-%d' )"); builder.Append($" AND DATE_FORMAT(a.{nameof(RB_Member_DiscountCoupon_Extend.CreateDate)},'%Y-%m-%d' )>= DATE_FORMAT('{query.StartDate}','%Y-%m-%d' )");
} }
if (query.EndDate.HasValue) if (query.EndDate.HasValue)
{ {
builder.Append($" AND DATE_FORMAT(c.{nameof(RB_DiscountCoupon.CreateDate)},'%Y-%m-%d' )<= DATE_FORMAT('{query.EndDate}','%Y-%m-%d' )"); builder.Append($" AND DATE_FORMAT(a.{nameof(RB_Member_DiscountCoupon_Extend.CreateDate)},'%Y-%m-%d' )<= DATE_FORMAT('{query.EndDate}','%Y-%m-%d' )");
} }
} }
string sql = @$" select * FROM string sql = @$" select * FROM
...@@ -194,41 +194,41 @@ LEFT JOIN {DiscountCouponTableName} as c on c.ID=a.CouponId where 1=1 {builder ...@@ -194,41 +194,41 @@ LEFT JOIN {DiscountCouponTableName} as c on c.ID=a.CouponId where 1=1 {builder
} }
if (!string.IsNullOrWhiteSpace(query.StartDate)) if (!string.IsNullOrWhiteSpace(query.StartDate))
{ {
builder.Append($" AND DATE_FORMAT(c.{nameof(RB_DiscountCoupon.CreateDate)},'%Y-%m-%d' )>= DATE_FORMAT('{query.StartDate}','%Y-%m-%d' )"); builder.Append($" AND DATE_FORMAT(a.{nameof(RB_Member_DiscountCoupon_Extend.CreateDate)},'%Y-%m-%d' )>= DATE_FORMAT('{query.StartDate}','%Y-%m-%d' )");
} }
if (!string.IsNullOrWhiteSpace(query.EndDate)) if (!string.IsNullOrWhiteSpace(query.EndDate))
{ {
builder.Append($" AND DATE_FORMAT(c.{nameof(RB_DiscountCoupon.CreateDate)},'%Y-%m-%d' )<= DATE_FORMAT('{query.EndDate}','%Y-%m-%d' )"); builder.Append($" AND DATE_FORMAT(a.{nameof(RB_Member_DiscountCoupon_Extend.CreateDate)},'%Y-%m-%d' )<= DATE_FORMAT('{query.EndDate}','%Y-%m-%d' )");
} }
} }
string sql = @$" SELECT t.CouponId,MAX(t.`Name`) as Name,SUM(t.IsSued) as IsSued,SUM(t.Used) as Used,SUM(t.UnUsed) as UnUsed,SUM(t.Voksi) as Voksi,MAX(t.CreateDate)as CreateDate from (SELECT string sql = @$" SELECT t.CouponId,MAX(t.`Name`) as Name,SUM(t.IsSued) as IsSued,SUM(t.Used) as Used,SUM(t.UnUsed) as UnUsed,SUM(t.Voksi) as Voksi,MAX(t.CreateDate)as CreateDate from (SELECT
DATE_FORMAT(c.CreateDate, '%Y-%m-%d') AS CreateDate,a.CouponId,c.`Name`,count(*) as IsSued,0 as Used,0 as UnUsed,0 as Voksi DATE_FORMAT(a.CreateDate, '%Y-%m-%d') AS CreateDate,a.CouponId,c.`Name`,count(*) as IsSued,0 as Used,0 as UnUsed,0 as Voksi
FROM FROM
{TableName} AS a {TableName} AS a
LEFT JOIN {MemberTableName} AS b ON a.UserId = b.Id LEFT JOIN {MemberTableName} AS b ON a.UserId = b.Id
LEFT JOIN {DiscountCouponTableName} as c on c.ID=a.CouponId LEFT JOIN {DiscountCouponTableName} as c on c.ID=a.CouponId where 1=1 {builder.ToString()} group by a.CouponId,DATE_FORMAT(a.CreateDate, '%Y-%m-%d')
union all union all
SELECT SELECT
DATE_FORMAT(c.CreateDate, '%Y-%m-%d') AS CreateDate,a.CouponId,c.`Name`,0 as IsSued,count(UseState) as Used,0 as UnUsed,0 as Voksi DATE_FORMAT(a.CreateDate, '%Y-%m-%d') AS CreateDate,a.CouponId,c.`Name`,0 as IsSued,count(UseState) as Used,0 as UnUsed,0 as Voksi
FROM FROM
{TableName} AS a {TableName} AS a
LEFT JOIN {MemberTableName} AS b ON a.UserId = b.Id LEFT JOIN {MemberTableName} AS b ON a.UserId = b.Id
LEFT JOIN {DiscountCouponTableName} as c on c.ID=a.CouponId where a.UseState=1 LEFT JOIN {DiscountCouponTableName} as c on c.ID=a.CouponId where a.UseState=1 {builder.ToString()} group by a.CouponId,DATE_FORMAT(a.CreateDate, '%Y-%m-%d')
union all union all
SELECT SELECT
DATE_FORMAT(c.CreateDate, '%Y-%m-%d') AS CreateDate,a.CouponId,c.`Name`,0 as IsSued,0 as Used,count(*) as UnUsed,0 as Voksi DATE_FORMAT(a.CreateDate, '%Y-%m-%d') AS CreateDate,a.CouponId,c.`Name`,0 as IsSued,0 as Used,count(*) as UnUsed,0 as Voksi
FROM FROM
{TableName} AS a {TableName} AS a
LEFT JOIN {MemberTableName} AS b ON a.UserId = b.Id LEFT JOIN {MemberTableName} AS b ON a.UserId = b.Id
LEFT JOIN {DiscountCouponTableName} as c on c.ID=a.CouponId where a.UseState=0 LEFT JOIN {DiscountCouponTableName} as c on c.ID=a.CouponId where a.UseState=0 {builder.ToString()} group by a.CouponId,DATE_FORMAT(a.CreateDate, '%Y-%m-%d')
union all union all
SELECT SELECT
DATE_FORMAT(c.CreateDate, '%Y-%m-%d') AS CreateDate,a.CouponId,c.`Name`,0 as IsSued,0 as Used,0 as UnUsed,count(*) as Voksi DATE_FORMAT(a.CreateDate, '%Y-%m-%d') AS CreateDate,a.CouponId,c.`Name`,0 as IsSued,0 as Used,0 as UnUsed,count(*) as Voksi
FROM FROM
{TableName} AS a {TableName} AS a
LEFT JOIN {MemberTableName} AS b ON a.UserId = b.Id LEFT JOIN {MemberTableName} AS b ON a.UserId = b.Id
LEFT JOIN {DiscountCouponTableName} as c on c.ID=a.CouponId where a.EndDate<NOW() and a.UseState=0) as t WHERE t.CouponId>0 GROUP BY t.CouponId "; LEFT JOIN {DiscountCouponTableName} as c on c.ID=a.CouponId where a.EndDate<NOW() and a.UseState=0 group by a.CouponId,DATE_FORMAT(a.CreateDate, '%Y-%m-%d')) as t WHERE t.CouponId>0 GROUP BY t.CouponId,t.CreateDate ORDER BY t.CreateDate desc ";
return GetPage<MemberCoupon_Query>(pageIndex, pageSize, out rowCount, sql).ToList(); return GetPage<MemberCoupon_Query>(pageIndex, pageSize, out rowCount, sql).ToList();
} }
...@@ -260,41 +260,68 @@ LEFT JOIN {DiscountCouponTableName} as c on c.ID=a.CouponId where a.EndDate<NO ...@@ -260,41 +260,68 @@ LEFT JOIN {DiscountCouponTableName} as c on c.ID=a.CouponId where a.EndDate<NO
} }
if (!string.IsNullOrWhiteSpace(query.StartDate)) if (!string.IsNullOrWhiteSpace(query.StartDate))
{ {
builder.Append($" AND DATE_FORMAT(c.{nameof(RB_DiscountCoupon.CreateDate)},'%Y-%m-%d' )>= DATE_FORMAT('{query.StartDate}','%Y-%m-%d' )"); builder.Append($" AND DATE_FORMAT(a.{nameof(RB_Member_DiscountCoupon_Extend.CreateDate)},'%Y-%m-%d' )>= DATE_FORMAT('{query.StartDate}','%Y-%m-%d' )");
} }
if (!string.IsNullOrWhiteSpace(query.EndDate)) if (!string.IsNullOrWhiteSpace(query.EndDate))
{ {
builder.Append($" AND DATE_FORMAT(c.{nameof(RB_DiscountCoupon.CreateDate)},'%Y-%m-%d' )<= DATE_FORMAT('{query.EndDate}','%Y-%m-%d' )"); builder.Append($" AND DATE_FORMAT(a.{nameof(RB_Member_DiscountCoupon_Extend.CreateDate)},'%Y-%m-%d' )<= DATE_FORMAT('{query.EndDate}','%Y-%m-%d' )");
} }
} }
string sql = @$" SELECT t.CouponId,MAX(t.`Name`) as Name,SUM(t.IsSued) as IsSued,SUM(t.Used) as Used,SUM(t.UnUsed) as UnUsed,SUM(t.Voksi) as Voksi,MAX(t.CreateDate)as CreateDate from (SELECT string sql = @$" SELECT t.CouponId,MAX(t.`Name`) as Name,SUM(t.IsSued) as IsSued,SUM(t.Used) as Used,SUM(t.UnUsed) as UnUsed,SUM(t.Voksi) as Voksi,MAX(t.CreateDate)as CreateDate from (SELECT
DATE_FORMAT(c.CreateDate, '%Y-%m-%d') AS CreateDate,a.CouponId,c.`Name`,count(*) as IsSued,0 as Used,0 as UnUsed,0 as Voksi DATE_FORMAT(a.CreateDate, '%Y-%m-%d') AS CreateDate,a.CouponId,c.`Name`,count(*) as IsSued,0 as Used,0 as UnUsed,0 as Voksi
FROM FROM
{TableName} AS a {TableName} AS a
LEFT JOIN {MemberTableName} AS b ON a.UserId = b.Id LEFT JOIN {MemberTableName} AS b ON a.UserId = b.Id
LEFT JOIN {DiscountCouponTableName} as c on c.ID=a.CouponId LEFT JOIN {DiscountCouponTableName} as c on c.ID=a.CouponId where 1=1 {builder.ToString()} group by a.CouponId,DATE_FORMAT(a.CreateDate, '%Y-%m-%d')
union all union all
SELECT SELECT
DATE_FORMAT(c.CreateDate, '%Y-%m-%d') AS CreateDate,a.CouponId,c.`Name`,0 as IsSued,count(UseState) as Used,0 as UnUsed,0 as Voksi DATE_FORMAT(a.CreateDate, '%Y-%m-%d') AS CreateDate,a.CouponId,c.`Name`,0 as IsSued,count(UseState) as Used,0 as UnUsed,0 as Voksi
FROM FROM
{TableName} AS a {TableName} AS a
LEFT JOIN {MemberTableName} AS b ON a.UserId = b.Id LEFT JOIN {MemberTableName} AS b ON a.UserId = b.Id
LEFT JOIN {DiscountCouponTableName} as c on c.ID=a.CouponId where a.UseState=1 LEFT JOIN {DiscountCouponTableName} as c on c.ID=a.CouponId where a.UseState=1 {builder.ToString()} group by a.CouponId,DATE_FORMAT(a.CreateDate, '%Y-%m-%d')
union all union all
SELECT SELECT
DATE_FORMAT(c.CreateDate, '%Y-%m-%d') AS CreateDate,a.CouponId,c.`Name`,0 as IsSued,0 as Used,count(*) as UnUsed,0 as Voksi DATE_FORMAT(a.CreateDate, '%Y-%m-%d') AS CreateDate,a.CouponId,c.`Name`,0 as IsSued,0 as Used,count(*) as UnUsed,0 as Voksi
FROM FROM
{TableName} AS a {TableName} AS a
LEFT JOIN {MemberTableName} AS b ON a.UserId = b.Id LEFT JOIN {MemberTableName} AS b ON a.UserId = b.Id
LEFT JOIN {DiscountCouponTableName} as c on c.ID=a.CouponId where a.UseState=0 LEFT JOIN {DiscountCouponTableName} as c on c.ID=a.CouponId where a.UseState=0 {builder.ToString()} group by a.CouponId,DATE_FORMAT(a.CreateDate, '%Y-%m-%d')
union all union all
SELECT SELECT
DATE_FORMAT(c.CreateDate, '%Y-%m-%d') AS CreateDate,a.CouponId,c.`Name`,0 as IsSued,0 as Used,0 as UnUsed,count(*) as Voksi DATE_FORMAT(a.CreateDate, '%Y-%m-%d') AS CreateDate,a.CouponId,c.`Name`,0 as IsSued,0 as Used,0 as UnUsed,count(*) as Voksi
FROM FROM
{TableName} AS a {TableName} AS a
LEFT JOIN {MemberTableName} AS b ON a.UserId = b.Id LEFT JOIN {MemberTableName} AS b ON a.UserId = b.Id
LEFT JOIN {DiscountCouponTableName} as c on c.ID=a.CouponId where a.EndDate<NOW() and a.UseState=0) as t WHERE t.CouponId>0 GROUP BY t.CouponId "; LEFT JOIN {DiscountCouponTableName} as c on c.ID=a.CouponId where a.EndDate<NOW() and a.UseState=0 group by a.CouponId,DATE_FORMAT(a.CreateDate, '%Y-%m-%d')) as t WHERE t.CouponId>0 GROUP BY t.CouponId,t.CreateDate ORDER BY t.CreateDate desc";
// string sql = @$" SELECT t.CouponId,MAX(t.`Name`) as Name,SUM(t.IsSued) as IsSued,SUM(t.Used) as Used,SUM(t.UnUsed) as UnUsed,SUM(t.Voksi) as Voksi,MAX(t.CreateDate)as CreateDate from (SELECT
// DATE_FORMAT(c.CreateDate, '%Y-%m-%d') AS CreateDate,a.CouponId,c.`Name`,count(*) as IsSued,0 as Used,0 as UnUsed,0 as Voksi
//FROM
// {TableName} AS a
//LEFT JOIN {MemberTableName} AS b ON a.UserId = b.Id
//LEFT JOIN {DiscountCouponTableName} as c on c.ID=a.CouponId
//union all
//SELECT
// DATE_FORMAT(c.CreateDate, '%Y-%m-%d') AS CreateDate,a.CouponId,c.`Name`,0 as IsSued,count(UseState) as Used,0 as UnUsed,0 as Voksi
//FROM
// {TableName} AS a
//LEFT JOIN {MemberTableName} AS b ON a.UserId = b.Id
//LEFT JOIN {DiscountCouponTableName} as c on c.ID=a.CouponId where a.UseState=1
//union all
//SELECT
// DATE_FORMAT(c.CreateDate, '%Y-%m-%d') AS CreateDate,a.CouponId,c.`Name`,0 as IsSued,0 as Used,count(*) as UnUsed,0 as Voksi
//FROM
// {TableName} AS a
//LEFT JOIN {MemberTableName} AS b ON a.UserId = b.Id
//LEFT JOIN {DiscountCouponTableName} as c on c.ID=a.CouponId where a.UseState=0
//union all
//SELECT
// DATE_FORMAT(c.CreateDate, '%Y-%m-%d') AS CreateDate,a.CouponId,c.`Name`,0 as IsSued,0 as Used,0 as UnUsed,count(*) as Voksi
//FROM
// {TableName} AS a
//LEFT JOIN {MemberTableName} AS b ON a.UserId = b.Id
//LEFT JOIN {DiscountCouponTableName} as c on c.ID=a.CouponId where a.EndDate<NOW() and a.UseState=0) as t WHERE t.CouponId>0 GROUP BY t.CouponId ";
return Get<MemberCoupon_Query>(sql).ToList(); return Get<MemberCoupon_Query>(sql).ToList();
} }
......
...@@ -332,9 +332,13 @@ namespace Mall.WebApi.Controllers.User ...@@ -332,9 +332,13 @@ namespace Mall.WebApi.Controllers.User
{ {
return ApiResult.Failed("请传递提现方式描述"); return ApiResult.Failed("请传递提现方式描述");
} }
if (demodel.Id == 0)
{
demodel.CreateDate = DateTime.Now;
demodel.TenantId = Convert.ToInt32(requestParm.uid); demodel.TenantId = Convert.ToInt32(requestParm.uid);
demodel.MallBaseId = requestParm.MallBaseId; demodel.MallBaseId = requestParm.MallBaseId;
demodel.CreateDate = DateTime.Now; }
demodel.UpdateDate = DateTime.Now; demodel.UpdateDate = DateTime.Now;
bool flag = smallShopsModule.SetSmallShopsCustomInfo(demodel); bool flag = smallShopsModule.SetSmallShopsCustomInfo(demodel);
if (flag) if (flag)
......
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