jiangshuai
2023-10-19 55bd24a2d654052d4c4c8eb6e7bee244af81d446
controllers/location.go
@@ -4,7 +4,6 @@
   "errors"
   "github.com/gin-gonic/gin"
   "strconv"
   "strings"
   "wms/extend/code"
   "wms/extend/util"
   "wms/models"
@@ -115,13 +114,24 @@
      util.ResponseFormat(c, code.RequestParamError, err)
      return
   }
   index := strings.LastIndex(params.JointName, "/")
   if index > 0 {
      jn := params.JointName[:index]
      oldName := params.JointName[index+1:]
      if oldName != params.Name {
         params.JointName = jn + "/" + params.Name
   //index := strings.LastIndex(params.JointName, "/")
   //if index > 0 {
   //   jn := params.JointName[:index]
   //   oldName := params.JointName[index+1:]
   //   if oldName != params.Name {
   //      params.JointName = jn + "/" + params.Name
   //   }
   //}
   if params.ParentId != 0 {
      //查询上级名称
      first, err := models.NewLocationSearch().SetID(params.ParentId).First()
      if err != nil {
         util.ResponseFormat(c, code.RequestParamError, "查询上级名称失败")
         return
      }
      params.JointName = first.JointName + "/" + params.Name
   } else {
      params.JointName = params.Name
   }
   err := models.NewLocationSearch().Update(&params)
   if err != nil {