Browse Source

处理买家中心删除个人物料不成功的情况。

yuj 7 years ago
parent
commit
dc132e1a24

+ 9 - 1
src/main/java/com/uas/platform/b2c/prod/commodity/dao/ProductDao.java

@@ -205,13 +205,21 @@ public interface ProductDao extends JpaSpecificationExecutor<Product>, JpaReposi
     List<Product> findProductInId(@Param("idList") List<Long> idList);
 
     /**
-     * 根据enuu查询所有的prids
+     * 根据enuu和standard查询所有的prids
      * @param enuu
      * @return
      */
     @Query(value = "select p.id from Product p where p.enUU = :enuu and p.standard = :standard")
     List<Long> findPridsByEnuuAndStardand(@Param("enuu") Long enuu, @Param("standard") Integer standard);
 
+    /**
+     * 根据enuu查询所有的prids
+     * @param enuu
+     * @return
+     */
+    @Query(value = "select p.id from Product p where p.enUU = :enuu")
+    List<Long> findPridsByEnuu(@Param("enuu") Long enuu);
+
     /**
      * 更新物料信息为已上传
      * @param list

+ 6 - 5
src/main/java/com/uas/platform/b2c/prod/commodity/service/impl/ProductServiceImpl.java

@@ -797,15 +797,16 @@ public class ProductServiceImpl implements ProductService {
      */
     @Override
     public ResultMap deletePersonalProductByBatch(String type) {
-        Integer standard;
         Integer success = 0;
         Long uu = SystemSession.getUser().getEnterprise().getUu();
-        if (ProductConstant.STANDARD.equals(type)) {
-            standard = IntegerConstant.YES_SHORT;
+        List<Long> prids = null;
+        if (ProductConstant.ALL.equals(type)) {
+            prids = productDao.findPridsByEnuu(uu);
         } else {
-            standard = IntegerConstant.NO_SHORT;
+            Integer standard = ProductConstant.STANDARD.equals(type) ? IntegerConstant.YES_SHORT : IntegerConstant.NO_SHORT;
+            prids = productDao.findPridsByEnuuAndStardand(uu, standard);
         }
-        List<Long> prids = productDao.findPridsByEnuuAndStardand(uu, standard);
+
         List<Long> personPrIds = null;
         if (CollectionUtils.isNotEmpty(prids)) {
             personPrIds = productPersonDao.findIdsInProductPerson(prids, SystemSession.getUser().getUserUU());