From 0447af0530090b261cbe5f99a8276cf5f7e12e06 Mon Sep 17 00:00:00 2001 From: DengBiao <2319963317@qq.com> Date: Fri, 13 Oct 2023 12:31:21 +0800 Subject: [PATCH] update --- .../hdl_self_support_for_school.go | 20 +++++++++++++++++++ app/router/admin_router.go | 1 + 2 files changed, 21 insertions(+) diff --git a/app/admin/hdl/enterprise_manage/hdl_self_support_for_school.go b/app/admin/hdl/enterprise_manage/hdl_self_support_for_school.go index f2de8f9..87ac8ec 100644 --- a/app/admin/hdl/enterprise_manage/hdl_self_support_for_school.go +++ b/app/admin/hdl/enterprise_manage/hdl_self_support_for_school.go @@ -587,6 +587,26 @@ func SelfSupportForSchoolClassDelete(c *gin.Context) { return } +func SelfSupportForSchoolClassDeleteCheck(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 +} + func SelfSupportForSchoolAddWorker(c *gin.Context) { var req md.SelfSupportForSchoolAddWorkerReq err := c.ShouldBindJSON(&req) diff --git a/app/router/admin_router.go b/app/router/admin_router.go index 4bb2ab9..e27d56c 100644 --- a/app/router/admin_router.go +++ b/app/router/admin_router.go @@ -211,6 +211,7 @@ func rEnterpriseManage(r *gin.RouterGroup) { r.DELETE("/selfSupportForSchool/gradeDelete/:id", hdl.SelfSupportForSchoolGradeDelete) //"自营-学校"年级删除 r.POST("/selfSupportForSchool/classList", hdl.SelfSupportForSchoolClassList) //"自营-学校"班级列表 r.DELETE("/selfSupportForSchool/classDelete/:id", hdl.SelfSupportForSchoolClassDelete) //"自营-学校"班级删除 + r.DELETE("/selfSupportForSchool/classDeleteCheck/:id", hdl.SelfSupportForSchoolClassDeleteCheck) //"自营-学校"班级删除 r.POST("/selfSupportForSchool/addStudent", hdl.SelfSupportForSchoolAddStudent) //"自营-学校"添加学生 r.POST("/selfSupportForSchool/addWorker", hdl.SelfSupportForSchoolAddWorker) //"自营-学校"添加工作人员 r.POST("/selfSupportForSchool/addTeacher", hdl.SelfSupportForSchoolAddTeacher) //"自营-学校"添加老师