فهرست منبع

Merge remote-tracking branch 'origin/public-mater20180118' into public-mater20180118

wangdy 8 سال پیش
والد
کامیت
d625a5ea09

+ 12 - 0
src/main/java/com/uas/platform/b2c/prod/product/brand/api/BrandController.java

@@ -254,4 +254,16 @@ public class BrandController {
 	public List<Brand> getMostSearchBrands() {
 		return brandService.getMostSearchBrands();
 	}
+
+	/**
+	 * 通过名字获取品牌信息
+	 * @param name 品牌名
+	 * @return 品牌信息
+	 * @throws UnsupportedEncodingException
+	 */
+	@RequestMapping(value = "/byName/brand", method = RequestMethod.GET)
+	public BrandInfo getBrandInfoByName(String name) throws UnsupportedEncodingException{
+		name = URLDecoder.decode(name, "utf-8");
+		return brandService.findByName(name, name);
+	}
 }

+ 11 - 0
src/main/java/com/uas/platform/b2c/prod/product/component/api/ComponentController.java

@@ -320,4 +320,15 @@ public class ComponentController {
 	public List<Component> getMostSearchBrands() {
 		return componentService.getMostSearchComponent();
 	}
+
+	/**
+	 * 根据以下字段获取器件信息
+	 * @param brandId
+	 * @param cmpCode
+	 * @return
+	 */
+	@RequestMapping(value = "/codeAndBrand/info", method = RequestMethod.GET)
+	public Component getComponentBySome(Long brandId, String cmpCode) {
+		return componentService.getComponentBySome(brandId, cmpCode);
+	}
 }

+ 9 - 0
src/main/java/com/uas/platform/b2c/prod/product/component/service/ComponentService.java

@@ -244,4 +244,13 @@ public interface ComponentService {
 	 */
 	public List<Component> getMostSearchComponent();
 
+	/**
+	 * 根据以下获取器件信息
+	 *
+	 * @param brandId
+	 * @param cmpCode
+	 * @return
+	 */
+	Component getComponentBySome(Long brandId, String cmpCode);
+
 }

+ 9 - 0
src/main/java/com/uas/platform/b2c/prod/product/component/service/impl/ComponentServiceImpl.java

@@ -570,4 +570,13 @@ public class ComponentServiceImpl implements ComponentService {
 	public List<Component> getMostSearchComponent() {
 		return componentDao.findMostSearchComponent();
 	}
+
+	@Override
+	public Component getComponentBySome(Long brandId, String cmpCode) {
+		List<Component> componentList = componentDao.findByCodeAndBrandid(cmpCode, brandId);
+		if (CollectionUtils.isNotEmpty(componentList)) {
+			return componentList.get(0);
+		}
+		return null;
+	}
 }