DengBiao 8 месяцев назад
Родитель
Сommit
8a864c6c28
2 измененных файлов: 46 добавлений и 6 удалений
  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 Просмотреть файл

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

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

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


+ 44
- 4
app/admin/svc/enterprise_manage/svc_central_kitchen_for_school.go Просмотреть файл

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

import (
"applet/app/admin/enum"
"applet/app/admin/md"
"applet/app/admin/svc"
"applet/app/db"
"applet/app/db/model"
"applet/app/e"
enum2 "applet/app/enum"
"applet/app/utils"
"errors"
"fmt"
"github.com/gin-gonic/gin"
"strings"
"time"
)
@@ -595,7 +599,7 @@ func CentralKitchenForSchoolStudentAdmissionBySchool(req md.CentralKitchenForSch
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 classWithUserIdentityIdsTwo []int
classWithUserDb := db.ClassWithUserDb{}
@@ -630,6 +634,25 @@ func CentralKitchenForSchoolOrdList(req md.CentralKitchenForSchoolOrdListReq) (r
}

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 {
sess.And("central_kitchen_for_school_package_ord.enterprise_id =?", req.EnterpriseId)
}
@@ -942,7 +965,7 @@ func CentralKitchenForSchoolOrdStatistics(req md.CentralKitchenForSchoolOrdListR
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 classWithUserIdentityIdsTwo []int
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 {
sess.And("central_kitchen_for_school_package_ord_for_reserve.enterprise_id =?", req.EnterpriseId)
}


Загрузка…
Отмена
Сохранить