|
|
@@ -24,14 +24,14 @@ func AddCentralKitchenForSchoolPackage(req md.SaveCentralKitchenForSchoolPackage |
|
|
|
return errors.New("请勿重复添加【" + req.Month + "】套餐") |
|
|
|
} |
|
|
|
|
|
|
|
//1、查询`central_kitchen_for_school_with_spec` |
|
|
|
centralKitchenForSchoolWithSpec := db.CentralKitchenForSchoolWithSpec{} |
|
|
|
centralKitchenForSchoolWithSpec.Set(req.EnterpriseId) |
|
|
|
spec, err := centralKitchenForSchoolWithSpec.GetCentralKitchenForSchoolWithSpec() |
|
|
|
if err != nil { |
|
|
|
_ = session.Rollback() |
|
|
|
return err |
|
|
|
} |
|
|
|
////1、查询`central_kitchen_for_school_with_spec` |
|
|
|
//centralKitchenForSchoolWithSpec := db.CentralKitchenForSchoolWithSpec{} |
|
|
|
//centralKitchenForSchoolWithSpec.Set(req.EnterpriseId) |
|
|
|
//spec, err := centralKitchenForSchoolWithSpec.GetCentralKitchenForSchoolWithSpec() |
|
|
|
//if err != nil { |
|
|
|
// _ = session.Rollback() |
|
|
|
// return err |
|
|
|
//} |
|
|
|
//1、新增`central_kitchen_for_school_package` |
|
|
|
packageId, err := centralKitchenForSchoolPackageDb.CentralKitchenForSchoolPackageInsertBySession(session, &model.CentralKitchenForSchoolPackage{ |
|
|
|
EnterpriseId: req.EnterpriseId, |
|
|
@@ -53,13 +53,13 @@ func AddCentralKitchenForSchoolPackage(req md.SaveCentralKitchenForSchoolPackage |
|
|
|
var centralKitchenForSchoolPackageWithDays []*model.CentralKitchenForSchoolPackageWithDay |
|
|
|
for _, v := range req.DateList { |
|
|
|
var isOpenBreakfast, isOpenLunch, isOpenDinner, isOpenReplenish = md.CloseBreakfast, md.CloseLunch, md.CloseDinner, md.CloseReplenish |
|
|
|
if spec.IsOpenBreakfast == md.OpenBreakfast && v.IsOpenBreakfast == md.OpenBreakfast { |
|
|
|
if v.IsOpenBreakfast == md.OpenBreakfast { |
|
|
|
isOpenBreakfast = md.OpenBreakfast |
|
|
|
} |
|
|
|
if spec.IsOpenLunch == md.OpenLunch && v.IsOpenLunch == md.OpenLunch { |
|
|
|
if v.IsOpenLunch == md.OpenLunch { |
|
|
|
isOpenLunch = md.OpenLunch |
|
|
|
} |
|
|
|
if spec.IsOpenDinner == md.OpenDinner && v.IsOpenDinner == md.OpenDinner { |
|
|
|
if v.IsOpenDinner == md.OpenDinner { |
|
|
|
isOpenDinner = md.OpenDinner |
|
|
|
} |
|
|
|
if v.IsOpenReplenish == md.OpenReplenish { |
|
|
@@ -89,14 +89,14 @@ func UpdateCentralKitchenForSchoolPackage(req md.SaveCentralKitchenForSchoolPack |
|
|
|
defer session.Close() |
|
|
|
session.Begin() |
|
|
|
now := time.Now() |
|
|
|
//1、查询`central_kitchen_for_school_with_spec` |
|
|
|
centralKitchenForSchoolWithSpec := db.CentralKitchenForSchoolWithSpec{} |
|
|
|
centralKitchenForSchoolWithSpec.Set(req.EnterpriseId) |
|
|
|
spec, err := centralKitchenForSchoolWithSpec.GetCentralKitchenForSchoolWithSpec() |
|
|
|
if err != nil { |
|
|
|
_ = session.Rollback() |
|
|
|
return err |
|
|
|
} |
|
|
|
////1、查询`central_kitchen_for_school_with_spec` |
|
|
|
//centralKitchenForSchoolWithSpec := db.CentralKitchenForSchoolWithSpec{} |
|
|
|
//centralKitchenForSchoolWithSpec.Set(req.EnterpriseId) |
|
|
|
//spec, err := centralKitchenForSchoolWithSpec.GetCentralKitchenForSchoolWithSpec() |
|
|
|
//if err != nil { |
|
|
|
// _ = session.Rollback() |
|
|
|
// return err |
|
|
|
//} |
|
|
|
//2、修改`central_kitchen_for_school_package` |
|
|
|
centralKitchenForSchoolPackageDb := db.CentralKitchenForSchoolPackageDb{} |
|
|
|
centralKitchenForSchoolPackageDb.Set() |
|
|
@@ -138,13 +138,13 @@ func UpdateCentralKitchenForSchoolPackage(req md.SaveCentralKitchenForSchoolPack |
|
|
|
var centralKitchenForSchoolPackageWithDays []*model.CentralKitchenForSchoolPackageWithDay |
|
|
|
for _, v := range req.DateList { |
|
|
|
var isOpenBreakfast, isOpenLunch, isOpenDinner, isOpenReplenish = md.CloseBreakfast, md.CloseLunch, md.CloseDinner, md.CloseReplenish |
|
|
|
if spec.IsOpenBreakfast == md.OpenBreakfast && v.IsOpenBreakfast == md.OpenBreakfast { |
|
|
|
if v.IsOpenBreakfast == md.OpenBreakfast { |
|
|
|
isOpenBreakfast = md.OpenBreakfast |
|
|
|
} |
|
|
|
if spec.IsOpenLunch == md.OpenLunch && v.IsOpenLunch == md.OpenLunch { |
|
|
|
if v.IsOpenLunch == md.OpenLunch { |
|
|
|
isOpenLunch = md.OpenLunch |
|
|
|
} |
|
|
|
if spec.IsOpenDinner == md.OpenDinner && v.IsOpenDinner == md.OpenDinner { |
|
|
|
if v.IsOpenDinner == md.OpenDinner { |
|
|
|
isOpenDinner = md.OpenDinner |
|
|
|
} |
|
|
|
if v.IsOpenReplenish == md.OpenReplenish { |
|
|
|