Bläddra i källkod

供应商分页接口返回值添加了新的字段

mainqaq 3 år sedan
förälder
incheckning
9dd277039d
1 ändrade filer med 14 tillägg och 6 borttagningar
  1. 14 6
      controllers/supply_order_api_contorller.go

+ 14 - 6
controllers/supply_order_api_contorller.go Visa fil

@@ -75,10 +75,14 @@ func SupplyOrderApiRegistRouters() {
75 75
 func (this *SupplyOrderApiController) GetSupplyList() {
76 76
 	ctype, _ := this.GetInt64("ctype") //供应商类别
77 77
 	page, _ := this.GetInt64("page")   //页码
78
-	limit, _ := this.GetInt64("limit") //
79
-	code := this.GetString("code")     //供应商编号
80
-	sname := this.GetString("sname")   //供应商名称
81
-	cname := this.GetString("cname")   //联系人名子
78
+	limit, _ := this.GetInt64("limit") //每一页查出来的条数
79
+	if page == 0 || limit == 0 {
80
+		this.ServeFailJsonSend(enums.ErrorCodeParamWrong, "page或limit参数不能为空")
81
+		return
82
+	}
83
+	code := this.GetString("code")   //供应商编号
84
+	sname := this.GetString("sname") //供应商名称
85
+	cname := this.GetString("cname") //联系人名字
82 86
 	orgId := this.GetAdminUserInfo().CurrentOrgId
83 87
 	//获取分页的数据
84 88
 	list, total, err := service.GetSupplyList(ctype, page, limit, code, sname, cname)
@@ -86,8 +90,9 @@ func (this *SupplyOrderApiController) GetSupplyList() {
86 90
 	costClassify := "供应商类别"
87 91
 	drugTypeParent, _ := service.GetDrugDataConfig(0, costClassify)
88 92
 	drugTypeList, _ := service.GetParentDataConfig(drugTypeParent.ID, orgId)
89
-	tmpmap := make(map[int64]string)   //储存供应商类别
90
-	namemap := make(map[string]string) //储存首要联系人
93
+	tmpmap := make(map[int64]string)    //储存供应商类别
94
+	namemap := make(map[string]string)  //储存首要联系人
95
+	phonemap := make(map[string]string) //手机号
91 96
 	for i := 0; i < len(drugTypeList); i++ {
92 97
 		k := int64(drugTypeList[i].Value)
93 98
 		v := drugTypeList[i].Name
@@ -102,6 +107,7 @@ func (this *SupplyOrderApiController) GetSupplyList() {
102 107
 				return
103 108
 			}
104 109
 			namemap[code] = fistname.Name
110
+			phonemap[code] = fistname.Phone
105 111
 		}
106 112
 		type SpSupplierNameList struct { //基于SpSupplierName结构体修改的,为了方便前端取数据整合了一下,删除了几个用不到的字段,添加了联系人名字和供应商类别两个字段
107 113
 			ID           int64
@@ -117,6 +123,7 @@ func (this *SupplyOrderApiController) GetSupplyList() {
117 123
 			ContactsId   int64
118 124
 			ConName      string //供应商主要联系人名字
119 125
 			TypeName     string //供应商类别
126
+			Phone        string //电话
120 127
 		}
121 128
 		//初始化该结构体
122 129
 		tmplist := []*SpSupplierNameList{}
@@ -141,6 +148,7 @@ func (this *SupplyOrderApiController) GetSupplyList() {
141 148
 				list[i].ContactsId,
142 149
 				namemap[list[i].SupplierCode],
143 150
 				typename,
151
+				phonemap[list[i].SupplierCode],
144 152
 			}
145 153
 			tmplist = append(tmplist, tlist)
146 154