qinhouyu 1 gadu atpakaļ
vecāks
revīzija
fc3f31a40a

+ 6 - 6
ruoyi-admin/src/main/java/com/ruoyi/web/controller/highServer/JnbHighServerController.java

@@ -59,9 +59,9 @@ public class JnbHighServerController extends BaseController {
     /**
      * 获取高频服务详细信息
      */
-    @GetMapping(value = "/{id}")
-    public AjaxResult getInfo(@PathVariable("id") Long id) {
-        return success(jnbHighServerService.selectJnbHighServerById(id));
+    @GetMapping(value = "/{id}/{type}")
+    public AjaxResult getInfo(@PathVariable("id") Long id,@PathVariable("type") Integer type) {
+        return success(jnbHighServerService.selectJnbHighServerById(id,type));
     }
 
     /**
@@ -86,8 +86,8 @@ public class JnbHighServerController extends BaseController {
      * 删除高频服务
      */
     @Log(title = "高频服务", businessType = BusinessType.DELETE)
-    @DeleteMapping("/{ids}")
-    public AjaxResult remove(@PathVariable Long[] ids) {
-        return toAjax(jnbHighServerService.deleteJnbHighServerByIds(ids));
+    @DeleteMapping("/{ids}/{type}")
+    public AjaxResult remove(@PathVariable Long[] ids,@PathVariable("type") Integer type) {
+        return toAjax(jnbHighServerService.deleteJnbHighServerByIds(ids,type));
     }
 }

+ 32 - 6
ruoyi-admin/src/main/java/com/ruoyi/web/controller/information/InformationController.java

@@ -47,6 +47,32 @@ public class InformationController extends BaseController
         return getDataTable(list);
     }
 
+
+    /**
+     * 查询前三条-小程序
+     */
+    @PreAuthorize("@ss.hasPermi('jnb:information:query')")
+    @GetMapping("/listWx")
+    public TableDataInfo listWx(Information information)
+    {
+        startPage();
+        List<Information> list = informationService.selectInformationListWx(information);
+        return getDataTable(list);
+    }
+
+    /**
+     * 查询文章列表包括置顶-小程序
+     */
+    @PreAuthorize("@ss.hasPermi('jnb:information:query')")
+    @GetMapping("/listWxs")
+    public TableDataInfo listWxs(Information information)
+    {
+        startPage();
+        List<Information> list = informationService.selectInformationListWxs(information);
+        return getDataTable(list);
+    }
+
+
     /**
      * 导出资讯列表
      */
@@ -64,10 +90,10 @@ public class InformationController extends BaseController
      * 获取资讯详细信息
      */
     @PreAuthorize("@ss.hasPermi('jnb:information:query')")
-    @GetMapping(value = "/{id}")
-    public AjaxResult getInfo(@PathVariable("id") Long id)
+    @GetMapping(value = "/{id}/{type}")
+    public AjaxResult getInfo(@PathVariable("id") Long id,@PathVariable("type") Integer type)
     {
-        return success(informationService.selectInformationById(id));
+        return success(informationService.selectInformationById(id,type));
     }
 
     /**
@@ -97,9 +123,9 @@ public class InformationController extends BaseController
      */
     @PreAuthorize("@ss.hasPermi('jnb:information:remove')")
     @Log(title = "删除资讯", businessType = BusinessType.DELETE)
-	@DeleteMapping("/{ids}")
-    public AjaxResult remove(@PathVariable Long[] ids)
+	@DeleteMapping("/{ids}/{type}")
+    public AjaxResult remove(@PathVariable("ids") Long[] ids,@PathVariable("type") Integer type)
     {
-        return toAjax(informationService.deleteInformationByIds(ids));
+        return toAjax(informationService.deleteInformationByIds(ids,type));
     }
 }

+ 1 - 1
ruoyi-admin/src/main/resources/application.yml

@@ -22,7 +22,7 @@ fileServer:
 # 开发环境配置
 server:
   # 服务器的HTTP端口,默认为8080
-  port: 8080
+  port: 40000
   servlet:
     # 应用的访问路径
     context-path: /

+ 3 - 3
sooka-jnb/src/main/java/com/sooka/jnb/highServer/mapper/JnbHighServerImgMapper.java

@@ -9,10 +9,10 @@ import java.util.List;
 
 public interface JnbHighServerImgMapper {
 
-    public int deleteJnbHighServerByServerIds(Long[] serverId);
-    public int deleteJnbHighServerByServerId(@Param("serverId") Long serverId);
+    public int deleteJnbHighServerByServerIds(@Param("serverId") Long[] serverId,@Param("type") Integer type);
+    public int deleteJnbHighServerByServerId(@Param("serverId") Long serverId,@Param("type") Integer type);
 
     int saveJnbHighServerImg(List<JnbHighServerImg> saveList);
 
-    String selectAll(Long serverId);
+    String selectAll(Long serverId,Integer type);
 }

+ 3 - 3
sooka-jnb/src/main/java/com/sooka/jnb/highServer/mapper/JnbHighServerMapper.java

@@ -18,7 +18,7 @@ public interface JnbHighServerMapper {
      * @param id 高频服务主键
      * @return 高频服务
      */
-    public JnbHighServerVO selectJnbHighServerById(Long id);
+    public JnbHighServerVO selectJnbHighServerById(Long id,Integer type);
 
     /**
      * 查询高频服务列表
@@ -50,7 +50,7 @@ public interface JnbHighServerMapper {
      * @param id 高频服务主键
      * @return 结果
      */
-    public int deleteJnbHighServerById(Long id);
+    public int deleteJnbHighServerById(Long id,Integer type);
 
     /**
      * 批量删除高频服务
@@ -58,5 +58,5 @@ public interface JnbHighServerMapper {
      * @param ids 需要删除的数据主键集合
      * @return 结果
      */
-    public int deleteJnbHighServerByIds(Long[] ids);
+    public int deleteJnbHighServerByIds(Long[] ids,Integer type);
 }

+ 3 - 3
sooka-jnb/src/main/java/com/sooka/jnb/highServer/service/IJnbHighServerService.java

@@ -18,7 +18,7 @@ public interface IJnbHighServerService {
      * @param id 高频服务主键
      * @return 高频服务
      */
-    public JnbHighServerVO selectJnbHighServerById(Long id);
+    public JnbHighServerVO selectJnbHighServerById(Long id,Integer type);
 
     /**
      * 查询高频服务列表
@@ -50,7 +50,7 @@ public interface IJnbHighServerService {
      * @param ids 需要删除的高频服务主键集合
      * @return 结果
      */
-    public int deleteJnbHighServerByIds(Long[] ids);
+    public int deleteJnbHighServerByIds(Long[] ids,Integer type);
 
     /**
      * 删除高频服务信息
@@ -58,5 +58,5 @@ public interface IJnbHighServerService {
      * @param id 高频服务主键
      * @return 结果
      */
-    public int deleteJnbHighServerById(Long id);
+    public int deleteJnbHighServerById(Long id,Integer type);
 }

+ 8 - 8
sooka-jnb/src/main/java/com/sooka/jnb/highServer/service/impl/JnbHighServerServiceImpl.java

@@ -38,8 +38,8 @@ public class JnbHighServerServiceImpl implements IJnbHighServerService {
      * @return 高频服务
      */
     @Override
-    public JnbHighServerVO selectJnbHighServerById(Long id) {
-        return jnbHighServerMapper.selectJnbHighServerById(id);
+    public JnbHighServerVO selectJnbHighServerById(Long id,Integer type) {
+        return jnbHighServerMapper.selectJnbHighServerById(id,type);
     }
 
     /**
@@ -91,7 +91,7 @@ public class JnbHighServerServiceImpl implements IJnbHighServerService {
         jnbHighServerVO.setUpdateTime(DateUtils.getNowDate());
         jnbHighServerMapper.updateJnbHighServer(jnbHighServerVO);
         if (StringUtils.isNotEmpty(jnbHighServerVO.getImgUrlList())) {
-            jnbHighServerImgMapper.deleteJnbHighServerByServerId(jnbHighServerVO.getId());
+            jnbHighServerImgMapper.deleteJnbHighServerByServerId(jnbHighServerVO.getId(),jnbHighServerVO.getType());
             List<String> imgUrlArray = Arrays.asList(jnbHighServerVO.getImgUrlList().split(","));
             List<JnbHighServerImg> saveList = new ArrayList<>();
             for (int i = 0; i < imgUrlArray.size(); i++) {
@@ -114,9 +114,9 @@ public class JnbHighServerServiceImpl implements IJnbHighServerService {
      */
     @Override
     @Transactional(rollbackFor = Exception.class)
-    public int deleteJnbHighServerByIds(Long[] ids) {
-        jnbHighServerImgMapper.deleteJnbHighServerByServerIds(ids);
-        return jnbHighServerMapper.deleteJnbHighServerByIds(ids);
+    public int deleteJnbHighServerByIds(Long[] ids,Integer type) {
+        jnbHighServerImgMapper.deleteJnbHighServerByServerIds(ids,type);
+        return jnbHighServerMapper.deleteJnbHighServerByIds(ids,type);
     }
 
     /**
@@ -126,7 +126,7 @@ public class JnbHighServerServiceImpl implements IJnbHighServerService {
      * @return 结果
      */
     @Override
-    public int deleteJnbHighServerById(Long id) {
-        return jnbHighServerMapper.deleteJnbHighServerById(id);
+    public int deleteJnbHighServerById(Long id,Integer type) {
+        return jnbHighServerMapper.deleteJnbHighServerById(id,type);
     }
 }

+ 18 - 3
sooka-jnb/src/main/java/com/sooka/jnb/information/mapper/InformationMapper.java

@@ -1,6 +1,7 @@
 package com.sooka.jnb.information.mapper;
 
 import com.sooka.jnb.information.domain.Information;
+import org.apache.ibatis.annotations.Param;
 
 import java.util.List;
 
@@ -18,7 +19,7 @@ public interface InformationMapper
      * @param id 资讯主键
      * @return 资讯
      */
-    public Information selectInformationById(Long id);
+    public Information selectInformationById(@Param("id") Long id, @Param("type") Integer type);
 
     /**
      * 查询资讯列表
@@ -50,7 +51,7 @@ public interface InformationMapper
      * @param id 资讯主键
      * @return 结果
      */
-    public int deleteInformationById(Long id);
+    public int deleteInformationById(@Param("id") Long id, @Param("type") Integer type);
 
     /**
      * 批量删除资讯
@@ -58,5 +59,19 @@ public interface InformationMapper
      * @param ids 需要删除的数据主键集合
      * @return 结果
      */
-    public int deleteInformationByIds(Long[] ids);
+    public int deleteInformationByIds(@Param("ids") Long[] ids, @Param("type") Integer type);
+
+    /**
+     * 文章列表
+     * @param information 按照时间,点赞,浏览 排序
+     * @return 结果
+     */
+    List<Information> selectInformationListWxs(Information information);
+
+    /**
+     * 置顶,政策推荐 3个
+     * @param information
+     * @return 结果
+     */
+    List<Information> selectInformationListWx(Information information);
 }

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

@@ -19,7 +19,7 @@ public interface InformationService
      * @param id 资讯主键
      * @return 资讯
      */
-    public Information selectInformationById(Long id);
+    public Information selectInformationById(Long id,Integer type);
 
     /**
      * 查询资讯服务列表
@@ -29,6 +29,9 @@ public interface InformationService
      */
     public List<Information> selectInformationList(Information information);
 
+    public List<Information> selectInformationListWx(Information information);
+
+
     /**
      * 新增资讯
      * 
@@ -51,7 +54,7 @@ public interface InformationService
      * @param ids 需要删除的资讯主键集合
      * @return 结果
      */
-    public int deleteInformationByIds(Long[] ids);
+    public int deleteInformationByIds(Long[] ids,Integer type);
 
-    public int deleteInformationById(Long id);
+    List<Information> selectInformationListWxs(Information information);
 }

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

@@ -32,10 +32,10 @@ public class InformationServiceImpl implements InformationService
     private JnbHighServerImgMapper jnbHighServerImgMapper;
 
     @Override
-    public Information selectInformationById(Long id)
+    public Information selectInformationById(Long id,Integer type)
     {
-        Information information = informationMapper.selectInformationById(id);
-        information.setImgUrlList(jnbHighServerImgMapper.selectAll(id));
+        Information information = informationMapper.selectInformationById(id,type);
+        information.setImgUrlList(jnbHighServerImgMapper.selectAll(id,information.getType()));
         return information;
     }
 
@@ -46,6 +46,17 @@ public class InformationServiceImpl implements InformationService
         return informationMapper.selectInformationList(information);
     }
 
+    @Override
+    public List<Information> selectInformationListWx(Information information)
+    {
+        return informationMapper.selectInformationListWx(information);
+    }
+    @Override
+    public List<Information> selectInformationListWxs(Information information)
+    {
+        return informationMapper.selectInformationListWx(information);
+    }
+
 
     @Override
     @Transactional(rollbackFor = Exception.class)
@@ -64,6 +75,7 @@ public class InformationServiceImpl implements InformationService
                     serverImg.setCreateTime(DateUtils.getNowDate());
                     serverImg.setServerId(entity.getId());
                     serverImg.setImgUrl(a);
+                    serverImg.setType(entity.getType());
                     imgList.add(serverImg);
                 });
                 jnbHighServerImgMapper.saveJnbHighServerImg(imgList);
@@ -77,20 +89,20 @@ public class InformationServiceImpl implements InformationService
     @Transactional(rollbackFor = Exception.class)
     public int updateInformation(Information entity)
     {
-        BeanUtils.copyProperties(entity,entity);
         entity.setUpdateTime(DateUtils.getNowDate());
         entity.setUpdateBy(String.valueOf(SecurityUtils.getUserId()));
         int i = informationMapper.updateInformation(entity);
         List<String> imgUrlList = Arrays.asList(entity.getImgUrlList().split(","));
             if (!ObjectUtils.isEmpty(imgUrlList)){
                 List<JnbHighServerImg> imgList = new ArrayList<>();
-                jnbHighServerImgMapper.deleteJnbHighServerByServerId(entity.getId());
+                jnbHighServerImgMapper.deleteJnbHighServerByServerId(entity.getId(),entity.getType());
                 imgUrlList.forEach(a->{
                     JnbHighServerImg serverImg = new JnbHighServerImg();
                     serverImg.setCreateBy(String.valueOf(SecurityUtils.getUserId()));
                     serverImg.setCreateTime(DateUtils.getNowDate());
                     serverImg.setServerId(entity.getId());
                     serverImg.setImgUrl(a);
+                    serverImg.setType(entity.getType());
                     imgList.add(serverImg);
                 });
                 jnbHighServerImgMapper.saveJnbHighServerImg(imgList);
@@ -101,23 +113,13 @@ public class InformationServiceImpl implements InformationService
 
     @Override
     @Transactional(rollbackFor = Exception.class)
-    public int deleteInformationByIds(Long[] ids)
+    public int deleteInformationByIds(Long[] ids,Integer type)
     {
-        int i = informationMapper.deleteInformationByIds(ids);
+        int i = informationMapper.deleteInformationByIds(ids,type);
         if (i>0){
-            jnbHighServerImgMapper.deleteJnbHighServerByServerIds(ids);
+            jnbHighServerImgMapper.deleteJnbHighServerByServerIds(ids,type);
         }
         return i;
     }
 
-    @Override
-    @Transactional(rollbackFor = Exception.class)
-    public int deleteInformationById(Long id)
-    {
-        int i = informationMapper.deleteInformationById(id);
-        if (i>0){
-            jnbHighServerImgMapper.deleteJnbHighServerByServerId(id);
-        }
-        return i;
-    }
 }

+ 7 - 4
sooka-jnb/src/main/resources/mapper/highServer/JnbHighServerImgMapper.xml

@@ -5,13 +5,13 @@
 <mapper namespace="com.sooka.jnb.highServer.mapper.JnbHighServerImgMapper">
 
     <delete id="deleteJnbHighServerByServerIds" parameterType="String">
-        update jnb_high_server_img set del_flag = 1 where server_id in
+        update jnb_high_server_img set del_flag = 1 where type = #{type} and server_id in
         <foreach item="serverId" collection="array" open="(" separator="," close=")">
             #{serverId}
         </foreach>
     </delete>
     <delete id="deleteJnbHighServerByServerId">
-        update jnb_high_server_img set del_flag = 1 where server_id = #{serverId}
+        update jnb_high_server_img set del_flag = 1 where server_id = #{serverId} and  type = #{type}
     </delete>
     <insert id="saveJnbHighServerImg" parameterType="java.lang.Integer">
         insert into jnb_high_server_img (server_id,img_url,type,create_by,update_by,update_time,create_time) values
@@ -20,9 +20,12 @@
         </foreach>
     </insert>
     <select id="selectAll" resultType="java.lang.String">
-        select group_concat(img_url) from jnb_high_server_img where del_flag = 0
+        select group_concat(img_url) from jnb_high_server_img where del_flag = 0 and type = #{type}
         <if test="serverId != null and serverId !=''">
-           and server_id = #{serverid}
+           and server_id = #{serverId}
+        </if>
+        <if test="type != null and type !=''">
+            and type = #{type}
         </if>
     </select>
 </mapper>

+ 5 - 5
sooka-jnb/src/main/resources/mapper/highServer/JnbHighServerMapper.xml

@@ -30,7 +30,7 @@
                GROUP_CONCAT(jhsi.img_url)  AS imgUrlList
         FROM jnb_high_server jhs
                  left JOIN jnb_high_server_img jhsi ON jhs.id = jhsi.server_id and jhs.type = jhsi.type and jhsi.del_flag = 0
-        where jhs.del_flag = 0
+        where jhs.del_flag = 0 and jhs.type = #{type}
     </sql>
 
     <select id="selectJnbHighServerList" resultType="com.sooka.jnb.highServer.vo.JnbHighServerVO">
@@ -43,7 +43,7 @@
 
     <select id="selectJnbHighServerById" resultType="com.sooka.jnb.highServer.vo.JnbHighServerVO">
         <include refid="selectJnbHighServerVo"/>
-        and jhs.id = #{id}
+        and jhs.id = #{id} and jhs.type = #{type}
         GROUP BY jhs.id
     </select>
 
@@ -83,17 +83,17 @@
             <if test="updateBy != null">update_by = #{updateBy},</if>
             <if test="updateTime != null">update_time = #{updateTime},</if>
         </trim>
-        where id = #{id}
+        where id = #{id} and type = #{type}
     </update>
 
     <delete id="deleteJnbHighServerById" parameterType="Long">
         delete
         from jnb_high_server
-        where id = #{id}
+        where id = #{id} and type = #{type}
     </delete>
 
     <delete id="deleteJnbHighServerByIds" parameterType="String">
-        update jnb_high_server set del_flag = 1 where id in
+        update jnb_high_server set del_flag = 1 where type = #{type} and id in
         <foreach item="id" collection="array" open="(" separator="," close=")">
             #{id}
         </foreach>

+ 53 - 5
sooka-jnb/src/main/resources/mapper/information/InformationMapper.xml

@@ -38,6 +38,53 @@
     </sql>
 
     <select id="selectInformationList" parameterType="Information" resultMap="InformationResult">
+        select id,
+        title_name,
+        text_details,
+        type,
+        create_by,
+        create_time,
+        update_by,
+        update_time,
+        del_flag,
+        is_government,
+        is_top,
+        like_num,
+        watch_num
+        from jnb_high_server
+        <where>
+            <if test="titleName != null  and titleName != ''">and title_name like concat('%', #{titleName}, '%')</if>
+            <if test="type != null and type != ''">and type = #{type}</if>
+            <if test="isGovernment != null and isGovernment != ''">and is_government = #{isGovernment}</if>
+            <if test="isTop != null and isTop != ''">and is_top = #{isTop}</if>
+            and del_flag = 0
+        </where>
+        order by create_time desc
+    </select>
+
+    <select id="selectInformationListWxs" parameterType="Information" resultMap="InformationResult">
+        <include refid="selectInformationVo"/>
+        <where>
+            <if test="titleName != null  and titleName != ''">and title_name like concat('%', #{titleName}, '%')</if>
+            <if test="type != null and type != ''">and type = #{type}</if>
+            <if test="isGovernment != null and isGovernment != ''">and is_government = #{isGovernment}</if>
+            <if test="isTop != null and isTop != ''">and is_top = #{isTop}</if>
+            and del_flag = 0
+        </where>
+        <choose>
+            <when test="flag == like">
+                ORDER BY like_num DESC
+            </when>
+            <when test="flag == watch">
+                ORDER BY watch_num DESC
+            </when>
+            <otherwise>
+                ORDER BY create_time DESC
+            </otherwise>
+        </choose>
+    </select>
+
+    <select id="selectInformationListWx" parameterType="Information" resultMap="InformationResult">
         <include refid="selectInformationVo"/>
         <where>
             <if test="titleName != null  and titleName != ''">and title_name like concat('%', #{titleName}, '%')</if>
@@ -46,11 +93,12 @@
             <if test="isTop != null and isTop != ''">and is_top = #{isTop}</if>
             and del_flag = 0
         </where>
+        order by create_time desc limit 3
     </select>
 
     <select id="selectInformationById" parameterType="Long" resultMap="InformationResult">
         <include refid="selectInformationVo"/>
-        where id = #{id}
+        where id = #{id} and type = #{type}
     </select>
 
     <insert id="insertInformation" parameterType="Information" useGeneratedKeys="true" keyProperty="id">
@@ -78,22 +126,22 @@
             <if test="isGovernment != null">is_government=#{isGovernment},</if>
             <if test="delFlag != null">del_flag=#{delFlag}</if>
         </trim>
-        where id = #{id}
+        where id = #{id} and type = #{type}
     </update>
 
     <update id="deleteInformationById" parameterType="Long">
         UPDATE jnb_high_server
         SET del_flag = 2
-        WHERE id = #{id};
+        WHERE id = #{id} and type = #{type}
     </update>
 
     <delete id="deleteInformationByIds" parameterType="Long">
         UPDATE jnb_high_server
         SET del_flag = 2
-        WHERE id IN
+        WHERE  type = #{type} and id IN
         <foreach item="id" collection="array" open="(" separator="," close=")">
             #{id}
-        </foreach>;
+        </foreach>
 
     </delete>
 </mapper>