user5 2 роки тому
батько
коміт
a431b5ba16

+ 10 - 0
jeeplus-plugins/jeeplus-notify/src/main/java/com/jeeplus/notify/controller/NotifyController.java

@@ -51,6 +51,16 @@ public class NotifyController {
     }
 
     /**
+     * 通告列表数据(通知栏)
+     */
+    @GetMapping("myNotifyList")
+    public ResponseEntity myNotifyData(NotifyDTO notifyDTO, boolean isSelf, Page <NotifyDTO> page) throws Exception {
+        QueryWrapper <NotifyDTO> queryWrapper = QueryWrapperGenerator.buildQueryCondition ( notifyDTO, NotifyDTO.class );
+        IPage <NotifyDTO> result = notifyService.myNotifyDataFindPage ( page, UserUtils.getCurrentUserDTO ( ).getId ( ), isSelf, null, queryWrapper );
+        return ResponseEntity.ok ( result );
+    }
+
+    /**
      * 查询数据
      */
     @GetMapping("queryById")

+ 12 - 0
jeeplus-plugins/jeeplus-notify/src/main/java/com/jeeplus/notify/mapper/NotifyMapper.java

@@ -45,6 +45,18 @@ public interface NotifyMapper extends BaseMapper <Notify> {
                                @Param("readFlag") String readFlag,
                                @Param(Constants.WRAPPER) QueryWrapper queryWrapper);
 
+    /**
+     * 获取列表
+     *
+     * @param queryWrapper
+     * @return
+     */
+    IPage <NotifyDTO> myNotifyDataFindList(Page <NotifyDTO> page,
+                               @Param ( "currentUserId" ) String currentUserId,
+                               @Param ( "isSelf" ) boolean isSelf,
+                               @Param("readFlag") String readFlag,
+                               @Param(Constants.WRAPPER) QueryWrapper queryWrapper);
+
     void updateStatusById(@Param ( "id" ) String id, @Param ( "status" ) String status);
 
     void updateContentById(@Param ( "content" ) String content, @Param ( "id" ) String id);

+ 23 - 0
jeeplus-plugins/jeeplus-notify/src/main/java/com/jeeplus/notify/mapper/xml/NotifyMapper.xml

@@ -197,6 +197,29 @@
         order by a.create_date desc
     </select>
 
+    <select id="myNotifyDataFindList" resultMap="BaseResultMap">
+        SELECT
+        <include refid="notifyColumns"/>
+        <if test="isSelf">,
+            r.read_flag
+        </if>
+        FROM plugin_notify a
+        LEFT JOIN sys_user u ON u.id = a.CREATE_BY AND u.del_flag = '0'
+        <include refid="notifyJoins"/>
+        <!-- 我的通知 -->
+        <if test="isSelf">
+            JOIN plugin_notify_record r ON r.notify_id = a.id AND r.user_id = #{currentUserId} AND r.del_flag = 0
+            <if test="readFlag != null and readFlag != ''">
+                AND r.read_flag = #{readFlag}
+            </if>
+        </if>
+        ${ew.customSqlSegment}
+        <if test="isSelf">
+            and ((a.notify_type = 0 and NOW() >= a.begin_date and NOW() &lt;= a.end_date) or a.notify_type = 1)
+        </if>
+        order by a.create_date desc
+    </select>
+
 
 
     <select id="findCount" resultType="Long">

+ 12 - 0
jeeplus-plugins/jeeplus-notify/src/main/java/com/jeeplus/notify/service/NotifyService.java

@@ -100,6 +100,18 @@ public class NotifyService extends ServiceImpl <NotifyMapper, Notify> {
     }
 
     /**
+     * 自定义分页检索
+     *
+     * @param page
+     * @param queryWrapper
+     * @return
+     */
+    public IPage <NotifyDTO> myNotifyDataFindPage(Page <NotifyDTO> page, String currentUserId, boolean isSelf, String readFlag, QueryWrapper queryWrapper) {
+        queryWrapper.eq ( "a.del_flag", 0 ); // 排除已经删除
+        return baseMapper.myNotifyDataFindList ( page, currentUserId, isSelf, readFlag, queryWrapper );
+    }
+
+    /**
      * 获取通知发送记录
      *
      * @param id