dengbiao 3 months ago
parent
commit
572f5fb37b
6 changed files with 172 additions and 0 deletions
  1. +65
    -0
      app/admin/hdl/enterprise_manage/hdl_central_kitchen_for_school.go
  2. +65
    -0
      app/admin/hdl/enterprise_manage/hdl_self_support_for_school.go
  3. +14
    -0
      app/admin/md/md_enterprise_manage.go
  4. +12
    -0
      app/admin/svc/enterprise_manage/svc_central_kitchen_for_school.go
  5. +12
    -0
      app/admin/svc/enterprise_manage/svc_self_support_for_school.go
  6. +4
    -0
      app/router/admin_router.go

+ 65
- 0
app/admin/hdl/enterprise_manage/hdl_central_kitchen_for_school.go View File

@@ -1662,6 +1662,39 @@ func CentralKitchenForSchoolOrdDetail(c *gin.Context) {
return
}

func CentralKitchenForSchoolPeriodList(c *gin.Context) {
var req md.CentralKitchenForSchoolPeriodListReq
err := c.ShouldBindJSON(&req)
if err != nil {
err = validate.HandleValidateErr(err)
err1 := err.(e.E)
e.OutErr(c, err1.Code, err1.Error())
return
}
enterpriseDb := db.EnterpriseDb{}
enterpriseDb.Set()
enterprise, err := enterpriseDb.GetEnterprise(req.EnterpriseId)
if err != nil {
e.OutErr(c, e.ERR_DB_ORM, err.Error())
return
}
if enterprise == nil {
e.OutErr(c, e.ERR_NO_DATA, "未查询到对应记录")
return
}

resp, total, err := svc2.CentralKitchenForSchoolPeriodList(req)
if err != nil {
e.OutErr(c, e.ERR, err.Error())
return
}
e.OutSuc(c, map[string]interface{}{
"list": resp,
"total": total,
}, nil)
return
}

func CentralKitchenForSchoolGradeList(c *gin.Context) {
var req md.CentralKitchenForSchoolGradeListReq
err := c.ShouldBindJSON(&req)
@@ -1760,6 +1793,38 @@ func CentralKitchenForSchoolGradeDelete(c *gin.Context) {
return
}

func CentralKitchenForSchoolPeriodDelete(c *gin.Context) {
periodId := c.Param("id")
//1、查找当前学段
periodDb := db.PeriodDb{}
periodDb.Set(0)
period, err := periodDb.GetPeriod(utils.StrToInt(periodId))
if err != nil {
e.OutErr(c, e.ERR_DB_ORM, err.Error())
return
}

//2、查找当前年级下是否还包含年级
gradeDb := db.GradeDb{}
gradeDb.Set(0)
grade, err := gradeDb.FindGradeByPeriodId(utils.StrToInt(periodId))
if err != nil {
e.OutErr(c, e.ERR_DB_ORM, err.Error())
return
}
if len(*grade) > 0 {
e.OutErr(c, e.ERR, "当前学段下存在未删除的年级!")
return
}
_, err = periodDb.PeriodDeleteBySession(period.Id)
if err != nil {
e.OutErr(c, e.ERR_DB_ORM, err.Error())
return
}
e.OutSuc(c, "success", nil)
return
}

func CentralKitchenForSchoolClassDelete(c *gin.Context) {
classId := c.Param("id")
classWithUserDb := db.ClassWithUserDb{}


+ 65
- 0
app/admin/hdl/enterprise_manage/hdl_self_support_for_school.go View File

@@ -525,6 +525,71 @@ func SelfSupportForSchoolGradeList(c *gin.Context) {
return
}

func SelfSupportForSchoolPeriodList(c *gin.Context) {
var req md.SelfSupportForSchoolPeriodListReq
err := c.ShouldBindJSON(&req)
if err != nil {
err = validate.HandleValidateErr(err)
err1 := err.(e.E)
e.OutErr(c, err1.Code, err1.Error())
return
}
enterpriseDb := db.EnterpriseDb{}
enterpriseDb.Set()
enterprise, err := enterpriseDb.GetEnterprise(req.EnterpriseId)
if err != nil {
e.OutErr(c, e.ERR_DB_ORM, err.Error())
return
}
if enterprise == nil {
e.OutErr(c, e.ERR_NO_DATA, "未查询到对应记录")
return
}

resp, total, err := svc2.SelfSupportForSchoolPeriodList(req)
if err != nil {
e.OutErr(c, e.ERR, err.Error())
return
}
e.OutSuc(c, map[string]interface{}{
"list": resp,
"total": total,
}, nil)
return
}

func SelfSupportForSchoolPeriodDelete(c *gin.Context) {
periodId := c.Param("id")
//1、查找当前学段
periodDb := db.PeriodDb{}
periodDb.Set(0)
period, err := periodDb.GetPeriod(utils.StrToInt(periodId))
if err != nil {
e.OutErr(c, e.ERR_DB_ORM, err.Error())
return
}

//2、查找当前年级下是否还包含年级
gradeDb := db.GradeDb{}
gradeDb.Set(0)
grade, err := gradeDb.FindGradeByPeriodId(utils.StrToInt(periodId))
if err != nil {
e.OutErr(c, e.ERR_DB_ORM, err.Error())
return
}
if len(*grade) > 0 {
e.OutErr(c, e.ERR, "当前学段下存在未删除的年级!")
return
}
_, err = periodDb.PeriodDeleteBySession(period.Id)
if err != nil {
e.OutErr(c, e.ERR_DB_ORM, err.Error())
return
}
e.OutSuc(c, "success", nil)
return
}

func SelfSupportForSchoolClassList(c *gin.Context) {
var req md.SelfSupportForSchoolClassListReq
err := c.ShouldBindJSON(&req)


+ 14
- 0
app/admin/md/md_enterprise_manage.go View File

@@ -494,6 +494,13 @@ type CentralKitchenForSchoolGradeListReq struct {
Name string `json:"name" label:"名称"`
}

type CentralKitchenForSchoolPeriodListReq struct {
EnterpriseId int `json:"enterprise_id" binding:"required" label:"企业id"`
Limit int `json:"limit" binding:"required"`
Page int `json:"page" binding:"required"`
Name string `json:"name" label:"名称"`
}

type CentralKitchenForSchoolClassListReq struct {
EnterpriseId int `json:"enterprise_id" binding:"required" label:"企业id"`
GradeId int `json:"grade_id" label:"年级id"`
@@ -509,6 +516,13 @@ type SelfSupportForSchoolGradeListReq struct {
Name string `json:"name" label:"名称"`
}

type SelfSupportForSchoolPeriodListReq struct {
EnterpriseId int `json:"enterprise_id" binding:"required" label:"企业id"`
Limit int `json:"limit" binding:"required"`
Page int `json:"page" binding:"required"`
Name string `json:"name" label:"名称"`
}

type SelfSupportForSchoolClassListReq struct {
EnterpriseId int `json:"enterprise_id" binding:"required" label:"企业id"`
GradeId int `json:"grade_id" label:"年级id"`


+ 12
- 0
app/admin/svc/enterprise_manage/svc_central_kitchen_for_school.go View File

@@ -2551,6 +2551,18 @@ func CentralKitchenForSchoolGradeList(req md.CentralKitchenForSchoolGradeListReq
return
}

func CentralKitchenForSchoolPeriodList(req md.CentralKitchenForSchoolPeriodListReq) (m []*model.Period, count int64, err error) {
sess := db.Db.Where("enterprise_id =?", req.EnterpriseId)
if req.Name != "" {
sess.And("name like ?", "%"+req.Name+"%")
}
count, err = sess.Asc("id").Limit(req.Limit, (req.Page-1)*req.Limit).FindAndCount(&m)
if err != nil {
return nil, 0, err
}
return
}

func CentralKitchenForSchoolClassList(req md.CentralKitchenForSchoolClassListReq) (m []*model.Class, count int64, err error) {
sess := db.Db.Where("enterprise_id =?", req.EnterpriseId)
if req.Name != "" {


+ 12
- 0
app/admin/svc/enterprise_manage/svc_self_support_for_school.go View File

@@ -567,6 +567,18 @@ func SelfSupportForSchoolGradeList(req md.SelfSupportForSchoolGradeListReq) (m [
return
}

func SelfSupportForSchoolPeriodList(req md.SelfSupportForSchoolPeriodListReq) (m []*model.Period, count int64, err error) {
sess := db.Db.Where("enterprise_id =?", req.EnterpriseId)
if req.Name != "" {
sess.And("name like ?", "%"+req.Name+"%")
}
count, err = sess.Asc("id").Limit(req.Limit, (req.Page-1)*req.Limit).FindAndCount(&m)
if err != nil {
return nil, 0, err
}
return
}

func SelfSupportForSchoolClassList(req md.SelfSupportForSchoolClassListReq) (m []*model.Class, count int64, err error) {
sess := db.Db.Where("enterprise_id =?", req.EnterpriseId)
if req.Name != "" {


+ 4
- 0
app/router/admin_router.go View File

@@ -192,6 +192,8 @@ func rEnterpriseManage(r *gin.RouterGroup) {
r.POST("/centralKitchenForSchool/teacherDelete", hdl.CentralKitchenForSchoolTeacherDelete) //"央厨-学校"教师删除
r.POST("/centralKitchenForSchool/gradeList", hdl.CentralKitchenForSchoolGradeList) //"央厨-学校"年级列表
r.DELETE("/centralKitchenForSchool/gradeDelete/:id", hdl.CentralKitchenForSchoolGradeDelete) //"央厨-学校"年级删除
r.POST("/centralKitchenForSchool/periodList", hdl.CentralKitchenForSchoolPeriodList) //"央厨-学校"学段列表
r.DELETE("/centralKitchenForSchool/periodDelete/:id", hdl.CentralKitchenForSchoolPeriodDelete) //"央厨-学校"学段删除
r.POST("/centralKitchenForSchool/classList", hdl.CentralKitchenForSchoolClassList) //"央厨-学校"班级列表
r.DELETE("/centralKitchenForSchool/classDelete/:id", hdl.CentralKitchenForSchoolClassDelete) //"央厨-学校"班级删除
r.GET("/centralKitchenForSchool/classDeleteCheck/:id", hdl.CentralKitchenForSchoolClassDeleteCheck) //"央厨-学校"检测班级删除
@@ -235,6 +237,8 @@ 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.POST("/selfSupportForSchool/periodList", hdl.SelfSupportForSchoolPeriodList) //"央厨-学校"学段列表
r.DELETE("/selfSupportForSchool/periodDelete/:id", hdl.SelfSupportForSchoolPeriodDelete) //"央厨-学校"学段删除
r.GET("/selfSupportForSchool/classDeleteCheck/:id", hdl.SelfSupportForSchoolClassDeleteCheck) //"自营-学校"班级删除
r.POST("/selfSupportForSchool/addStudent", hdl.SelfSupportForSchoolAddStudent) //"自营-学校"添加学生
r.POST("/selfSupportForSchool/addWorker", hdl.SelfSupportForSchoolAddWorker) //"自营-学校"添加工作人员


Loading…
Cancel
Save