Browse Source

update

tmp
DengBiao 8 months ago
parent
commit
8a864c6c28
2 changed files with 46 additions and 6 deletions
  1. +2
    -2
      app/admin/hdl/enterprise_manage/hdl_central_kitchen_for_school.go
  2. +44
    -4
      app/admin/svc/enterprise_manage/svc_central_kitchen_for_school.go

+ 2
- 2
app/admin/hdl/enterprise_manage/hdl_central_kitchen_for_school.go View File

@@ -819,7 +819,7 @@ func CentralKitchenForSchoolOrdList(c *gin.Context) {
// return // return
//} //}


resp, total, err := svc2.CentralKitchenForSchoolOrdList(req)
resp, total, err := svc2.CentralKitchenForSchoolOrdList(c, req)
if err != nil { if err != nil {
e.OutErr(c, e.ERR, err.Error()) e.OutErr(c, e.ERR, err.Error())
return return
@@ -950,7 +950,7 @@ func CentralKitchenForSchoolReserveList(c *gin.Context) {
return return
} }


resp, total, err := svc2.CentralKitchenForSchoolReserveList(req)
resp, total, err := svc2.CentralKitchenForSchoolReserveList(c, req)
if err != nil { if err != nil {
e.OutErr(c, e.ERR, err.Error()) e.OutErr(c, e.ERR, err.Error())
return return


+ 44
- 4
app/admin/svc/enterprise_manage/svc_central_kitchen_for_school.go View File

@@ -1,13 +1,17 @@
package svc package svc


import ( import (
"applet/app/admin/enum"
"applet/app/admin/md" "applet/app/admin/md"
"applet/app/admin/svc"
"applet/app/db" "applet/app/db"
"applet/app/db/model" "applet/app/db/model"
"applet/app/e"
enum2 "applet/app/enum" enum2 "applet/app/enum"
"applet/app/utils" "applet/app/utils"
"errors" "errors"
"fmt" "fmt"
"github.com/gin-gonic/gin"
"strings" "strings"
"time" "time"
) )
@@ -595,7 +599,7 @@ func CentralKitchenForSchoolStudentAdmissionBySchool(req md.CentralKitchenForSch
return return
} }


func CentralKitchenForSchoolOrdList(req md.CentralKitchenForSchoolOrdListReq) (resp []md.CentralKitchenForSchoolOrdListResp, count int64, err error) {
func CentralKitchenForSchoolOrdList(c *gin.Context, req md.CentralKitchenForSchoolOrdListReq) (resp []md.CentralKitchenForSchoolOrdListResp, count int64, err error) {
var classWithUserIdentityIdsOne []int var classWithUserIdentityIdsOne []int
var classWithUserIdentityIdsTwo []int var classWithUserIdentityIdsTwo []int
classWithUserDb := db.ClassWithUserDb{} classWithUserDb := db.ClassWithUserDb{}
@@ -630,6 +634,25 @@ func CentralKitchenForSchoolOrdList(req md.CentralKitchenForSchoolOrdListReq) (r
} }


sess := db.Db.Desc("central_kitchen_for_school_package_ord.id") sess := db.Db.Desc("central_kitchen_for_school_package_ord.id")
admin := svc.GetUser(c)
if admin.IsSuperAdministrator != enum.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_package_ord.enterprise_id", enterPriseIds)
}

if req.EnterpriseId != 0 { if req.EnterpriseId != 0 {
sess.And("central_kitchen_for_school_package_ord.enterprise_id =?", req.EnterpriseId) sess.And("central_kitchen_for_school_package_ord.enterprise_id =?", req.EnterpriseId)
} }
@@ -942,7 +965,7 @@ func CentralKitchenForSchoolOrdStatistics(req md.CentralKitchenForSchoolOrdListR
return return
} }


func CentralKitchenForSchoolReserveList(req md.CentralKitchenForSchoolReserveListReq) (resp []md.CentralKitchenForSchoolReserveListResp, count int64, err error) {
func CentralKitchenForSchoolReserveList(c *gin.Context, req md.CentralKitchenForSchoolReserveListReq) (resp []md.CentralKitchenForSchoolReserveListResp, count int64, err error) {
var classWithUserIdentityIdsOne []int var classWithUserIdentityIdsOne []int
var classWithUserIdentityIdsTwo []int var classWithUserIdentityIdsTwo []int
classWithUserDb := db.ClassWithUserDb{} classWithUserDb := db.ClassWithUserDb{}
@@ -1005,8 +1028,25 @@ func CentralKitchenForSchoolReserveList(req md.CentralKitchenForSchoolReserveLis
} }
} }


sess := db.Db.
Desc("central_kitchen_for_school_package_ord_for_reserve.id")
sess := db.Db.Desc("central_kitchen_for_school_package_ord_for_reserve.id")
admin := svc.GetUser(c)
if admin.IsSuperAdministrator != enum.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_package_ord_for_reserve.enterprise_id", enterPriseIds)
}
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)
} }


Loading…
Cancel
Save