Browse Source

根据编号批量查找物料接口修改

dongbw 7 years ago
parent
commit
d2356166f7

+ 7 - 2
src/main/java/com/uas/ps/product/controller/ProductGetController.java

@@ -1,5 +1,6 @@
 package com.uas.ps.product.controller;
 
+import com.alibaba.fastjson.JSON;
 import com.uas.ps.entity.Product;
 import com.uas.ps.product.service.ProductService;
 import org.springframework.beans.factory.annotation.Autowired;
@@ -8,6 +9,8 @@ import org.springframework.web.bind.annotation.RequestMethod;
 import org.springframework.web.bind.annotation.RequestParam;
 import org.springframework.web.bind.annotation.RestController;
 
+import java.io.UnsupportedEncodingException;
+import java.net.URLDecoder;
 import java.util.List;
 
 /**
@@ -40,8 +43,10 @@ public class ProductGetController {
      * @return  物料List
      */
     @RequestMapping(value = "/findByEnUUAndCodes", method = RequestMethod.GET)
-    public List<Product> findByEnUUAndCodes(@RequestParam("enUU") Long enUU, @RequestParam("codes") List<String> codes) {
-        return productService.findByEnUUAndCodes(enUU, codes);
+    public List<Product> findByEnUUAndCodes(@RequestParam("enUU") Long enUU, @RequestParam("codes") String codes) throws UnsupportedEncodingException {
+        codes = URLDecoder.decode(codes, "UTF-8");
+        List<String> codeList = JSON.parseArray(codes, String.class);
+        return productService.findByEnUUAndCodes(enUU, codeList);
     }
 
     /**