liujiandao
2023-09-26 38e6fc986e19d4d215b00ee4db32929617810bca
产品列表新增字段
6个文件已修改
24 ■■■■ 已修改文件
controllers/product_controller.go 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
docs/docs.go 5 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
docs/swagger.json 3 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
docs/swagger.yaml 2 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
models/material.go 9 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
request/product_request.go 3 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
controllers/product_controller.go
@@ -76,7 +76,7 @@
    if params.PageInfo.Check() {
        search.SetPage(params.Page, params.PageSize)
    }
    products, total, err := search.SetKeyword(params.KeyWord).SetOrder("created_at desc").Find()
    products, total, err := search.SetKeyword(params.KeyWord).SetCategoryId(params.CategoryId).SetOrder("created_at desc").Find()
    if err != nil {
        util.ResponseFormat(c, code.RequestParamError, "查找失败")
        return
docs/docs.go
@@ -2650,6 +2650,9 @@
        "request.GetProductList": {
            "type": "object",
            "properties": {
                "categoryId": {
                    "type": "integer"
                },
                "keyWord": {
                    "type": "string"
                },
@@ -3025,6 +3028,8 @@
    Description:      "",
    InfoInstanceName: "swagger",
    SwaggerTemplate:  docTemplate,
    LeftDelim:        "{{",
    RightDelim:       "}}",
}
func init() {
docs/swagger.json
@@ -2638,6 +2638,9 @@
        "request.GetProductList": {
            "type": "object",
            "properties": {
                "categoryId": {
                    "type": "integer"
                },
                "keyWord": {
                    "type": "string"
                },
docs/swagger.yaml
@@ -835,6 +835,8 @@
    type: object
  request.GetProductList:
    properties:
      categoryId:
        type: integer
      keyWord:
        type: string
      page:
models/material.go
@@ -152,6 +152,10 @@
    slf.TemplateID = id
    return slf
}
func (slf *MaterialSearch) SetCategoryId(id int) *MaterialSearch {
    slf.CategoryId = id
    return slf
}
//
//func (slf *MaterialSearch) SetSetTemplateType(setType constvar.SetTemplateType) *MaterialSearch {
@@ -207,7 +211,7 @@
    //}
    if slf.Keyword != "" {
        db = db.Where("name LIKE ? or id LIKE ? ", "%"+slf.Keyword+"%", "%"+slf.Keyword+"%")
        db = db.Where("name LIKE ? ", "%"+slf.Keyword+"%")
    }
    if slf.Order != "" {
@@ -223,6 +227,9 @@
    if slf.IsSale {
        db = db.Where("is_sale = ?", 1)
    }
    if slf.CategoryId > 0 {
        db = db.Where("category_id = ?", slf.CategoryId)
    }
    return db
}
request/product_request.go
@@ -7,7 +7,8 @@
type GetProductList struct {
    PageInfo
    KeyWord string `json:"keyWord"`
    KeyWord    string `json:"keyWord"`
    CategoryId int    `json:"categoryId"`
}
type QueryOperationList struct {