Administrator 2 жил өмнө
parent
commit
1e8771dfde

+ 10 - 0
ruoyi-admin/src/main/java/com/ruoyi/web/controller/system/XiaoyuanNoticeController.java

@@ -55,6 +55,16 @@ public class XiaoyuanNoticeController extends BaseController
         List<XiaoyuanNotice> list = xiaoyuanNoticeService.selectXiaoyuanNoticeMyList(xiaoyuanNotice);
         List<XiaoyuanNotice> list = xiaoyuanNoticeService.selectXiaoyuanNoticeMyList(xiaoyuanNotice);
         return getDataTable(list);
         return getDataTable(list);
     }
     }
+    /**
+     * 我的收藏
+     */
+    @GetMapping("/collect")
+    public TableDataInfo myCollect(XiaoyuanNotice xiaoyuanNotice)
+    {
+        startPage();
+        List<XiaoyuanNotice> list = xiaoyuanNoticeService.myCollect(xiaoyuanNotice);
+        return getDataTable(list);
+    }
 
 
     /**
     /**
      * 导出校园新闻列表
      * 导出校园新闻列表

+ 1 - 0
ruoyi-system/src/main/java/com/ruoyi/system/mapper/XiaoyuanNoticeMapper.java

@@ -27,6 +27,7 @@ public interface XiaoyuanNoticeMapper
      */
      */
     public List<XiaoyuanNotice> selectXiaoyuanNoticeList(XiaoyuanNotice xiaoyuanNotice);
     public List<XiaoyuanNotice> selectXiaoyuanNoticeList(XiaoyuanNotice xiaoyuanNotice);
     public List<XiaoyuanNotice> selectXiaoyuanNoticeMyList(XiaoyuanNotice xiaoyuanNotice);
     public List<XiaoyuanNotice> selectXiaoyuanNoticeMyList(XiaoyuanNotice xiaoyuanNotice);
+    public List<XiaoyuanNotice> selectXiaoyuanNoticeByMyCollect(XiaoyuanNotice xiaoyuanNotice);
 
 
     /**
     /**
      * 新增校园新闻
      * 新增校园新闻

+ 1 - 0
ruoyi-system/src/main/java/com/ruoyi/system/service/IXiaoyuanNoticeService.java

@@ -27,6 +27,7 @@ public interface IXiaoyuanNoticeService
      */
      */
     public List<XiaoyuanNotice> selectXiaoyuanNoticeList(XiaoyuanNotice xiaoyuanNotice);
     public List<XiaoyuanNotice> selectXiaoyuanNoticeList(XiaoyuanNotice xiaoyuanNotice);
     public List<XiaoyuanNotice> selectXiaoyuanNoticeMyList(XiaoyuanNotice xiaoyuanNotice);
     public List<XiaoyuanNotice> selectXiaoyuanNoticeMyList(XiaoyuanNotice xiaoyuanNotice);
+    public List<XiaoyuanNotice> myCollect(XiaoyuanNotice xiaoyuanNotice);
 
 
     /**
     /**
      * 新增校园新闻
      * 新增校园新闻

+ 13 - 0
ruoyi-system/src/main/java/com/ruoyi/system/service/impl/XiaoyuanNoticeServiceImpl.java

@@ -103,6 +103,19 @@ public class XiaoyuanNoticeServiceImpl implements IXiaoyuanNoticeService {
         return xiaoyuanNoticeMapper.selectXiaoyuanNoticeMyList(xiaoyuanNotice);
         return xiaoyuanNoticeMapper.selectXiaoyuanNoticeMyList(xiaoyuanNotice);
     }
     }
 
 
+    /**
+     * 我的收藏
+     * @param xiaoyuanNotice
+     * @return
+     */
+    @Override
+    public List<XiaoyuanNotice> myCollect(XiaoyuanNotice xiaoyuanNotice) {
+        SysUser user = SecurityUtils.getLoginUser().getUser();
+        Long userId = user.getUserId();
+        xiaoyuanNotice.setCollect("\"userId\":"+userId);
+        return  xiaoyuanNoticeMapper.selectXiaoyuanNoticeByMyCollect(xiaoyuanNotice);
+    }
+
     /**
     /**
      * 新增校园新闻
      * 新增校园新闻
      *
      *

+ 4 - 0
ruoyi-system/src/main/resources/mapper/system/XiaoyuanNoticeMapper.xml

@@ -71,6 +71,10 @@ WHERE
         <include refid="selectXiaoyuanNoticeVo"/>
         <include refid="selectXiaoyuanNoticeVo"/>
         where sender_id = #{senderId} order by create_time DESC
         where sender_id = #{senderId} order by create_time DESC
     </select>
     </select>
+    <select id="selectXiaoyuanNoticeByMyCollect" resultMap="XiaoyuanNoticeResult">
+        <include refid="selectXiaoyuanNoticeVo"/>
+        where collect like concat('%', #{collect}, '%') order by create_time DESC
+    </select>
 
 
     <insert id="insertXiaoyuanNotice" parameterType="XiaoyuanNotice" useGeneratedKeys="true" keyProperty="noticeId">
     <insert id="insertXiaoyuanNotice" parameterType="XiaoyuanNotice" useGeneratedKeys="true" keyProperty="noticeId">
         insert into xiaoyuan_notice
         insert into xiaoyuan_notice