Переглянути джерело

通知,全部已读和部分已读功能开发

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

+ 17 - 1
jeeplus-plugins/jeeplus-flowable/src/main/java/com/jeeplus/flowable/controller/MyNoticeController.java

@@ -1,6 +1,8 @@
 package com.jeeplus.flowable.controller;
 
 import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
+import com.google.common.collect.Lists;
+import com.jeeplus.aop.logging.annotation.ApiLog;
 import com.jeeplus.flowable.model.Flow;
 import com.jeeplus.flowable.model.MyNoticeList;
 import com.jeeplus.flowable.service.MyNoticeService;
@@ -11,6 +13,7 @@ import io.swagger.annotations.Api;
 import io.swagger.annotations.ApiOperation;
 import org.flowable.task.api.Task;
 import org.springframework.http.ResponseEntity;
+import org.springframework.security.access.prepost.PreAuthorize;
 import org.springframework.web.bind.annotation.*;
 
 import javax.annotation.Resource;
@@ -43,8 +46,21 @@ public class MyNoticeController {
         return service.update(taskId, noticeId);
     }
 
+    /**
+     * 部分标记为已读
+     * @param ids
+     * @return
+     */
+    @ApiLog("部分标记为已读")
+    @PostMapping("portionRead")
+    public ResponseEntity portionRead(String ids) {
+        String idArray[] =ids.split(",");
+        service.portionRead (Lists.newArrayList (idArray));
+        return ResponseEntity.ok ("部分标记为已读成功");
+    }
+
     @ApiOperation(value = "全部标记已读")
-    @GetMapping("/readAll")
+    @PostMapping("/readAll")
     public String readAll() {
         return service.readAll();
     }

+ 9 - 0
jeeplus-plugins/jeeplus-flowable/src/main/java/com/jeeplus/flowable/mapper/MyNoticeListMapper.java

@@ -8,6 +8,8 @@ import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
 import com.jeeplus.flowable.model.MyNoticeList;
 import org.apache.ibatis.annotations.Param;
 
+import java.util.List;
+
 public interface MyNoticeListMapper extends BaseMapper<MyNoticeList> {
 
     void readAll(@Param("name") String name);
@@ -39,4 +41,11 @@ public interface MyNoticeListMapper extends BaseMapper<MyNoticeList> {
      */
     void updateMyNotice(MyNoticeList myNoticeList);
 
+    /**
+     * 部分通知变更为已读
+     * @param idList
+     * @return
+     */
+    void portionRead(List idList);
+
 }

+ 13 - 0
jeeplus-plugins/jeeplus-flowable/src/main/java/com/jeeplus/flowable/mapper/xml/MyNoticeListMapper.xml

@@ -110,4 +110,17 @@
 		repetition_count = #{repetitionCount}
 		where id = #{id}
 	</update>
+
+
+	<update id="portionRead">
+		UPDATE my_notice_list
+			SET type = 1
+		<where>
+			del_flag = 0
+			and id in
+			<foreach collection="idList" open="(" close=")" separator="," item="id">
+				#{id}
+			</foreach>
+		</where>
+	</update>
 </mapper>

+ 11 - 0
jeeplus-plugins/jeeplus-flowable/src/main/java/com/jeeplus/flowable/service/MyNoticeService.java

@@ -168,4 +168,15 @@ public class MyNoticeService {
     public void updateMyNotice(MyNoticeList myNoticeList){
         mapper.updateMyNotice(myNoticeList);
     }
+
+    /**
+     * 根据通知信息查询数据
+     * @param idList
+     * @return
+     */
+    public void portionRead(List<String> idList){
+        if(null != idList && idList.size()>0){
+            mapper.portionRead(idList);
+        }
+    }
 }