yinbentan
2024-07-08 f4508a84236a4aff1c7b5bfa17a14a8ff95728ba
controllers/attribute.go
@@ -24,7 +24,7 @@
// @Param     Authorization   header string true "token"
// @Success   200 {object} util.Response "成功"
// @Router    /api-wms/v1/attribute/attribute [post]
func (slf *AttributeController) Add(c *gin.Context) {
func (slf AttributeController) Add(c *gin.Context) {
   var reqParams request.AddAttribute
   var params models.Attribute
   if err := c.BindJSON(&reqParams); err != nil {
@@ -142,21 +142,20 @@
   util.ResponseFormat(c, code.UpdateSuccess, "删除成功")
}
// List
// @Tags      属性
// @Summary   查询属性列表
// ListAttribute
// @Tags      属性值和对象
// @Summary   添加属性值和对象
// @Produce   application/json
// @Param     object  query    request.GetAttributeList true  "查询参数"
// @Param     Authorization   header string true "token"
// @Success   200   {object}  util.ResponseList{data=[]models.Attribute}  "成功"
// @Param     object  body  request.AttributeList true  "属性值和对象信息"
// @Success   200 {object} util.Response "成功"
// @Router    /api-wms/v1/attribute/attribute [get]
func (slf AttributeController) List(c *gin.Context) {
   var params request.GetAttributeList
   if err := c.ShouldBindQuery(&params); err != nil {
func (slf AttributeController) ListAttribute(c *gin.Context) {
   var params request.AttributeList
   if err := c.ShouldBind(&params); err != nil {
      util.ResponseFormat(c, code.RequestParamError, err.Error())
      return
   }
   list, count, err := models.NewAttributeSearch().SetPage(params.Page, params.PageSize).SetOrder("id desc").Find()
   list, count, err := models.NewAttributeSearch().SetEntityType(params.EntityType).SetPage(params.Page, params.PageSize).SetOrder("id desc").Find()
   if err != nil {
      util.ResponseFormat(c, code.RequestParamError, "查询失败")
      return
@@ -192,7 +191,7 @@
// 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) {
func (slf AttributeController) PrimaryAttribute(c *gin.Context) {
   id, _ := strconv.ParseUint(c.Param("id"), 10, 64)
   if id == 0 {
      util.ResponseFormat(c, code.RequestParamError, "无效id")