ソースを参照

feat(message): 分页权限返回

huey 1 年間 前
コミット
6e55db6d05

+ 1 - 4
src/main/java/com/dragon/tj/portal/mapper/MessageInfoMapper.java

@@ -8,9 +8,6 @@ import com.baomidou.mybatisplus.core.mapper.BaseMapper;
 import org.apache.ibatis.annotations.Mapper;
 import org.apache.ibatis.annotations.Param;
 
-import java.util.List;
-import java.util.Map;
-
 /**
  * <p>
  * 信息表 Mapper 接口
@@ -22,7 +19,7 @@ import java.util.Map;
 @Mapper
 public interface MessageInfoMapper extends BaseMapper<MessageInfo> {
 
-    IPage<MessageInfo> queryPage(Page page,@Param("req") MessagePageParam req);
+    IPage<MessageInfo> queryPage(Page page, @Param("req") MessagePageParam req,@Param("idCard") String idCard);
 
     Integer  getCount(@Param("idCard") String idCard,@Param("readStatus") Integer readStatus);
 }

+ 1 - 4
src/main/java/com/dragon/tj/portal/mapper/NoticeInfoMapper.java

@@ -9,9 +9,6 @@ import com.baomidou.mybatisplus.core.mapper.BaseMapper;
 import org.apache.ibatis.annotations.Mapper;
 import org.apache.ibatis.annotations.Param;
 
-import java.util.List;
-import java.util.Map;
-
 /**
  * <p>
  * 消息表 Mapper 接口
@@ -23,7 +20,7 @@ import java.util.Map;
 @Mapper
 public interface NoticeInfoMapper extends BaseMapper<NoticeInfo> {
 
-    IPage<MessageInfo> queryPage(Page page,@Param("req") MessagePageParam req);
+    IPage<MessageInfo> queryPage(Page page, @Param("req") MessagePageParam req,@Param("idCard") String idCard);
 
     Integer  getCount(@Param("idCard") String idCard,@Param("readStatus") Integer readStatus);
 

+ 2 - 1
src/main/java/com/dragon/tj/portal/service/impl/MessageInfoServiceImpl.java

@@ -126,7 +126,8 @@ public class MessageInfoServiceImpl extends ServiceImpl<MessageInfoMapper, Messa
 
     @Override
     public IPage queryPage(Page page, MessagePageParam req) {
-        IPage<MessageInfo> queryPage = baseMapper.queryPage(page, req);
+        String idCard = SecurityUtils.getLoginUser().getIdCard();
+        IPage<MessageInfo> queryPage = baseMapper.queryPage(page, req,idCard);
         return queryPage;
     }
 

+ 3 - 1
src/main/java/com/dragon/tj/portal/service/impl/NoticeInfoServiceImpl.java

@@ -5,6 +5,7 @@ import com.alibaba.fastjson.JSON;
 import com.baomidou.mybatisplus.core.metadata.IPage;
 import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
 import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
+import com.dragon.tj.portal.auth.util.SecurityUtils;
 import com.dragon.tj.portal.common.base.R;
 import com.dragon.tj.portal.common.constants.BusinessConstants;
 import com.dragon.tj.portal.common.convert.notice.NoticeInfoVOConvert;
@@ -124,7 +125,8 @@ public class NoticeInfoServiceImpl extends ServiceImpl<NoticeInfoMapper, NoticeI
 
     @Override
     public IPage queryPage(Page page, MessagePageParam req) {
-        IPage<MessageInfo> queryPage = baseMapper.queryPage(page, req);
+        String idCard = SecurityUtils.getLoginUser().getIdCard();
+        IPage<MessageInfo> queryPage = baseMapper.queryPage(page, req,idCard);
         return queryPage;
     }
 

+ 3 - 0
src/main/resources/mapper/MessageInfoMapper.xml

@@ -13,6 +13,9 @@
         <if test="req.title != null and req.title != ''">
             and b.title = #{req.title}
         </if>
+        <if test="idCard != null and idCard != ''">
+            and a.member_id = #{idCard}
+        </if>
         <if test="req.content != null and req.content != ''">
             and b.content = #{req.content}
         </if>

+ 3 - 0
src/main/resources/mapper/NoticeInfoMapper.xml

@@ -15,6 +15,9 @@
         <if test="req.title != null and req.title != ''">
             and b.title = #{req.title}
         </if>
+        <if test="idCard != null and idCard != ''">
+            and a.member_id = #{idCard}
+        </if>
         <if test="req.content != null and req.content != ''">
             and b.content = #{req.content}
         </if>