|
|
@@ -0,0 +1,158 @@
|
|
|
+package com.uas.ps.product.controller;
|
|
|
+
|
|
|
+import com.uas.ps.entity.Product;
|
|
|
+import com.uas.ps.product.service.ProductService;
|
|
|
+import org.springframework.beans.factory.annotation.Autowired;
|
|
|
+import org.springframework.web.bind.annotation.RequestMapping;
|
|
|
+import org.springframework.web.bind.annotation.RequestMethod;
|
|
|
+import org.springframework.web.bind.annotation.RequestParam;
|
|
|
+import org.springframework.web.bind.annotation.RestController;
|
|
|
+
|
|
|
+import java.util.List;
|
|
|
+
|
|
|
+/**
|
|
|
+ * 物料相关的查询接口
|
|
|
+ * @author dongbw
|
|
|
+ * 18/07/11 15:02.
|
|
|
+ */
|
|
|
+@RestController
|
|
|
+@RequestMapping("/product/get")
|
|
|
+public class ProductGetController {
|
|
|
+
|
|
|
+ @Autowired
|
|
|
+ private ProductService productService;
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 根据enUU和code查找企业物料
|
|
|
+ * @param enUU 企业UU
|
|
|
+ * @param code 物料编号
|
|
|
+ * @return 物料List -- 其实只有一个,为了配合之前B2B未建唯一索引时的查询方法,返回List
|
|
|
+ */
|
|
|
+ @RequestMapping(value = "/findByEnUUAndCode", method = RequestMethod.GET)
|
|
|
+ public List<Product> findByEnUUAndCode(@RequestParam("enUU") Long enUU, @RequestParam("code") String code) {
|
|
|
+ return productService.findByEnUUAndCode(enUU, code);
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 根据enUU和code查找企业物料
|
|
|
+ * @param enUU 企业UU
|
|
|
+ * @param codes 物料编号 List
|
|
|
+ * @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);
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 根据id查找企业物料
|
|
|
+ * @param id 物料id
|
|
|
+ * @return 物料
|
|
|
+ */
|
|
|
+ @RequestMapping(value = "/findById", method = RequestMethod.GET)
|
|
|
+ public Product findById(@RequestParam("id") Long id) {
|
|
|
+ return productService.findById(id);
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 根据ids查找企业物料
|
|
|
+ * @param ids 物料id
|
|
|
+ * @return 物料
|
|
|
+ */
|
|
|
+ @RequestMapping(value = "/findByIds", method = RequestMethod.GET)
|
|
|
+ public List<Product> findById(@RequestParam("ids") String ids) {
|
|
|
+ return productService.findByIds(ids);
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 根据enUU和title查找企业物料
|
|
|
+ * @param enUU 企业UU
|
|
|
+ * @param title 物料名称
|
|
|
+ * @return 物料List
|
|
|
+ */
|
|
|
+ @RequestMapping(value = "/findByEnUUAndTitle", method = RequestMethod.GET)
|
|
|
+ public List<Product> findByEnUUAndTitle(@RequestParam Long enUU, @RequestParam String title) {
|
|
|
+ return productService.findByEnUUAndTitle(enUU, title);
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 根据enUU和品牌可是否可卖查找企业物料
|
|
|
+ * @param enUU 企业UU
|
|
|
+ * @param brand 物料品牌
|
|
|
+ * @param isSale 是否可卖 1 可 0 不可
|
|
|
+ * @return 物料List
|
|
|
+ */
|
|
|
+ @RequestMapping(value = "/findByEnUUAndBrandAndIsSale", method = RequestMethod.GET)
|
|
|
+ public List<Product> findByEnUUAndBrandAndIsSale(@RequestParam Long enUU, @RequestParam String brand, @RequestParam Short isSale) {
|
|
|
+ return productService.findByEnUUAndBrandAndIsSale(enUU, brand, isSale);
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 根据enUU和brand和isPurchase查找企业物料
|
|
|
+ * @param enUU 企业UU
|
|
|
+ * @param brand 物料品牌
|
|
|
+ * @param isPurchase 是否待采购 1 可 0 不可
|
|
|
+ * @return 物料List
|
|
|
+ */
|
|
|
+ @RequestMapping(value = "/findByEnUUAndBrandAndIsPurchase", method = RequestMethod.GET)
|
|
|
+ public List<Product> findByEnUUAndBrandAndIsPurchase(@RequestParam Long enUU, @RequestParam String brand, @RequestParam Short isPurchase) {
|
|
|
+ return productService.findByEnUUAndBrandAndIsPurchase(enUU, brand, isPurchase);
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 根据enUU和brand和brand查找企业物料
|
|
|
+ * @param enUU 企业UU
|
|
|
+ * @param brand 物料品牌
|
|
|
+ * @return 物料List
|
|
|
+ */
|
|
|
+ @RequestMapping(value = "/findByEnUUAndBrand", method = RequestMethod.GET)
|
|
|
+ public List<Product> findByEnUUAndBrand(@RequestParam Long enUU, @RequestParam String brand) {
|
|
|
+ return productService.findByEnUUAndBrand(enUU, brand);
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 根据enUU和title和isSale查找企业物料
|
|
|
+ * @param enUU 企业UU
|
|
|
+ * @param title 物料名称
|
|
|
+ * @param isSale 是否待销售 1 可 0 不可
|
|
|
+ * @return 物料List
|
|
|
+ */
|
|
|
+ @RequestMapping(value = "/findByEnUUAndTitleAndIsSale", method = RequestMethod.GET)
|
|
|
+ public List<Product> findByEnUUAndTitleAndIsSale(@RequestParam Long enUU, @RequestParam String title, @RequestParam Short isSale) {
|
|
|
+ return productService.findByEnUUAndTitleAndIsSale(enUU, title, isSale);
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 根据enUU和title和isSale查找企业物料
|
|
|
+ * @param enUU 企业UU
|
|
|
+ * @param title 物料名称
|
|
|
+ * @param isPurchase 是否可采购 1 可 0 不可
|
|
|
+ * @return 物料List
|
|
|
+ */
|
|
|
+ @RequestMapping(value = "/findByEnUUAndTitleAndIsPurchase", method = RequestMethod.GET)
|
|
|
+ public List<Product> findByEnUUAndTitleAndIsPurchase(@RequestParam Long enUU, @RequestParam String title, @RequestParam Short isPurchase) {
|
|
|
+ return productService.findByEnUUAndTitleAndIsPurchase(enUU, title, isPurchase);
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 根据enUU和title和isSale查找企业物料
|
|
|
+ * @param enUU 企业UU
|
|
|
+ * @param sourceApp 来源app
|
|
|
+ * @param downloadStatus 下载状态 202 待下载 203 已下载
|
|
|
+ * @return 物料List
|
|
|
+ */
|
|
|
+ @RequestMapping(value = "/findByEnUUAndSourceAppAndDownloadStatus", method = RequestMethod.GET)
|
|
|
+ public List<Product> findByEnUUAndSourceAppAndDownloadStatus(@RequestParam Long enUU, @RequestParam String sourceApp, @RequestParam Integer downloadStatus) {
|
|
|
+ return productService.findByEnUUAndSourceAppAndDownloadStatus(enUU, sourceApp, downloadStatus);
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 根据enUU和获取企业物料数量
|
|
|
+ * @param enUU 企业UU
|
|
|
+ * @return 物料List
|
|
|
+ */
|
|
|
+ @RequestMapping(value = "/countByEnUU", method = RequestMethod.GET)
|
|
|
+ public Long countByEnUU(@RequestParam("enUU") Long enUU) {
|
|
|
+ return productService.countByEnUU(enUU);
|
|
|
+ }
|
|
|
+}
|