From 924d4245c26934dfcb069a25a4911a6289389097 Mon Sep 17 00:00:00 2001
From: lishihai <dslsh@dscom>
Date: 星期四, 20 六月 2024 17:03:07 +0800
Subject: [PATCH] 查询属性值和对象 通过主键ID查询

---
 controllers/attribute.go |   21 +++++++++++++++++++++
 1 files changed, 21 insertions(+), 0 deletions(-)

diff --git a/controllers/attribute.go b/controllers/attribute.go
index 5f94874..926a09f 100644
--- a/controllers/attribute.go
+++ b/controllers/attribute.go
@@ -6,6 +6,7 @@
 	"github.com/gin-gonic/gin"
 	"github.com/spf13/cast"
 	"gorm.io/gorm"
+	"strconv"
 	"wms/extend/code"
 	"wms/extend/util"
 	"wms/models"
@@ -184,3 +185,23 @@
 //
 //	util.ResponseFormat(c, code.UpdateSuccess, first)
 //}
+
+// PrimaryAttribute
+// @Tags      灞炴�у�煎拰瀵硅薄
+// @Summary   鏌ヨ灞炴�у�煎拰瀵硅薄 閫氳繃涓婚敭ID鏌ヨ
+// object  body  request.OperationList true  "鏌ヨ鍙傛暟"
+// @Success   200 {object} util.Response "鎴愬姛"
+// @Router    /api-wms/v1/attribute/primary/{id}  [get]
+func (slf *AttributeValueController) PrimaryAttribute(c *gin.Context) {
+	id, _ := strconv.ParseUint(c.Param("id"), 10, 64)
+	if id == 0 {
+		util.ResponseFormat(c, code.RequestParamError, "鏃犳晥id")
+		return
+	}
+	attribute, err := models.NewAttributeSearch().SetID(uint(id)).First()
+	if err != nil {
+		util.ResponseFormat(c, code.RequestParamError, "鏌ヨ澶辫触")
+		return
+	}
+	util.ResponseFormat(c, code.Success, attribute)
+}

--
Gitblit v1.8.0