From a98b2ed2ddcf15db5b20907cd502e157d04d1b88 Mon Sep 17 00:00:00 2001
From: zhangqian <zhangqian@123.com>
Date: 星期五, 20 十月 2023 10:22:06 +0800
Subject: [PATCH] 去掉无用配置
---
controllers/location.go | 26 ++++++++++++++++++--------
1 files changed, 18 insertions(+), 8 deletions(-)
diff --git a/controllers/location.go b/controllers/location.go
index 2d7946f..e545fb9 100644
--- a/controllers/location.go
+++ b/controllers/location.go
@@ -4,7 +4,6 @@
"errors"
"github.com/gin-gonic/gin"
"strconv"
- "strings"
"wms/extend/code"
"wms/extend/util"
"wms/models"
@@ -33,7 +32,7 @@
}
if params.ParentId != 0 {
//鏌ヨ涓婄骇鍚嶇О
- first, err := models.NewLocationSearch().SetParentId(params.ParentId).First()
+ first, err := models.NewLocationSearch().SetID(params.ParentId).First()
if err != nil {
util.ResponseFormat(c, code.RequestParamError, "鏌ヨ涓婄骇鍚嶇О澶辫触")
return
@@ -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(¶ms)
if err != nil {
--
Gitblit v1.8.0