zhijiezhao 1 місяць тому
батько
коміт
e541549de0

+ 15 - 0
src/main/java/com/caimei365/manager/controller/caimei/page/WebPageApi.java

@@ -77,6 +77,21 @@ public class WebPageApi {
         return newPageZoneService.getZoneProductList(id, shopName, productId, pageNum, pageSize);
         return newPageZoneService.getZoneProductList(id, shopName, productId, pageNum, pageSize);
     }
     }
 
 
+    /**
+     * 添加商品查询
+     *
+     * @param id
+     * @param pageNum
+     * @param pageSize
+     * @return
+     */
+    @GetMapping("/selectProductList")
+    public ResponseJson<PaginationVo<Product>> selectProductList(Integer id, Integer productId, String shopName, String productName,
+                                                                 @RequestParam(value = "pageNum", defaultValue = "1") int pageNum,
+                                                                 @RequestParam(value = "pageSize", defaultValue = "20") int pageSize) {
+        return newPageZoneService.selectProductList(id, productId, shopName, productName, pageNum, pageSize);
+    }
+
     @GetMapping("/delZoneProduct")
     @GetMapping("/delZoneProduct")
     public ResponseJson delZoneProduct(Integer id, String ids) {
     public ResponseJson delZoneProduct(Integer id, String ids) {
         return newPageZoneService.delZoneProduct(id, ids);
         return newPageZoneService.delZoneProduct(id, ids);

+ 2 - 0
src/main/java/com/caimei365/manager/dao/page/NewPageZoneDao.java

@@ -83,4 +83,6 @@ public interface NewPageZoneDao {
     NewPageAdvertisementImage getAdvertisementForm(Integer id);
     NewPageAdvertisementImage getAdvertisementForm(Integer id);
 
 
     NewPageTopAdvertisementImage getTopAdvertisementForm(Integer id);
     NewPageTopAdvertisementImage getTopAdvertisementForm(Integer id);
+
+    List<Product> selectProductList(@Param("id") Integer id, @Param("productId") Integer productId, @Param("shopName") String shopName, @Param("productName") String productName);
 }
 }

+ 2 - 0
src/main/java/com/caimei365/manager/service/caimei/page/NewPageZoneService.java

@@ -75,4 +75,6 @@ public interface NewPageZoneService {
     ResponseJson<NewPageAdvertisementImage> advertisementForm(Integer id);
     ResponseJson<NewPageAdvertisementImage> advertisementForm(Integer id);
 
 
     ResponseJson<NewPageTopAdvertisementImage> topAdvertisementForm(Integer id);
     ResponseJson<NewPageTopAdvertisementImage> topAdvertisementForm(Integer id);
+
+    ResponseJson<PaginationVo<Product>> selectProductList(Integer id, Integer productId, String shopName, String productName, int pageNum, int pageSize);
 }
 }

+ 8 - 0
src/main/java/com/caimei365/manager/service/caimei/page/impl/NewPageZoneServiceImpl.java

@@ -310,6 +310,14 @@ public class NewPageZoneServiceImpl implements NewPageZoneService {
         return ResponseJson.success(zoneDao.getTopAdvertisementForm(id));
         return ResponseJson.success(zoneDao.getTopAdvertisementForm(id));
     }
     }
 
 
+    @Override
+    public ResponseJson<PaginationVo<Product>> selectProductList(Integer id, Integer productId, String shopName, String productName, int pageNum, int pageSize) {
+        PageHelper.startPage(pageNum, pageSize);
+        List<Product> products = zoneDao.selectProductList(id, productId, shopName, productName);
+        PaginationVo<Product> page = new PaginationVo<>(products);
+        return ResponseJson.success(page);
+    }
+
     public void cleanRedisCache() {
     public void cleanRedisCache() {
         //首页缓存
         //首页缓存
         redisService.removePattern("getHomeCommodityData*");
         redisService.removePattern("getHomeCommodityData*");

+ 20 - 0
src/main/resources/mapper/page/NewPageZoneDao.xml

@@ -370,4 +370,24 @@
         from new_page_top_advertisement
         from new_page_top_advertisement
         where id = #{id}
         where id = #{id}
     </select>
     </select>
+
+    <select id="selectProductList" resultType="com.caimei365.manager.entity.caimei.product.Product">
+        SELECT p.mainImage, p.name, p.productId, s.name AS shopName
+        FROM product p
+        LEFT JOIN shop s ON p.shopId = s.shopId
+        LEFT JOIN new_page_zone_product npz ON npz.productId = p.productID AND npz.zoneId = #{id}
+        WHERE p.productCategory = 1
+        and npz.productId is null
+        <if test="shopName !=''">
+            AND s.name like concat('%',#{shopName},'%')
+        </if>
+        <if test="shopName !=''">
+            AND p.name like concat('%',#{productName},'%')
+        </if>
+        <if test="productId != null">
+            AND p.productId = #{productId}
+        </if>
+        GROUP BY p.productID
+        ORDER BY p.productID desc
+    </select>
 </mapper>
 </mapper>