Browse Source

feat(admin):新增获取全部计数器接口

wangyc 7 years ago
parent
commit
46c9f35baa

+ 9 - 0
src/main/java/com/uas/platform/b2c/prod/product/common/api/CommonCountController.java

@@ -114,4 +114,13 @@ public class CommonCountController {
         return commonCounts;
     }
 
+    /**
+     * 获取全部统计数据
+     * @return
+     */
+    @RequestMapping(value = "/all", method = RequestMethod.GET)
+    public List<CommonCount> findAll() {
+        return commonCountService.findAllForCust();
+    }
+
 }

+ 10 - 2
src/main/java/com/uas/platform/b2c/prod/product/common/dao/CommonCountDao.java

@@ -3,6 +3,7 @@ package com.uas.platform.b2c.prod.product.common.dao;
 import com.uas.platform.b2c.prod.product.common.model.CommonCount;
 import org.springframework.data.jpa.repository.JpaRepository;
 import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
+import org.springframework.data.jpa.repository.Query;
 import org.springframework.stereotype.Repository;
 
 import java.util.List;
@@ -18,12 +19,19 @@ public interface CommonCountDao extends JpaSpecificationExecutor<CommonCount>,Jp
      * @param status 状态
      * @return 计数器
      */
-    public List<CommonCount> findByStatusAndUsedForOrderByDetno(Short status, String usedFor);
+    List<CommonCount> findByStatusAndUsedForOrderByDetno(Short status, String usedFor);
 
     /**
      * 通过状态获取计数器
      * @param status
      * @return
      */
-    public List<CommonCount> findByStatus(Short status);
+    List<CommonCount> findByStatus(Short status);
+
+    /**
+     * 获取全部技术器(对外)
+     * @return
+     */
+    @Query(value = "select c from CommonCount c where c.status=1 order by c.id")
+    List<CommonCount> findAllForCust();
 }

+ 6 - 0
src/main/java/com/uas/platform/b2c/prod/product/common/service/CommonCountService.java

@@ -22,4 +22,10 @@ public interface CommonCountService {
      * @return
      */
     CommonCount findById(Long id);
+
+    /**
+     * 获取全部计数器(对外)
+     * @return
+     */
+    List<CommonCount> findAllForCust();
 }

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

@@ -27,4 +27,13 @@ public class CommonCountServiceImpl implements CommonCountService{
     public CommonCount findById(Long id) {
         return commonCountDao.findOne(id);
     }
+
+    @Override
+    public List<CommonCount> findAllForCust() {
+        List<CommonCount> commonCounts = commonCountDao.findAllForCust();
+//        for (CommonCount commonCount : commonCounts) {
+//            commonCount.setSql(null);
+//        }
+        return commonCounts;
+    }
 }