|
|
@@ -1332,6 +1332,8 @@ func CentralKitchenForSchoolGradeDelete(c *gin.Context) { |
|
|
|
|
|
|
|
func CentralKitchenForSchoolClassDelete(c *gin.Context) { |
|
|
|
classId := c.Param("id") |
|
|
|
classWithUserDb := db.ClassWithUserDb{} |
|
|
|
|
|
|
|
//1、查找当前年级 |
|
|
|
classDb := db.ClassDb{} |
|
|
|
classDb.Set(0) |
|
|
@@ -1347,7 +1349,6 @@ func CentralKitchenForSchoolClassDelete(c *gin.Context) { |
|
|
|
} |
|
|
|
|
|
|
|
//2、删除当前班级下的所有关联学生 |
|
|
|
classWithUserDb := db.ClassWithUserDb{} |
|
|
|
classWithUserDb.Set() |
|
|
|
_, err = classWithUserDb.DeleteClassWithUserByClass(classId) |
|
|
|
if err != nil { |
|
|
@@ -1357,3 +1358,23 @@ func CentralKitchenForSchoolClassDelete(c *gin.Context) { |
|
|
|
e.OutSuc(c, "success", nil) |
|
|
|
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 |
|
|
|
} |