|
@@ -643,8 +643,20 @@ func CentralKitchenForSchoolDataStatisticsExport(req md.CentralKitchenForSchoolD |
|
|
if req.EnterpriseId != 0 { |
|
|
if req.EnterpriseId != 0 { |
|
|
sess.And("central_kitchen_for_school_package_ord_for_reserve.enterprise_id =?", req.EnterpriseId) |
|
|
sess.And("central_kitchen_for_school_package_ord_for_reserve.enterprise_id =?", req.EnterpriseId) |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
var filterOrdNo []string |
|
|
if req.StartDate != "" { |
|
|
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 != "" { |
|
|
//if req.EndDate != "" { |
|
|
// sess.And("central_kitchen_for_school_package_ord_for_reserve.meal_time_start <= ?", 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 { |
|
|
if len(req.MealKindList) > 0 { |
|
|
sess.In("central_kitchen_for_school_package_ord_for_reserve.kind", req.MealKindList) |
|
|
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. |
|
|
_, 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", "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"). |
|
|
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 { |
|
|
if req.EnterpriseId != 0 { |
|
|
sess.And("central_kitchen_for_school_package_ord_for_reserve.enterprise_id =?", req.EnterpriseId) |
|
|
sess.And("central_kitchen_for_school_package_ord_for_reserve.enterprise_id =?", req.EnterpriseId) |
|
|
} |
|
|
} |
|
|
|
|
|
var filterOrdNo []string |
|
|
if req.StartDate != "" { |
|
|
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 != "" { |
|
|
//if req.EndDate != "" { |
|
|
// sess.And("central_kitchen_for_school_package_ord_for_reserve.meal_time_start <= ?", 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 { |
|
|
if len(req.MealKindList) > 0 { |
|
|
sess.In("central_kitchen_for_school_package_ord_for_reserve.kind", req.MealKindList) |
|
|
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. |
|
|
_, 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", "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"). |
|
|
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 { |
|
|
if req.EnterpriseId != 0 { |
|
|
sess.And("central_kitchen_for_school_package_ord_for_reserve.enterprise_id =?", req.EnterpriseId) |
|
|
sess.And("central_kitchen_for_school_package_ord_for_reserve.enterprise_id =?", req.EnterpriseId) |
|
|
} |
|
|
} |
|
|
|
|
|
var filterOrdNo []string |
|
|
if req.StartDate != "" { |
|
|
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 != "" { |
|
|
//if req.EndDate != "" { |
|
|
// sess.And("central_kitchen_for_school_package_ord_for_reserve.meal_time_start <= ?", 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 { |
|
|
if len(req.MealKindList) > 0 { |
|
|
sess.In("central_kitchen_for_school_package_ord_for_reserve.kind", req.MealKindList) |
|
|
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. |
|
|
_, 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", "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"). |
|
|
Join("LEFT", "user_identity", "central_kitchen_for_school_package_ord.user_identity_id = user_identity.id"). |
|
|