zhangqian
2024-03-27 138fddee3dc30b49e78ffef63c51706f1463a021
更改返回字段
1个文件已添加
2个文件已修改
29 ■■■■ 已修改文件
controllers/order.go 20 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
outsourcing 补丁 | 查看 | 原始文档 | blame | 历史
response/outsourcing.go 9 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
controllers/order.go
@@ -11,6 +11,7 @@
    "outsourcing/pkg/logx"
    "outsourcing/pkg/structx"
    "outsourcing/request"
    "outsourcing/response"
    "outsourcing/service"
    "outsourcing/service/outsourcing"
    "outsourcing/utils/jwt"
@@ -370,7 +371,7 @@
// @Summary   物料搜索
// @Produce   application/json
// @Param     object  body    request.MaterialSearch true  "参数"
// @Success   200   {object}  util.ResponseList{[]models.OutsourcingOrderDeliveryDetails}  "成功"
// @Success   200   {object}  util.ResponseList{[]response.Material}  "成功"
// @Router    /api-outsourcing/v1/order/materialSearch [post]
func (slf *OrderController) MaterialSearch(c *gin.Context) {
    var params request.MaterialSearch
@@ -379,15 +380,28 @@
        return
    }
    client := outsourcing.NewOutsourcingServiceClient(service.ApsServiceConn)
    list, err := client.GetMaterialList(c, &outsourcing.GetMaterialListRequest{
    resp, err := client.GetMaterialList(c, &outsourcing.GetMaterialListRequest{
        Page:     int32(params.Page),
        PageSize: int32(params.PageSize),
        Keyword:  params.Keyword,
    })
    if err != nil {
        logx.Errorf("grpc outsourcing GetProductList err:%v", err)
        util.ResponseFormat(c, code.RequestParamError, "查询失败")
        return
    }
    util.ResponseFormat(c, code.Success, list)
    data := make([]*response.Material, 0, len(resp.List))
    for _, item := range resp.List {
        data = append(data, &response.Material{
            Number: item.ID,
            Name:   item.Name,
            Unit:   item.Unit,
            Specs:  item.Specs,
            Type:   item.Type,
        })
    }
    util.ResponseFormat(c, code.Success, data)
}
outsourcing
Binary files differ
response/outsourcing.go
New file
@@ -0,0 +1,9 @@
package response
type Material struct {
    Number string `json:"number"`
    Name   string `json:"name"`
    Unit   string `json:"unit"`
    Specs  string `json:"specs"`
    Type   string `json:"type"`
}