From adaf5cc3331c620f965282dc6d8fc2c1a75a4934 Mon Sep 17 00:00:00 2001 From: retire Date: Mon, 23 Sep 2019 23:20:22 +0800 Subject: [PATCH] jpress3 --- .../module/product/model/ProductComment.java | 5 ++++- .../product/service/ProductCommentService.java | 14 ++++++++++++++ .../ProductCommentServiceProvider.java | 13 +++++++++++++ .../controller/_ProductCommentController.java | 18 ++++++++++++++++++ .../views/admin/product/comment_list.html | 8 ++++---- 5 files changed, 53 insertions(+), 5 deletions(-) diff --git a/module-product/module-product-model/src/main/java/io/jpress/module/product/model/ProductComment.java b/module-product/module-product-model/src/main/java/io/jpress/module/product/model/ProductComment.java index 596eed728..012f8259b 100644 --- a/module-product/module-product-model/src/main/java/io/jpress/module/product/model/ProductComment.java +++ b/module-product/module-product-model/src/main/java/io/jpress/module/product/model/ProductComment.java @@ -11,5 +11,8 @@ public class ProductComment extends BaseProductComment { private static final long serialVersionUID = 1L; - + public static final String STATUS_NORMAL = "normal"; //正常 + public static final String STATUS_UNAUDITED = "unaudited"; //待审核 + public static final String STATUS_TRASH = "trash"; //垃圾箱 + } diff --git a/module-product/module-product-service-api/src/main/java/io/jpress/module/product/service/ProductCommentService.java b/module-product/module-product-service-api/src/main/java/io/jpress/module/product/service/ProductCommentService.java index de87f1ae7..55bc8a373 100644 --- a/module-product/module-product-service-api/src/main/java/io/jpress/module/product/service/ProductCommentService.java +++ b/module-product/module-product-service-api/src/main/java/io/jpress/module/product/service/ProductCommentService.java @@ -82,4 +82,18 @@ public interface ProductCommentService { public long findCountByProductId(Long productId); + /** + * batch del + * @param ids + * @return + */ + public boolean deleteByIds(Object... ids); + + + /** + * count + * @param status + * @return + */ + public long findCountByStatus(String status); } \ No newline at end of file diff --git a/module-product/module-product-service-provider/src/main/java/io/jpress/module/product/service/provider/ProductCommentServiceProvider.java b/module-product/module-product-service-provider/src/main/java/io/jpress/module/product/service/provider/ProductCommentServiceProvider.java index ffa5d87e8..0a666e910 100644 --- a/module-product/module-product-service-provider/src/main/java/io/jpress/module/product/service/provider/ProductCommentServiceProvider.java +++ b/module-product/module-product-service-provider/src/main/java/io/jpress/module/product/service/provider/ProductCommentServiceProvider.java @@ -13,4 +13,17 @@ public class ProductCommentServiceProvider extends JbootServiceBase entries = productCommentService.paginate(getPagePara(), 10); setAttr("page", entries); + + long unauditedCount = productCommentService.findCountByStatus(ProductComment.STATUS_UNAUDITED); + long trashCount = productCommentService.findCountByStatus(ProductComment.STATUS_TRASH); + long normalCount = productCommentService.findCountByStatus(ProductComment.STATUS_NORMAL); + + setAttr("unauditedCount", unauditedCount); + setAttr("trashCount", trashCount); + setAttr("normalCount", normalCount); + setAttr("totalCount", unauditedCount + trashCount + normalCount); + render("product/comment_list.html"); } @@ -62,4 +74,10 @@ public class _ProductCommentController extends AdminControllerBase { Long id = getIdPara(); render(productCommentService.deleteById(id) ? Ret.ok() : Ret.fail()); } + + public void doDelByIds(){ + + Set idsSet = getParaSet("ids"); + render(productCommentService.deleteByIds(idsSet.toArray()) ? OK : FAIL); + } } \ No newline at end of file diff --git a/module-product/module-product-web/src/main/webapp/WEB-INF/views/admin/product/comment_list.html b/module-product/module-product-web/src/main/webapp/WEB-INF/views/admin/product/comment_list.html index 640becafe..29fc7b0b9 100644 --- a/module-product/module-product-web/src/main/webapp/WEB-INF/views/admin/product/comment_list.html +++ b/module-product/module-product-web/src/main/webapp/WEB-INF/views/admin/product/comment_list.html @@ -4,7 +4,7 @@