瀏覽代碼

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

mainqaq 3 年之前
父節點
當前提交
9dd277039d
共有 1 個文件被更改,包括 14 次插入6 次删除
  1. 14 6
      controllers/supply_order_api_contorller.go

+ 14 - 6
controllers/supply_order_api_contorller.go 查看文件

75
 func (this *SupplyOrderApiController) GetSupplyList() {
75
 func (this *SupplyOrderApiController) GetSupplyList() {
76
 	ctype, _ := this.GetInt64("ctype") //供应商类别
76
 	ctype, _ := this.GetInt64("ctype") //供应商类别
77
 	page, _ := this.GetInt64("page")   //页码
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
 	orgId := this.GetAdminUserInfo().CurrentOrgId
86
 	orgId := this.GetAdminUserInfo().CurrentOrgId
83
 	//获取分页的数据
87
 	//获取分页的数据
84
 	list, total, err := service.GetSupplyList(ctype, page, limit, code, sname, cname)
88
 	list, total, err := service.GetSupplyList(ctype, page, limit, code, sname, cname)
86
 	costClassify := "供应商类别"
90
 	costClassify := "供应商类别"
87
 	drugTypeParent, _ := service.GetDrugDataConfig(0, costClassify)
91
 	drugTypeParent, _ := service.GetDrugDataConfig(0, costClassify)
88
 	drugTypeList, _ := service.GetParentDataConfig(drugTypeParent.ID, orgId)
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
 	for i := 0; i < len(drugTypeList); i++ {
96
 	for i := 0; i < len(drugTypeList); i++ {
92
 		k := int64(drugTypeList[i].Value)
97
 		k := int64(drugTypeList[i].Value)
93
 		v := drugTypeList[i].Name
98
 		v := drugTypeList[i].Name
102
 				return
107
 				return
103
 			}
108
 			}
104
 			namemap[code] = fistname.Name
109
 			namemap[code] = fistname.Name
110
+			phonemap[code] = fistname.Phone
105
 		}
111
 		}
106
 		type SpSupplierNameList struct { //基于SpSupplierName结构体修改的,为了方便前端取数据整合了一下,删除了几个用不到的字段,添加了联系人名字和供应商类别两个字段
112
 		type SpSupplierNameList struct { //基于SpSupplierName结构体修改的,为了方便前端取数据整合了一下,删除了几个用不到的字段,添加了联系人名字和供应商类别两个字段
107
 			ID           int64
113
 			ID           int64
117
 			ContactsId   int64
123
 			ContactsId   int64
118
 			ConName      string //供应商主要联系人名字
124
 			ConName      string //供应商主要联系人名字
119
 			TypeName     string //供应商类别
125
 			TypeName     string //供应商类别
126
+			Phone        string //电话
120
 		}
127
 		}
121
 		//初始化该结构体
128
 		//初始化该结构体
122
 		tmplist := []*SpSupplierNameList{}
129
 		tmplist := []*SpSupplierNameList{}
141
 				list[i].ContactsId,
148
 				list[i].ContactsId,
142
 				namemap[list[i].SupplierCode],
149
 				namemap[list[i].SupplierCode],
143
 				typename,
150
 				typename,
151
+				phonemap[list[i].SupplierCode],
144
 			}
152
 			}
145
 			tmplist = append(tmplist, tlist)
153
 			tmplist = append(tmplist, tlist)
146
 
154