|
|
@@ -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) |
|
|
|
} |
|
|
|