Sfoglia il codice sorgente

feat(web): 添加新闻分类查询功能

- 在WebSiteController中为getNewsUpdatesListWithoutSpecialNews方法添加newsCategory参数
- 更新WebSiteService接口以支持新闻分类查询
- 在WebSiteServiceImpl中实现新闻分类过滤逻辑
- 修改banner.txt文件更新应用启动图标显示
- 添加StringUtils工具类用于字符串非空检查
nahida 1 mese fa
parent
commit
c918c0626b

+ 3 - 2
zksy-admin/src/main/java/com/zksy/web/controller/base/WebSiteController.java

@@ -62,9 +62,10 @@ public class WebSiteController {
     @Anonymous
     public AjaxResult getNewsUpdatesListWithoutSpecialNews(
             Integer pageNum,
-            Integer pageSize
+            Integer pageSize,
+            @RequestParam(required = false) String newsCategory
     ) {
-        return AjaxResult.success(webSiteService.getNewsUpdatesListWithoutSpecialNews(pageNum, pageSize));
+        return AjaxResult.success(webSiteService.getNewsUpdatesListWithoutSpecialNews(pageNum, pageSize, newsCategory));
     }
 
     @GetMapping("/getSpecialNewsUpdatesList")

+ 19 - 22
zksy-admin/src/main/resources/banner.txt

@@ -1,24 +1,21 @@
 Application Version: ${zksy.version}
 Spring Boot Version: ${spring-boot.version}
-////////////////////////////////////////////////////////////////////
-//                          _ooOoo_                               //
-//                         o8888888o                              //
-//                         88" . "88                              //
-//                         (| ^_^ |)                              //
-//                         O\  =  /O                              //
-//                      ____/`---'\____                           //
-//                    .'  \\|     |//  `.                         //
-//                   /  \\|||  :  |||//  \                        //
-//                  /  _||||| -:- |||||-  \                       //
-//                  |   | \\\  -  /// |   |                       //
-//                  | \_|  ''\---/''  |   |                       //
-//                  \  .-\__  `-`  ___/-. /                       //
-//                ___`. .'  /--.--\  `. . ___                     //
-//              ."" '<  `.___\_<|>_/___.'  >'"".                  //
-//            | | :  `- \`.;`\ _ /`;.`/ - ` : | |                 //
-//            \  \ `-.   \_ __\ /__ _/   .-` /  /                 //
-//      ========`-.____`-.___\_____/___.-`____.-'========         //
-//                           `=---='                              //
-//      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^        //
-//             佛祖保佑       永不宕机      永无BUG               //
-////////////////////////////////////////////////////////////////////
+//////////////////////////////////////////////////////////////////////////
+//     #     #          #                #########           #          //
+//     #     #          #                #       #           #          //
+//     #  #  #          #        #       #########           #          //
+//     #  #  #  #       ###########      #       #           #     #    //
+//   # ## ########      #                #########      #############   //
+//   # # #   #          #                  #   #             #     #    //
+//   # # #   #          #        #     #############         #     #    //
+//  #  ##    #          ###########        #   #             #     #    //
+//     #     # #                 #    ###############        #     #    //
+//     #  #######                #         #   #             #     #    //
+//     #     #                #  #        #  #  #            #     #    //
+//     #     #       ########### #      ## # # # ####       #      #    //
+//     #     #                   #    ##    ###    #        #      #    //
+//     #     #   #               #        #  #  #          #   #   #    //
+//     ############           # #        #   #   #         #    # #     //
+//     #                       #            ##          ###      #      //
+//                                                                      //
+//////////////////////////////////////////////////////////////////////////

+ 1 - 1
zksy-system/src/main/java/com/zksy/base/service/WebSiteService.java

@@ -18,7 +18,7 @@ public interface WebSiteService {
 
     List<BasicInfo> getBasicInfo();
 
-    Page<NewsUpdates> getNewsUpdatesListWithoutSpecialNews(Integer pageNum, Integer pageSize);
+    Page<NewsUpdates> getNewsUpdatesListWithoutSpecialNews(Integer pageNum, Integer pageSize, String newsCategory);
 
     Page<NewsUpdates> getSpecialNewsUpdatesList(Integer pageNum, Integer pageSize);
 

+ 6 - 1
zksy-system/src/main/java/com/zksy/base/service/impl/WebSiteServiceImpl.java

@@ -1,6 +1,7 @@
 package com.zksy.base.service.impl;
 
 import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
+import com.baomidou.mybatisplus.core.toolkit.StringUtils;
 import com.baomidou.mybatisplus.core.toolkit.Wrappers;
 import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
 import com.zksy.base.domain.*;
@@ -10,6 +11,7 @@ import com.zksy.base.service.BasicInfoService;
 import com.zksy.base.service.MessageDataService;
 import com.zksy.base.service.QualificationCertificateService;
 import com.zksy.base.service.WebSiteService;
+import org.apache.poi.util.StringUtil;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
 
@@ -67,7 +69,10 @@ public class WebSiteServiceImpl implements WebSiteService {
     }
 
     @Override
-    public Page<NewsUpdates> getNewsUpdatesListWithoutSpecialNews(Integer pageNum, Integer pageSize) {
+    public Page<NewsUpdates> getNewsUpdatesListWithoutSpecialNews(Integer pageNum, Integer pageSize, String newsCategory) {
+        if(StringUtils.isNotBlank(newsCategory)){
+            return newsUpdatesMapper.selectPage(new Page<>(pageNum, pageSize), Wrappers.lambdaQuery(NewsUpdates.class).eq(NewsUpdates::getNewsCategory, newsCategory).eq(NewsUpdates::getIsSpecial, false).orderByDesc(NewsUpdates::getCreateTime));
+        }
         return newsUpdatesMapper.selectPage(new Page<>(pageNum, pageSize), Wrappers.lambdaQuery(NewsUpdates.class).eq(NewsUpdates::getIsSpecial, false).orderByDesc(NewsUpdates::getCreateTime));
     }