| | |
| | | "github.com/gin-gonic/gin" |
| | | "github.com/spf13/cast" |
| | | "gorm.io/gorm" |
| | | "strconv" |
| | | "wms/extend/code" |
| | | "wms/extend/util" |
| | | "wms/models" |
| | |
| | | // |
| | | // 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) |
| | | } |
| | |
| | | PageNum int |
| | | PageSize int |
| | | Orm *gorm.DB |
| | | Keyword string |
| | | } |
| | | ) |
| | | |
| | |
| | | if slf.Name != "" { |
| | | db = db.Where("name = ?", slf.Name) |
| | | } |
| | | if slf.Keyword != "" { |
| | | db = db.Where("id like ? or data_type like ? or entity_type like ?", fmt.Sprintf("%%%v%%", slf.Keyword), fmt.Sprintf("%%%v%%", slf.Keyword), fmt.Sprintf("%%%v%%", slf.Keyword)) |
| | | } |
| | | |
| | | return db |
| | | } |