qinhouyu 1 yıl önce
ebeveyn
işleme
4ae9e7a155

+ 4 - 2
ruoyi-admin/src/main/java/com/ruoyi/web/controller/information/InformationController.java

@@ -84,9 +84,11 @@ public class InformationController extends BaseController
      */
 //    @PreAuthorize("@ss.hasPermi('jnb:information:query')")
     @GetMapping("/listWxs")
-    public TableDataInfo listWxs(Information information, Integer pageNum,Integer pageSize)
+    public TableDataInfo listWxs(Information information)
     {
-        return informationService.selectInformationListWxs(information,pageNum,pageSize);
+        startPage();
+        List<Information> list = informationService.selectInformationListWxs(information);
+        return getDataTable(list);
     }
 
 

+ 1 - 3
sooka-jnb/src/main/java/com/sooka/jnb/information/domain/Information.java

@@ -1,11 +1,9 @@
 package com.sooka.jnb.information.domain;
 
 import com.baomidou.mybatisplus.annotation.TableField;
-import lombok.Data;
-import org.apache.commons.lang3.builder.ToStringBuilder;
-import org.apache.commons.lang3.builder.ToStringStyle;
 import com.ruoyi.common.annotation.Excel;
 import com.ruoyi.common.core.domain.BaseEntity;
+import lombok.Data;
 
 import javax.validation.constraints.NotBlank;
 import java.util.List;

+ 1 - 2
sooka-jnb/src/main/java/com/sooka/jnb/information/mapper/InformationMapper.java

@@ -1,6 +1,5 @@
 package com.sooka.jnb.information.mapper;
 
-import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
 import com.sooka.jnb.information.domain.Information;
 import org.apache.ibatis.annotations.Param;
 
@@ -67,7 +66,7 @@ public interface InformationMapper
      * @param information 按照时间,点赞,浏览 排序
      * @return 结果
      */
-    List<Information> selectInformationListWxs(@Param("obj") Information information, @Param("pageNum") Integer pageNum, @Param("pageSize") Integer pageSize);
+    List<Information> selectInformationListWxs(@Param("obj") Information information);
 
     /**
      * 置顶,政策推荐 3个

+ 1 - 3
sooka-jnb/src/main/java/com/sooka/jnb/information/service/InformationService.java

@@ -1,7 +1,5 @@
 package com.sooka.jnb.information.service;
 
-import com.github.pagehelper.Page;
-import com.ruoyi.common.core.page.TableDataInfo;
 import com.sooka.jnb.information.domain.Information;
 import com.sooka.jnb.information.domain.InformationUni;
 
@@ -74,7 +72,7 @@ public interface InformationService
      */
     public int deleteInformationByIds(Long[] ids,Integer type);
 
-    TableDataInfo selectInformationListWxs(Information information, Integer pageNum, Integer pageSize);
+    List<Information> selectInformationListWxs(Information information);
 
     int likeById(Information information);
     int watchById(Information information);

+ 18 - 19
sooka-jnb/src/main/java/com/sooka/jnb/information/service/impl/InformationServiceImpl.java

@@ -1,12 +1,5 @@
 package com.sooka.jnb.information.service.impl;
 
-import java.util.ArrayList;
-import java.util.Arrays;
-import java.util.List;
-import java.util.stream.Collectors;
-
-import com.github.pagehelper.Page;
-import com.ruoyi.common.core.page.TableDataInfo;
 import com.ruoyi.common.utils.DateUtils;
 import com.ruoyi.common.utils.SecurityUtils;
 import com.sooka.jnb.highServer.domain.JnbHighServerImg;
@@ -21,6 +14,11 @@ import org.springframework.stereotype.Service;
 import org.springframework.transaction.annotation.Transactional;
 import org.springframework.util.ObjectUtils;
 
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.List;
+import java.util.stream.Collectors;
+
 /**
  * 高频服务Service业务层处理
  * 
@@ -69,21 +67,22 @@ public class InformationServiceImpl implements InformationService
         }).collect(Collectors.toList());
     }
     @Override
-    public TableDataInfo selectInformationListWxs(Information information, Integer pageNum, Integer pageSize)
+    public List<Information> selectInformationListWxs(Information information)
     {
-//        List<Information> result = informationMapper.selectInformationListWxs(information,pageNum, pageSize);
-        System.out.println(information.getIsTop());
-        List<Information> toolForAbsenteeism = informationMapper.selectInformationListWxs(information,pageNum, pageSize);
-        TableDataInfo tableDataInfo = new TableDataInfo();
-        tableDataInfo.setRows(toolForAbsenteeism.stream() .skip((long) (pageNum - 1) * pageSize)
-                .limit(pageSize)
-                .collect(Collectors.toList()));
-        tableDataInfo.setTotal(toolForAbsenteeism.size());
-        tableDataInfo.setCode(200);
-        tableDataInfo.setMsg("查询成功");
-        return tableDataInfo;
+        List<Information> list = informationMapper.selectInformationListWxs(information);
+        for (Information information1 : list) {
+            if (information1.getImgUrlList()!=null){
+                String[] split = information1.getImgUrlList().split(",");
+                information1.setUrls(Arrays.asList(split));
+            }
+            else {
+                information1.setUrls(new ArrayList<>(0));
+            }
+        }
+        return list;
     }
 
+
     @Override
     public int likeById(Information information) {
        return informationMapper.updateInformationLike(information);

+ 6 - 7
sooka-jnb/src/main/resources/mapper/information/InformationMapper.xml

@@ -81,9 +81,7 @@
         <result property="updateBy" column="update_by"/>
         <result property="updateTime" column="update_time"/>
         <result property="delFlag" column="del_flag"/>
-        <collection property="urls" ofType="java.lang.String">
-            <result column="url" property="url"/>
-        </collection>
+        <result property="imgUrlList" column="imgUrlList"/>
     </resultMap>
 
     <select id="selectInformationListWxs"  resultMap="InformationResult1">
@@ -101,14 +99,15 @@
         a.is_top,
         a.like_num,
         a.watch_num,
-        i.img_url AS url
+        group_concat(i.img_url) AS imgUrlList
         FROM jnb_high_server AS a
         LEFT JOIN jnb_high_server_img AS i ON a.id = i.server_id AND i.del_flag = 0 AND i.type = #{obj.type}
         where a.del_flag = 0
-            <if test="obj.titleName != null  and obj.titleName != ''">and a.title_name like concat('%', #{obj.titleName}, '%')</if>
-            <if test="obj.type != null and obj.type != ''">and a.type = #{obj.type}</if>
+        <if test="obj.titleName != null  and obj.titleName != ''">and a.title_name like concat('%', #{obj.titleName}, '%')</if>
+        <if test="obj.type != null and obj.type != ''">and a.type = #{obj.type}</if>
         <if test="obj.isTop!=null">and a.is_top = #{obj.isTop}</if>
-            <if test="obj.isGovernment != null and obj.isGovernment != ''">and a.is_government = #{obj.isGovernment}</if>
+        <if test="obj.isGovernment != null and obj.isGovernment != ''">and a.is_government = #{obj.isGovernment}</if>
+        group by a.id
         <choose>
             <when test="obj.flag == 'like'">
                 ORDER BY a.like_num DESC