@@ -1332,6 +1332,8 @@ func CentralKitchenForSchoolGradeDelete(c *gin.Context) { | |||||
func CentralKitchenForSchoolClassDelete(c *gin.Context) { | func CentralKitchenForSchoolClassDelete(c *gin.Context) { | ||||
classId := c.Param("id") | classId := c.Param("id") | ||||
classWithUserDb := db.ClassWithUserDb{} | |||||
//1、查找当前年级 | //1、查找当前年级 | ||||
classDb := db.ClassDb{} | classDb := db.ClassDb{} | ||||
classDb.Set(0) | classDb.Set(0) | ||||
@@ -1347,7 +1349,6 @@ func CentralKitchenForSchoolClassDelete(c *gin.Context) { | |||||
} | } | ||||
//2、删除当前班级下的所有关联学生 | //2、删除当前班级下的所有关联学生 | ||||
classWithUserDb := db.ClassWithUserDb{} | |||||
classWithUserDb.Set() | classWithUserDb.Set() | ||||
_, err = classWithUserDb.DeleteClassWithUserByClass(classId) | _, err = classWithUserDb.DeleteClassWithUserByClass(classId) | ||||
if err != nil { | if err != nil { | ||||
@@ -1357,3 +1358,23 @@ func CentralKitchenForSchoolClassDelete(c *gin.Context) { | |||||
e.OutSuc(c, "success", nil) | e.OutSuc(c, "success", nil) | ||||
return | return | ||||
} | } | ||||
func CentralKitchenForSchoolClassDeleteCheck(c *gin.Context) { | |||||
classId := c.Param("id") | |||||
classWithUserDb := db.ClassWithUserDb{} | |||||
classWithUserDb.Set() | |||||
classWithUsers, err := classWithUserDb.FindUserIdentity(classId) | |||||
if err != nil { | |||||
e.OutErr(c, e.ERR_DB_ORM, err.Error()) | |||||
return | |||||
} | |||||
var isHasStudent = false | |||||
if len(*classWithUsers) > 0 { | |||||
isHasStudent = true | |||||
} | |||||
e.OutSuc(c, map[string]interface{}{ | |||||
"is_has_student": isHasStudent, | |||||
}, nil) | |||||
return | |||||
} |
@@ -172,6 +172,7 @@ func rEnterpriseManage(r *gin.RouterGroup) { | |||||
r.DELETE("/centralKitchenForSchool/gradeDelete/:id", hdl.CentralKitchenForSchoolGradeDelete) //"央厨-学校"年级删除 | r.DELETE("/centralKitchenForSchool/gradeDelete/:id", hdl.CentralKitchenForSchoolGradeDelete) //"央厨-学校"年级删除 | ||||
r.POST("/centralKitchenForSchool/classList", hdl.CentralKitchenForSchoolClassList) //"央厨-学校"班级列表 | r.POST("/centralKitchenForSchool/classList", hdl.CentralKitchenForSchoolClassList) //"央厨-学校"班级列表 | ||||
r.DELETE("/centralKitchenForSchool/classDelete/:id", hdl.CentralKitchenForSchoolClassDelete) //"央厨-学校"班级删除 | r.DELETE("/centralKitchenForSchool/classDelete/:id", hdl.CentralKitchenForSchoolClassDelete) //"央厨-学校"班级删除 | ||||
r.DELETE("/centralKitchenForSchool/classDeleteCheck/:id", hdl.CentralKitchenForSchoolClassDeleteCheck) //"央厨-学校"检测班级删除 | |||||
r.POST("/centralKitchenForSchool/ordList", hdl.CentralKitchenForSchoolOrdList) //"央厨-学校"订单列表 | r.POST("/centralKitchenForSchool/ordList", hdl.CentralKitchenForSchoolOrdList) //"央厨-学校"订单列表 | ||||
r.GET("/centralKitchenForSchool/ordDetail", hdl.CentralKitchenForSchoolOrdDetail) //"央厨-学校"订单详情 | r.GET("/centralKitchenForSchool/ordDetail", hdl.CentralKitchenForSchoolOrdDetail) //"央厨-学校"订单详情 | ||||
r.POST("/centralKitchenForSchool/ordRefund", hdl.CentralKitchenForSchoolOrdRefund) //"央厨-学校"订单退款 | r.POST("/centralKitchenForSchool/ordRefund", hdl.CentralKitchenForSchoolOrdRefund) //"央厨-学校"订单退款 | ||||