From 6cce6de2161840f77d397fe25bee6096d0eb9877 Mon Sep 17 00:00:00 2001
From: zhangqian <zhangqian@123.com>
Date: 星期五, 22 三月 2024 19:37:21 +0800
Subject: [PATCH] 物料搜索接口
---
request/outsourcing.go | 5
service/outsourcing/outsourcing.proto | 29 ++
service/grpc.go | 25 ++
service/outsourcing/outsourcing.pb.go | 361 ++++++++++++++++++++++++++++++
docs/swagger.yaml | 31 ++
docs/docs.go | 47 +++
conf/config.yaml | 2
docs/swagger.json | 47 +++
router/router.go | 1
conf/config.go | 9
main.go | 11
controllers/order.go | 30 ++
service/outsourcing/outsourcing_grpc.pb.go | 109 +++++++++
13 files changed, 699 insertions(+), 8 deletions(-)
diff --git a/conf/config.go b/conf/config.go
index 52e7f72..a8f58ac 100644
--- a/conf/config.go
+++ b/conf/config.go
@@ -41,6 +41,10 @@
localConf struct {
StorePath string // 鏈湴鏂囦欢瀛樺偍璺緞
}
+
+ serviceConf struct {
+ Aps string // 鏈湴鏂囦欢瀛樺偍璺緞
+ }
)
var (
@@ -49,9 +53,9 @@
DbConf = &mysqlx.Conf{}
NsqConf = &nsqConf{}
LocalConf = &localConf{}
- NodeId string
GrpcPort string
Viper *viper.Viper
+ Service = &serviceConf{}
)
func Init() error {
@@ -107,8 +111,8 @@
_ = v.UnmarshalKey("web", WebConf)
_ = v.UnmarshalKey("log", LogConf)
_ = v.UnmarshalKey("db", DbConf)
- _ = v.UnmarshalKey("nsq", NsqConf)
_ = v.UnmarshalKey("local", LocalConf)
+ _ = v.UnmarshalKey("service", Service)
showConfig()
}
@@ -120,5 +124,6 @@
log.Printf(" NsqConf: %+v", NsqConf)
log.Printf(" GrpcPort: %+v", GrpcPort)
log.Printf(" LocalConf: %+v", LocalConf)
+ log.Printf(" ServiceConf: %+v", Service)
log.Println("......................................................")
}
diff --git a/conf/config.yaml b/conf/config.yaml
index 50fb03c..2e0d467 100644
--- a/conf/config.yaml
+++ b/conf/config.yaml
@@ -1,6 +1,8 @@
web:
port: 8008
host: 192.168.20.119
+service:
+ aps: 192.168.20.120:9091
db:
dsn: root:c++java123@tcp(192.168.20.119:3306)/aps_server2?charset=utf8&parseTime=True&loc=Local
logMode: true
diff --git a/controllers/order.go b/controllers/order.go
index 7666d09..f627704 100644
--- a/controllers/order.go
+++ b/controllers/order.go
@@ -8,8 +8,11 @@
"outsourcing/extend/code"
"outsourcing/extend/util"
"outsourcing/models"
+ "outsourcing/pkg/logx"
"outsourcing/pkg/structx"
"outsourcing/request"
+ "outsourcing/service"
+ "outsourcing/service/outsourcing"
)
type OrderController struct{}
@@ -293,3 +296,30 @@
}
util.ResponseFormat(c, code.Success, list)
}
+
+// MaterialSearch
+// @Tags 璁㈠崟绠$悊
+// @Summary 鐗╂枡鎼滅储
+// @Produce application/json
+// @Param object body request.MaterialSearch true "鍙傛暟"
+// @Success 200 {object} util.ResponseList{[]models.OutsourcingOrderDeliveryDetails} "鎴愬姛"
+// @Router /api-outsourcing/v1/order/materialSearch [post]
+func (slf *OrderController) MaterialSearch(c *gin.Context) {
+ var params request.MaterialSearch
+ if err := c.BindJSON(¶ms); err != nil {
+ util.ResponseFormat(c, code.RequestParamError, "鍙傛暟瑙f瀽澶辫触锛屾暟鎹被鍨嬮敊璇�")
+ return
+ }
+ client := outsourcing.NewOutsourcingServiceClient(service.ApsServiceConn)
+ list, 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)
+}
diff --git a/docs/docs.go b/docs/docs.go
index 6514254..3d9b0f8 100644
--- a/docs/docs.go
+++ b/docs/docs.go
@@ -186,6 +186,36 @@
}
}
},
+ "/api-outsourcing/v1/order/materialSearch": {
+ "post": {
+ "produces": [
+ "application/json"
+ ],
+ "tags": [
+ "璁㈠崟绠$悊"
+ ],
+ "summary": "鐗╂枡鎼滅储",
+ "parameters": [
+ {
+ "description": "鍙傛暟",
+ "name": "object",
+ "in": "body",
+ "required": true,
+ "schema": {
+ "$ref": "#/definitions/request.MaterialSearch"
+ }
+ }
+ ],
+ "responses": {
+ "200": {
+ "description": "鎴愬姛",
+ "schema": {
+ "$ref": "#/definitions/util.ResponseList"
+ }
+ }
+ }
+ }
+ },
"/api-outsourcing/v1/order/overview": {
"get": {
"produces": [
@@ -541,6 +571,23 @@
}
}
},
+ "request.MaterialSearch": {
+ "type": "object",
+ "properties": {
+ "keyword": {
+ "description": "鍏抽敭瀛�",
+ "type": "string"
+ },
+ "page": {
+ "description": "椤电爜",
+ "type": "integer"
+ },
+ "pageSize": {
+ "description": "姣忛〉澶у皬",
+ "type": "integer"
+ }
+ }
+ },
"request.OutsourcingOrderOverview": {
"type": "object",
"properties": {
diff --git a/docs/swagger.json b/docs/swagger.json
index 92367ad..74d2909 100644
--- a/docs/swagger.json
+++ b/docs/swagger.json
@@ -174,6 +174,36 @@
}
}
},
+ "/api-outsourcing/v1/order/materialSearch": {
+ "post": {
+ "produces": [
+ "application/json"
+ ],
+ "tags": [
+ "璁㈠崟绠$悊"
+ ],
+ "summary": "鐗╂枡鎼滅储",
+ "parameters": [
+ {
+ "description": "鍙傛暟",
+ "name": "object",
+ "in": "body",
+ "required": true,
+ "schema": {
+ "$ref": "#/definitions/request.MaterialSearch"
+ }
+ }
+ ],
+ "responses": {
+ "200": {
+ "description": "鎴愬姛",
+ "schema": {
+ "$ref": "#/definitions/util.ResponseList"
+ }
+ }
+ }
+ }
+ },
"/api-outsourcing/v1/order/overview": {
"get": {
"produces": [
@@ -529,6 +559,23 @@
}
}
},
+ "request.MaterialSearch": {
+ "type": "object",
+ "properties": {
+ "keyword": {
+ "description": "鍏抽敭瀛�",
+ "type": "string"
+ },
+ "page": {
+ "description": "椤电爜",
+ "type": "integer"
+ },
+ "pageSize": {
+ "description": "姣忛〉澶у皬",
+ "type": "integer"
+ }
+ }
+ },
"request.OutsourcingOrderOverview": {
"type": "object",
"properties": {
diff --git a/docs/swagger.yaml b/docs/swagger.yaml
index 5b11f0f..e6e7af0 100644
--- a/docs/swagger.yaml
+++ b/docs/swagger.yaml
@@ -142,6 +142,18 @@
unit:
type: string
type: object
+ request.MaterialSearch:
+ properties:
+ keyword:
+ description: 鍏抽敭瀛�
+ type: string
+ page:
+ description: 椤电爜
+ type: integer
+ pageSize:
+ description: 姣忛〉澶у皬
+ type: integer
+ type: object
request.OutsourcingOrderOverview:
properties:
hasAssigned:
@@ -310,6 +322,25 @@
summary: 濮斿璁㈠崟鍒楄〃
tags:
- 璁㈠崟绠$悊
+ /api-outsourcing/v1/order/materialSearch:
+ post:
+ parameters:
+ - description: 鍙傛暟
+ in: body
+ name: object
+ required: true
+ schema:
+ $ref: '#/definitions/request.MaterialSearch'
+ produces:
+ - application/json
+ responses:
+ "200":
+ description: 鎴愬姛
+ schema:
+ $ref: '#/definitions/util.ResponseList'
+ summary: 鐗╂枡鎼滅储
+ tags:
+ - 璁㈠崟绠$悊
/api-outsourcing/v1/order/overview:
get:
produces:
diff --git a/main.go b/main.go
index 4227511..96befda 100644
--- a/main.go
+++ b/main.go
@@ -6,10 +6,10 @@
"os"
"os/signal"
"outsourcing/conf"
- "outsourcing/constvar"
"outsourcing/models"
"outsourcing/pkg/logx"
"outsourcing/router"
+ "outsourcing/service"
"syscall"
"time"
)
@@ -38,18 +38,14 @@
ReadTimeout: 5 * time.Second,
WriteTimeout: 5 * time.Second,
}
+ go service.InitApsServiceConn()
go shutdown(server)
-
logx.Error(server.ListenAndServe().Error())
}
func shutdown(server *http.Server) {
quit := make(chan os.Signal, 1)
signal.Notify(quit, syscall.SIGKILL, syscall.SIGQUIT, syscall.SIGINT, syscall.SIGTERM)
<-quit
-
- if constvar.GrpcClient != nil {
- _ = constvar.GrpcClient.Close()
- }
// 鍒涘缓涓�涓笂涓嬫枃锛岃缃秴鏃舵椂闂�
ctx, cancel := context.WithTimeout(context.Background(), 10*time.Second)
defer cancel()
@@ -58,5 +54,8 @@
logx.Warnf("鏈嶅姟浼橀泤閫�鍑哄け璐�: %v", err)
return
}
+
+ service.CloseApsServiceConn()
+
logx.Infof("server exited success")
}
diff --git a/request/outsourcing.go b/request/outsourcing.go
index a17dc82..78926b0 100644
--- a/request/outsourcing.go
+++ b/request/outsourcing.go
@@ -79,3 +79,8 @@
OutsourcingOrderProductID uint `json:"outsourcingOrderProductID" gorm:"comment:濮斿璁㈠崟浜у搧琛↖D"` //濮斿璁㈠崟浜у搧琛↖D
SendAmount decimal.Decimal `gorm:"type:decimal(18,2);comment:鏁伴噺" json:"sendAmount"` //鍙戣揣鏁伴噺
}
+
+type MaterialSearch struct {
+ PageInfo
+ Keyword string `json:"keyword"` //鍏抽敭瀛�
+}
diff --git a/router/router.go b/router/router.go
index ed4d650..a9e935e 100644
--- a/router/router.go
+++ b/router/router.go
@@ -33,6 +33,7 @@
outsourcingGroup.GET("deliveryPrepare", outsourcingApi.DeliveryPrepare) //鍙戣揣鍑嗗淇℃伅
outsourcingGroup.POST("deliveryList", outsourcingApi.GetDeliveryList) // 鍙戣揣鍘嗗彶
outsourcingGroup.POST("saveDelivery", outsourcingApi.SaveDelivery) // 淇濆瓨鍙戣揣淇℃伅
+ outsourcingGroup.POST("materialSearch", outsourcingApi.MaterialSearch) // 鐗╂枡鎼滅储
}
diff --git a/service/grpc.go b/service/grpc.go
new file mode 100644
index 0000000..541fe91
--- /dev/null
+++ b/service/grpc.go
@@ -0,0 +1,25 @@
+package service
+
+import (
+ "google.golang.org/grpc"
+ "google.golang.org/grpc/credentials/insecure"
+ "outsourcing/conf"
+ "outsourcing/pkg/logx"
+)
+
+var ApsServiceConn *grpc.ClientConn
+
+func InitApsServiceConn() {
+ var err error
+ ApsServiceConn, err = grpc.Dial(conf.Service.Aps, grpc.WithTransportCredentials(insecure.NewCredentials()))
+ if err != nil {
+ logx.Errorf("grpc dial product service error: %v", err.Error())
+ return
+ }
+}
+
+func CloseApsServiceConn() {
+ if ApsServiceConn != nil {
+ ApsServiceConn.Close()
+ }
+}
diff --git a/service/outsourcing/outsourcing.pb.go b/service/outsourcing/outsourcing.pb.go
new file mode 100644
index 0000000..6f6b466
--- /dev/null
+++ b/service/outsourcing/outsourcing.pb.go
@@ -0,0 +1,361 @@
+// Code generated by protoc-gen-go. DO NOT EDIT.
+// versions:
+// protoc-gen-go v1.31.0
+// protoc v3.19.0
+// source: outsourcing.proto
+
+package outsourcing
+
+import (
+ protoreflect "google.golang.org/protobuf/reflect/protoreflect"
+ protoimpl "google.golang.org/protobuf/runtime/protoimpl"
+ reflect "reflect"
+ sync "sync"
+)
+
+const (
+ // Verify that this generated code is sufficiently up-to-date.
+ _ = protoimpl.EnforceVersion(20 - protoimpl.MinVersion)
+ // Verify that runtime/protoimpl is sufficiently up-to-date.
+ _ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20)
+)
+
+type Material struct {
+ state protoimpl.MessageState
+ sizeCache protoimpl.SizeCache
+ unknownFields protoimpl.UnknownFields
+
+ ID string `protobuf:"bytes,1,opt,name=ID,proto3" json:"ID,omitempty"` //缂栧彿
+ Name string `protobuf:"bytes,2,opt,name=Name,proto3" json:"Name,omitempty"` //鍚嶇О
+ Unit string `protobuf:"bytes,3,opt,name=Unit,proto3" json:"Unit,omitempty"` //鍗曚綅
+ Specs string `protobuf:"bytes,4,opt,name=Specs,proto3" json:"Specs,omitempty"` // 瑙勬牸
+ Type string `protobuf:"bytes,5,opt,name=Type,proto3" json:"Type,omitempty"` // 鍨嬪彿
+}
+
+func (x *Material) Reset() {
+ *x = Material{}
+ if protoimpl.UnsafeEnabled {
+ mi := &file_outsourcing_proto_msgTypes[0]
+ ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
+ ms.StoreMessageInfo(mi)
+ }
+}
+
+func (x *Material) String() string {
+ return protoimpl.X.MessageStringOf(x)
+}
+
+func (*Material) ProtoMessage() {}
+
+func (x *Material) ProtoReflect() protoreflect.Message {
+ mi := &file_outsourcing_proto_msgTypes[0]
+ if protoimpl.UnsafeEnabled && x != nil {
+ ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
+ if ms.LoadMessageInfo() == nil {
+ ms.StoreMessageInfo(mi)
+ }
+ return ms
+ }
+ return mi.MessageOf(x)
+}
+
+// Deprecated: Use Material.ProtoReflect.Descriptor instead.
+func (*Material) Descriptor() ([]byte, []int) {
+ return file_outsourcing_proto_rawDescGZIP(), []int{0}
+}
+
+func (x *Material) GetID() string {
+ if x != nil {
+ return x.ID
+ }
+ return ""
+}
+
+func (x *Material) GetName() string {
+ if x != nil {
+ return x.Name
+ }
+ return ""
+}
+
+func (x *Material) GetUnit() string {
+ if x != nil {
+ return x.Unit
+ }
+ return ""
+}
+
+func (x *Material) GetSpecs() string {
+ if x != nil {
+ return x.Specs
+ }
+ return ""
+}
+
+func (x *Material) GetType() string {
+ if x != nil {
+ return x.Type
+ }
+ return ""
+}
+
+type GetMaterialListRequest struct {
+ state protoimpl.MessageState
+ sizeCache protoimpl.SizeCache
+ unknownFields protoimpl.UnknownFields
+
+ Page int32 `protobuf:"varint,1,opt,name=page,proto3" json:"page,omitempty"`
+ PageSize int32 `protobuf:"varint,2,opt,name=pageSize,proto3" json:"pageSize,omitempty"`
+ Keyword string `protobuf:"bytes,3,opt,name=Keyword,proto3" json:"Keyword,omitempty"`
+}
+
+func (x *GetMaterialListRequest) Reset() {
+ *x = GetMaterialListRequest{}
+ if protoimpl.UnsafeEnabled {
+ mi := &file_outsourcing_proto_msgTypes[1]
+ ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
+ ms.StoreMessageInfo(mi)
+ }
+}
+
+func (x *GetMaterialListRequest) String() string {
+ return protoimpl.X.MessageStringOf(x)
+}
+
+func (*GetMaterialListRequest) ProtoMessage() {}
+
+func (x *GetMaterialListRequest) ProtoReflect() protoreflect.Message {
+ mi := &file_outsourcing_proto_msgTypes[1]
+ if protoimpl.UnsafeEnabled && x != nil {
+ ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
+ if ms.LoadMessageInfo() == nil {
+ ms.StoreMessageInfo(mi)
+ }
+ return ms
+ }
+ return mi.MessageOf(x)
+}
+
+// Deprecated: Use GetMaterialListRequest.ProtoReflect.Descriptor instead.
+func (*GetMaterialListRequest) Descriptor() ([]byte, []int) {
+ return file_outsourcing_proto_rawDescGZIP(), []int{1}
+}
+
+func (x *GetMaterialListRequest) GetPage() int32 {
+ if x != nil {
+ return x.Page
+ }
+ return 0
+}
+
+func (x *GetMaterialListRequest) GetPageSize() int32 {
+ if x != nil {
+ return x.PageSize
+ }
+ return 0
+}
+
+func (x *GetMaterialListRequest) GetKeyword() string {
+ if x != nil {
+ return x.Keyword
+ }
+ return ""
+}
+
+type GetMaterialListResponse struct {
+ state protoimpl.MessageState
+ sizeCache protoimpl.SizeCache
+ unknownFields protoimpl.UnknownFields
+
+ Code int32 `protobuf:"varint,1,opt,name=Code,proto3" json:"Code,omitempty"`
+ Msg string `protobuf:"bytes,2,opt,name=Msg,proto3" json:"Msg,omitempty"`
+ List []*Material `protobuf:"bytes,3,rep,name=List,proto3" json:"List,omitempty"`
+ Total int64 `protobuf:"varint,4,opt,name=Total,proto3" json:"Total,omitempty"`
+}
+
+func (x *GetMaterialListResponse) Reset() {
+ *x = GetMaterialListResponse{}
+ if protoimpl.UnsafeEnabled {
+ mi := &file_outsourcing_proto_msgTypes[2]
+ ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
+ ms.StoreMessageInfo(mi)
+ }
+}
+
+func (x *GetMaterialListResponse) String() string {
+ return protoimpl.X.MessageStringOf(x)
+}
+
+func (*GetMaterialListResponse) ProtoMessage() {}
+
+func (x *GetMaterialListResponse) ProtoReflect() protoreflect.Message {
+ mi := &file_outsourcing_proto_msgTypes[2]
+ if protoimpl.UnsafeEnabled && x != nil {
+ ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
+ if ms.LoadMessageInfo() == nil {
+ ms.StoreMessageInfo(mi)
+ }
+ return ms
+ }
+ return mi.MessageOf(x)
+}
+
+// Deprecated: Use GetMaterialListResponse.ProtoReflect.Descriptor instead.
+func (*GetMaterialListResponse) Descriptor() ([]byte, []int) {
+ return file_outsourcing_proto_rawDescGZIP(), []int{2}
+}
+
+func (x *GetMaterialListResponse) GetCode() int32 {
+ if x != nil {
+ return x.Code
+ }
+ return 0
+}
+
+func (x *GetMaterialListResponse) GetMsg() string {
+ if x != nil {
+ return x.Msg
+ }
+ return ""
+}
+
+func (x *GetMaterialListResponse) GetList() []*Material {
+ if x != nil {
+ return x.List
+ }
+ return nil
+}
+
+func (x *GetMaterialListResponse) GetTotal() int64 {
+ if x != nil {
+ return x.Total
+ }
+ return 0
+}
+
+var File_outsourcing_proto protoreflect.FileDescriptor
+
+var file_outsourcing_proto_rawDesc = []byte{
+ 0x0a, 0x11, 0x6f, 0x75, 0x74, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x69, 0x6e, 0x67, 0x2e, 0x70, 0x72,
+ 0x6f, 0x74, 0x6f, 0x22, 0x6c, 0x0a, 0x08, 0x4d, 0x61, 0x74, 0x65, 0x72, 0x69, 0x61, 0x6c, 0x12,
+ 0x0e, 0x0a, 0x02, 0x49, 0x44, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x02, 0x49, 0x44, 0x12,
+ 0x12, 0x0a, 0x04, 0x4e, 0x61, 0x6d, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x4e,
+ 0x61, 0x6d, 0x65, 0x12, 0x12, 0x0a, 0x04, 0x55, 0x6e, 0x69, 0x74, 0x18, 0x03, 0x20, 0x01, 0x28,
+ 0x09, 0x52, 0x04, 0x55, 0x6e, 0x69, 0x74, 0x12, 0x14, 0x0a, 0x05, 0x53, 0x70, 0x65, 0x63, 0x73,
+ 0x18, 0x04, 0x20, 0x01, 0x28, 0x09, 0x52, 0x05, 0x53, 0x70, 0x65, 0x63, 0x73, 0x12, 0x12, 0x0a,
+ 0x04, 0x54, 0x79, 0x70, 0x65, 0x18, 0x05, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x54, 0x79, 0x70,
+ 0x65, 0x22, 0x62, 0x0a, 0x16, 0x47, 0x65, 0x74, 0x4d, 0x61, 0x74, 0x65, 0x72, 0x69, 0x61, 0x6c,
+ 0x4c, 0x69, 0x73, 0x74, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x12, 0x0a, 0x04, 0x70,
+ 0x61, 0x67, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x05, 0x52, 0x04, 0x70, 0x61, 0x67, 0x65, 0x12,
+ 0x1a, 0x0a, 0x08, 0x70, 0x61, 0x67, 0x65, 0x53, 0x69, 0x7a, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28,
+ 0x05, 0x52, 0x08, 0x70, 0x61, 0x67, 0x65, 0x53, 0x69, 0x7a, 0x65, 0x12, 0x18, 0x0a, 0x07, 0x4b,
+ 0x65, 0x79, 0x77, 0x6f, 0x72, 0x64, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x07, 0x4b, 0x65,
+ 0x79, 0x77, 0x6f, 0x72, 0x64, 0x22, 0x74, 0x0a, 0x17, 0x47, 0x65, 0x74, 0x4d, 0x61, 0x74, 0x65,
+ 0x72, 0x69, 0x61, 0x6c, 0x4c, 0x69, 0x73, 0x74, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65,
+ 0x12, 0x12, 0x0a, 0x04, 0x43, 0x6f, 0x64, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x05, 0x52, 0x04,
+ 0x43, 0x6f, 0x64, 0x65, 0x12, 0x10, 0x0a, 0x03, 0x4d, 0x73, 0x67, 0x18, 0x02, 0x20, 0x01, 0x28,
+ 0x09, 0x52, 0x03, 0x4d, 0x73, 0x67, 0x12, 0x1d, 0x0a, 0x04, 0x4c, 0x69, 0x73, 0x74, 0x18, 0x03,
+ 0x20, 0x03, 0x28, 0x0b, 0x32, 0x09, 0x2e, 0x4d, 0x61, 0x74, 0x65, 0x72, 0x69, 0x61, 0x6c, 0x52,
+ 0x04, 0x4c, 0x69, 0x73, 0x74, 0x12, 0x14, 0x0a, 0x05, 0x54, 0x6f, 0x74, 0x61, 0x6c, 0x18, 0x04,
+ 0x20, 0x01, 0x28, 0x03, 0x52, 0x05, 0x54, 0x6f, 0x74, 0x61, 0x6c, 0x32, 0x5c, 0x0a, 0x12, 0x6f,
+ 0x75, 0x74, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x69, 0x6e, 0x67, 0x53, 0x65, 0x72, 0x76, 0x69, 0x63,
+ 0x65, 0x12, 0x46, 0x0a, 0x0f, 0x47, 0x65, 0x74, 0x4d, 0x61, 0x74, 0x65, 0x72, 0x69, 0x61, 0x6c,
+ 0x4c, 0x69, 0x73, 0x74, 0x12, 0x17, 0x2e, 0x47, 0x65, 0x74, 0x4d, 0x61, 0x74, 0x65, 0x72, 0x69,
+ 0x61, 0x6c, 0x4c, 0x69, 0x73, 0x74, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x18, 0x2e,
+ 0x47, 0x65, 0x74, 0x4d, 0x61, 0x74, 0x65, 0x72, 0x69, 0x61, 0x6c, 0x4c, 0x69, 0x73, 0x74, 0x52,
+ 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x00, 0x42, 0x0f, 0x5a, 0x0d, 0x2e, 0x3b, 0x6f,
+ 0x75, 0x74, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x69, 0x6e, 0x67, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74,
+ 0x6f, 0x33,
+}
+
+var (
+ file_outsourcing_proto_rawDescOnce sync.Once
+ file_outsourcing_proto_rawDescData = file_outsourcing_proto_rawDesc
+)
+
+func file_outsourcing_proto_rawDescGZIP() []byte {
+ file_outsourcing_proto_rawDescOnce.Do(func() {
+ file_outsourcing_proto_rawDescData = protoimpl.X.CompressGZIP(file_outsourcing_proto_rawDescData)
+ })
+ return file_outsourcing_proto_rawDescData
+}
+
+var file_outsourcing_proto_msgTypes = make([]protoimpl.MessageInfo, 3)
+var file_outsourcing_proto_goTypes = []interface{}{
+ (*Material)(nil), // 0: Material
+ (*GetMaterialListRequest)(nil), // 1: GetMaterialListRequest
+ (*GetMaterialListResponse)(nil), // 2: GetMaterialListResponse
+}
+var file_outsourcing_proto_depIdxs = []int32{
+ 0, // 0: GetMaterialListResponse.List:type_name -> Material
+ 1, // 1: outsourcingService.GetMaterialList:input_type -> GetMaterialListRequest
+ 2, // 2: outsourcingService.GetMaterialList:output_type -> GetMaterialListResponse
+ 2, // [2:3] is the sub-list for method output_type
+ 1, // [1:2] is the sub-list for method input_type
+ 1, // [1:1] is the sub-list for extension type_name
+ 1, // [1:1] is the sub-list for extension extendee
+ 0, // [0:1] is the sub-list for field type_name
+}
+
+func init() { file_outsourcing_proto_init() }
+func file_outsourcing_proto_init() {
+ if File_outsourcing_proto != nil {
+ return
+ }
+ if !protoimpl.UnsafeEnabled {
+ file_outsourcing_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} {
+ switch v := v.(*Material); i {
+ case 0:
+ return &v.state
+ case 1:
+ return &v.sizeCache
+ case 2:
+ return &v.unknownFields
+ default:
+ return nil
+ }
+ }
+ file_outsourcing_proto_msgTypes[1].Exporter = func(v interface{}, i int) interface{} {
+ switch v := v.(*GetMaterialListRequest); i {
+ case 0:
+ return &v.state
+ case 1:
+ return &v.sizeCache
+ case 2:
+ return &v.unknownFields
+ default:
+ return nil
+ }
+ }
+ file_outsourcing_proto_msgTypes[2].Exporter = func(v interface{}, i int) interface{} {
+ switch v := v.(*GetMaterialListResponse); i {
+ case 0:
+ return &v.state
+ case 1:
+ return &v.sizeCache
+ case 2:
+ return &v.unknownFields
+ default:
+ return nil
+ }
+ }
+ }
+ type x struct{}
+ out := protoimpl.TypeBuilder{
+ File: protoimpl.DescBuilder{
+ GoPackagePath: reflect.TypeOf(x{}).PkgPath(),
+ RawDescriptor: file_outsourcing_proto_rawDesc,
+ NumEnums: 0,
+ NumMessages: 3,
+ NumExtensions: 0,
+ NumServices: 1,
+ },
+ GoTypes: file_outsourcing_proto_goTypes,
+ DependencyIndexes: file_outsourcing_proto_depIdxs,
+ MessageInfos: file_outsourcing_proto_msgTypes,
+ }.Build()
+ File_outsourcing_proto = out.File
+ file_outsourcing_proto_rawDesc = nil
+ file_outsourcing_proto_goTypes = nil
+ file_outsourcing_proto_depIdxs = nil
+}
diff --git a/service/outsourcing/outsourcing.proto b/service/outsourcing/outsourcing.proto
new file mode 100644
index 0000000..9300ee3
--- /dev/null
+++ b/service/outsourcing/outsourcing.proto
@@ -0,0 +1,29 @@
+syntax = "proto3";
+
+option go_package = ".;outsourcing";
+
+service outsourcingService {
+ rpc GetMaterialList(GetMaterialListRequest) returns(GetMaterialListResponse) {}
+}
+
+
+message Material {
+ string ID = 1; //缂栧彿
+ string Name = 2; //鍚嶇О
+ string Unit = 3; //鍗曚綅
+ string Specs = 4; // 瑙勬牸
+ string Type = 5; // 鍨嬪彿
+}
+
+message GetMaterialListRequest{
+ int32 page = 1;
+ int32 pageSize = 2;
+ string Keyword = 3;
+}
+
+message GetMaterialListResponse{
+ int32 Code = 1;
+ string Msg = 2;
+ repeated Material List = 3;
+ int64 Total = 4;
+}
\ No newline at end of file
diff --git a/service/outsourcing/outsourcing_grpc.pb.go b/service/outsourcing/outsourcing_grpc.pb.go
new file mode 100644
index 0000000..54d3528
--- /dev/null
+++ b/service/outsourcing/outsourcing_grpc.pb.go
@@ -0,0 +1,109 @@
+// Code generated by protoc-gen-go-grpc. DO NOT EDIT.
+// versions:
+// - protoc-gen-go-grpc v1.3.0
+// - protoc v3.19.0
+// source: outsourcing.proto
+
+package outsourcing
+
+import (
+ context "context"
+ grpc "google.golang.org/grpc"
+ codes "google.golang.org/grpc/codes"
+ status "google.golang.org/grpc/status"
+)
+
+// This is a compile-time assertion to ensure that this generated file
+// is compatible with the grpc package it is being compiled against.
+// Requires gRPC-Go v1.32.0 or later.
+const _ = grpc.SupportPackageIsVersion7
+
+const (
+ OutsourcingService_GetMaterialList_FullMethodName = "/outsourcingService/GetMaterialList"
+)
+
+// OutsourcingServiceClient is the client API for OutsourcingService service.
+//
+// For semantics around ctx use and closing/ending streaming RPCs, please refer to https://pkg.go.dev/google.golang.org/grpc/?tab=doc#ClientConn.NewStream.
+type OutsourcingServiceClient interface {
+ GetMaterialList(ctx context.Context, in *GetMaterialListRequest, opts ...grpc.CallOption) (*GetMaterialListResponse, error)
+}
+
+type outsourcingServiceClient struct {
+ cc grpc.ClientConnInterface
+}
+
+func NewOutsourcingServiceClient(cc grpc.ClientConnInterface) OutsourcingServiceClient {
+ return &outsourcingServiceClient{cc}
+}
+
+func (c *outsourcingServiceClient) GetMaterialList(ctx context.Context, in *GetMaterialListRequest, opts ...grpc.CallOption) (*GetMaterialListResponse, error) {
+ out := new(GetMaterialListResponse)
+ err := c.cc.Invoke(ctx, OutsourcingService_GetMaterialList_FullMethodName, in, out, opts...)
+ if err != nil {
+ return nil, err
+ }
+ return out, nil
+}
+
+// OutsourcingServiceServer is the server API for OutsourcingService service.
+// All implementations must embed UnimplementedOutsourcingServiceServer
+// for forward compatibility
+type OutsourcingServiceServer interface {
+ GetMaterialList(context.Context, *GetMaterialListRequest) (*GetMaterialListResponse, error)
+ mustEmbedUnimplementedOutsourcingServiceServer()
+}
+
+// UnimplementedOutsourcingServiceServer must be embedded to have forward compatible implementations.
+type UnimplementedOutsourcingServiceServer struct {
+}
+
+func (UnimplementedOutsourcingServiceServer) GetMaterialList(context.Context, *GetMaterialListRequest) (*GetMaterialListResponse, error) {
+ return nil, status.Errorf(codes.Unimplemented, "method GetMaterialList not implemented")
+}
+func (UnimplementedOutsourcingServiceServer) mustEmbedUnimplementedOutsourcingServiceServer() {}
+
+// UnsafeOutsourcingServiceServer may be embedded to opt out of forward compatibility for this service.
+// Use of this interface is not recommended, as added methods to OutsourcingServiceServer will
+// result in compilation errors.
+type UnsafeOutsourcingServiceServer interface {
+ mustEmbedUnimplementedOutsourcingServiceServer()
+}
+
+func RegisterOutsourcingServiceServer(s grpc.ServiceRegistrar, srv OutsourcingServiceServer) {
+ s.RegisterService(&OutsourcingService_ServiceDesc, srv)
+}
+
+func _OutsourcingService_GetMaterialList_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
+ in := new(GetMaterialListRequest)
+ if err := dec(in); err != nil {
+ return nil, err
+ }
+ if interceptor == nil {
+ return srv.(OutsourcingServiceServer).GetMaterialList(ctx, in)
+ }
+ info := &grpc.UnaryServerInfo{
+ Server: srv,
+ FullMethod: OutsourcingService_GetMaterialList_FullMethodName,
+ }
+ handler := func(ctx context.Context, req interface{}) (interface{}, error) {
+ return srv.(OutsourcingServiceServer).GetMaterialList(ctx, req.(*GetMaterialListRequest))
+ }
+ return interceptor(ctx, in, info, handler)
+}
+
+// OutsourcingService_ServiceDesc is the grpc.ServiceDesc for OutsourcingService service.
+// It's only intended for direct use with grpc.RegisterService,
+// and not to be introspected or modified (even as a copy)
+var OutsourcingService_ServiceDesc = grpc.ServiceDesc{
+ ServiceName: "outsourcingService",
+ HandlerType: (*OutsourcingServiceServer)(nil),
+ Methods: []grpc.MethodDesc{
+ {
+ MethodName: "GetMaterialList",
+ Handler: _OutsourcingService_GetMaterialList_Handler,
+ },
+ },
+ Streams: []grpc.StreamDesc{},
+ Metadata: "outsourcing.proto",
+}
--
Gitblit v1.8.0