@@ -267,4 +267,13 @@ public class ComponentController {
return goodsService.pageGoodsByKeyword(pageInfo, original, keyword);
}
+ /**
+ * 根据批次号获取器件信息
+ * @param batchIds
+ * @return 器件信息
+ */
+ @RequestMapping(value = "/batchId", method = RequestMethod.POST, produces = "application/json")
+ public List<ComponentInfo> getBatchBrands(@RequestBody List<Long> batchIds) {
+ return componentService.getBatchComponents(batchIds);
+ }
@@ -80,4 +80,12 @@ public interface ComponentInfoDao extends JpaSpecificationExecutor<ComponentInfo
* @return 库存数量大于指定值的一页器件
*/
Page<ComponentInfo> findByImgIsNotNull(Pageable pageable);
+
+ * @param batchids id批次号
+ * @return
+ @Query(nativeQuery = true, value = "select * from product$component where cmp_id in :batchids")
+ public List<ComponentInfo> findByBatchids(@Param("batchids") List<Long> batchids);
@@ -202,4 +202,11 @@ public interface ComponentService {
* @return 新增器件数量统计
List<Map<String, Object>> findCountIncreaseComponentByMonth();
+ List<ComponentInfo> getBatchComponents(List<Long> batchIds);
@@ -536,5 +536,11 @@ public class ComponentServiceImpl implements ComponentService {
return map;
+ public List<ComponentInfo> getBatchComponents(List<Long> batchIds) {
+ if (batchIds.size() == 0) {
+ return componentInfoDao.findAll();
+ return componentInfoDao.findByBatchids(batchIds);