diff --git a/app/admin/hdl/hdl_audit_center.go b/app/admin/hdl/hdl_audit_center.go index 7daf084..3ce85ea 100644 --- a/app/admin/hdl/hdl_audit_center.go +++ b/app/admin/hdl/hdl_audit_center.go @@ -26,7 +26,8 @@ func CentralKitchenForSchoolOrderRefundList(c *gin.Context) { e.OutErr(c, err1.Code, err1.Error()) return } - list, total, err := svc2.CentralKitchenForSchoolOrderRefundList(req) + + list, total, err := svc2.CentralKitchenForSchoolOrderRefundList(c, req) if err != nil { e.OutErr(c, e.ERR_DB_ORM, err.Error()) return diff --git a/app/admin/svc/order/svc_central_kitchen_for_school_order.go b/app/admin/svc/order/svc_central_kitchen_for_school_order.go index 7ee608d..43b4094 100644 --- a/app/admin/svc/order/svc_central_kitchen_for_school_order.go +++ b/app/admin/svc/order/svc_central_kitchen_for_school_order.go @@ -1,13 +1,16 @@ package svc import ( + enum3 "applet/app/admin/enum" "applet/app/admin/md" + svc4 "applet/app/admin/svc" svc "applet/app/admin/svc/enterprise_manage" enum2 "applet/app/customer/enum" md2 "applet/app/customer/md" svc2 "applet/app/customer/svc" "applet/app/db" model2 "applet/app/db/model" + "applet/app/e" "applet/app/enum" svc3 "applet/app/svc" "applet/app/utils" @@ -21,7 +24,7 @@ import ( "time" ) -func CentralKitchenForSchoolOrderRefundList(req md.CentralKitchenForSchoolOrderRefundListReq) (resp []md.CentralKitchenForSchoolOrderRefundListResp, total int64, err error) { +func CentralKitchenForSchoolOrderRefundList(c *gin.Context, req md.CentralKitchenForSchoolOrderRefundListReq) (resp []md.CentralKitchenForSchoolOrderRefundListResp, total int64, err error) { var m []*db.CentralKitchenForSchoolUserRefundDayWithData sess := db.Db.Where("1=1") if req.EnterpriseId != 0 { @@ -137,6 +140,24 @@ func CentralKitchenForSchoolOrderRefundList(req md.CentralKitchenForSchoolOrderR if len(classWithUserIdentityIdsTwo) > 0 { sess.In("user_identity.id", classWithUserIdentityIdsTwo) } + admin := svc4.GetUser(c) + if admin.IsSuperAdministrator != enum3.IsSuperAdministratorTure { + adminWithEnterpriseDb := db.AdminWithEnterpriseDb{} + adminWithEnterpriseDb.Set() + adminWithEnterprise, err1 := adminWithEnterpriseDb.FindAdminWithEnterprise(admin.AdmId) + if err1 != nil { + e.OutErr(c, e.ERR_DB_ORM, err1.Error()) + return + } + var enterPriseIds []int + for _, v1 := range *adminWithEnterprise { + enterPriseIds = append(enterPriseIds, v1.EnterpriseId) + } + if len(enterPriseIds) == 0 { + return + } + sess.In("central_kitchen_for_school_user_with_day.enterprise_id", enterPriseIds) + } total, err = sess. Join("LEFT", "central_kitchen_for_school_user_with_day", "central_kitchen_for_school_user_refund_day.records_id = central_kitchen_for_school_user_with_day.id").