Browse Source

update

add_mode
DengBiao 1 year ago
parent
commit
3a0ced1e39
1 changed files with 49 additions and 3 deletions
  1. +49
    -3
      app/admin/svc/svc_data_statisstics.go

+ 49
- 3
app/admin/svc/svc_data_statisstics.go View File

@@ -643,8 +643,20 @@ func CentralKitchenForSchoolDataStatisticsExport(req md.CentralKitchenForSchoolD
if req.EnterpriseId != 0 {
sess.And("central_kitchen_for_school_package_ord_for_reserve.enterprise_id =?", req.EnterpriseId)
}

var filterOrdNo []string
if req.StartDate != "" {
sess.And("central_kitchen_for_school_package_ord_for_reserve.meal_time_start <= ? and central_kitchen_for_school_package_ord_for_reserve.meal_time_end >= ?", req.StartDate, req.EndDate)
var mm []*model.CentralKitchenForSchoolUserWithDay
err := db.Db.Where("date >= ?", req.StartDate).And("date <= ?", req.EndDate).GroupBy("ord_no").Find(&mm)
if err != nil {
logx.Error(err)
println("<<<<CentralKitchenForSchoolDataStatisticsExport3>>>>>Error:::", err.Error())
return
}
for _, m := range mm {
filterOrdNo = append(filterOrdNo, m.OrdNo)
}
//sess.And("central_kitchen_for_school_package_ord_for_reserve.meal_time_start <= ? and central_kitchen_for_school_package_ord_for_reserve.meal_time_end >= ?", req.StartDate, req.EndDate)
}
//if req.EndDate != "" {
// sess.And("central_kitchen_for_school_package_ord_for_reserve.meal_time_start <= ?", req.EndDate)
@@ -652,6 +664,10 @@ func CentralKitchenForSchoolDataStatisticsExport(req md.CentralKitchenForSchoolD
if len(req.MealKindList) > 0 {
sess.In("central_kitchen_for_school_package_ord_for_reserve.kind", req.MealKindList)
}
if len(filterOrdNo) > 0 {
sess.In("central_kitchen_for_school_package_ord_for_reserve.out_trade_no", filterOrdNo)
}

_, err := sess.
Join("LEFT", "central_kitchen_for_school_package_ord", "central_kitchen_for_school_package_ord_for_reserve.out_trade_no = central_kitchen_for_school_package_ord.out_trade_no").
Join("LEFT", "user_identity", "central_kitchen_for_school_package_ord.user_identity_id = user_identity.id").
@@ -833,8 +849,19 @@ func CentralKitchenForSchoolDataStatisticsExport(req md.CentralKitchenForSchoolD
if req.EnterpriseId != 0 {
sess.And("central_kitchen_for_school_package_ord_for_reserve.enterprise_id =?", req.EnterpriseId)
}
var filterOrdNo []string
if req.StartDate != "" {
sess.And("central_kitchen_for_school_package_ord_for_reserve.meal_time_start <= ? and central_kitchen_for_school_package_ord_for_reserve.meal_time_end >= ?", req.StartDate, req.EndDate)
var mm []*model.CentralKitchenForSchoolUserWithDay
err := db.Db.Where("date >= ?", req.StartDate).And("date <= ?", req.EndDate).GroupBy("ord_no").Find(&mm)
if err != nil {
logx.Error(err)
println("<<<<CentralKitchenForSchoolDataStatisticsExport3>>>>>Error:::", err.Error())
return
}
for _, m := range mm {
filterOrdNo = append(filterOrdNo, m.OrdNo)
}
//sess.And("central_kitchen_for_school_package_ord_for_reserve.meal_time_start <= ? and central_kitchen_for_school_package_ord_for_reserve.meal_time_end >= ?", req.StartDate, req.EndDate)
}
//if req.EndDate != "" {
// sess.And("central_kitchen_for_school_package_ord_for_reserve.meal_time_start <= ?", req.EndDate)
@@ -842,6 +869,10 @@ func CentralKitchenForSchoolDataStatisticsExport(req md.CentralKitchenForSchoolD
if len(req.MealKindList) > 0 {
sess.In("central_kitchen_for_school_package_ord_for_reserve.kind", req.MealKindList)
}
if len(filterOrdNo) > 0 {
sess.In("central_kitchen_for_school_package_ord_for_reserve.out_trade_no", filterOrdNo)
}

_, err := sess.
Join("LEFT", "central_kitchen_for_school_package_ord", "central_kitchen_for_school_package_ord_for_reserve.out_trade_no = central_kitchen_for_school_package_ord.out_trade_no").
Join("LEFT", "user_identity", "central_kitchen_for_school_package_ord.user_identity_id = user_identity.id").
@@ -1458,8 +1489,19 @@ func CentralKitchenForSchoolDataStatisticsExport(req md.CentralKitchenForSchoolD
if req.EnterpriseId != 0 {
sess.And("central_kitchen_for_school_package_ord_for_reserve.enterprise_id =?", req.EnterpriseId)
}
var filterOrdNo []string
if req.StartDate != "" {
sess.And("central_kitchen_for_school_package_ord_for_reserve.meal_time_start <= ? and central_kitchen_for_school_package_ord_for_reserve.meal_time_end >= ?", req.StartDate, req.EndDate)
var mm []*model.CentralKitchenForSchoolUserWithDay
err := db.Db.Where("date >= ?", req.StartDate).And("date <= ?", req.EndDate).GroupBy("ord_no").Find(&mm)
if err != nil {
logx.Error(err)
println("<<<<CentralKitchenForSchoolDataStatisticsExport3>>>>>Error:::", err.Error())
return
}
for _, m := range mm {
filterOrdNo = append(filterOrdNo, m.OrdNo)
}
//sess.And("central_kitchen_for_school_package_ord_for_reserve.meal_time_start <= ? and central_kitchen_for_school_package_ord_for_reserve.meal_time_end >= ?", req.StartDate, req.EndDate)
}
//if req.EndDate != "" {
// sess.And("central_kitchen_for_school_package_ord_for_reserve.meal_time_start <= ?", req.EndDate)
@@ -1467,6 +1509,10 @@ func CentralKitchenForSchoolDataStatisticsExport(req md.CentralKitchenForSchoolD
if len(req.MealKindList) > 0 {
sess.In("central_kitchen_for_school_package_ord_for_reserve.kind", req.MealKindList)
}
if len(filterOrdNo) > 0 {
sess.In("central_kitchen_for_school_package_ord_for_reserve.out_trade_no", filterOrdNo)
}

_, err := sess.
Join("LEFT", "central_kitchen_for_school_package_ord", "central_kitchen_for_school_package_ord_for_reserve.out_trade_no = central_kitchen_for_school_package_ord.out_trade_no").
Join("LEFT", "user_identity", "central_kitchen_for_school_package_ord.user_identity_id = user_identity.id").


Loading…
Cancel
Save