‘linchangsheng’ 5 months ago
parent
commit
973e9ef677

+ 10 - 0
mall-server-api/src/main/java/com/gree/mall/manager/controller/notice/NoticeWebsitController.java

@@ -142,6 +142,16 @@ public class NoticeWebsitController {
         return ResponseHelper.success();
     }
 
+    @PostMapping("/mark/readOne")
+    @ApiOperation(value = "标记一条已读")
+    public ResponseHelper readOne(
+            @ApiParam(value = "通知消息id数组", required = true) @RequestParam List<String> id
+    ) throws Exception {
+        noticeWebsitLogic.readOne(id);
+        return ResponseHelper.success();
+    }
+
+
 
     @PostMapping("/mark/read/all")
     @ApiOperation(value = "全部标记已读")

+ 21 - 0
mall-server-api/src/main/java/com/gree/mall/manager/logic/notice/NoticeWebsitLogic.java

@@ -198,4 +198,25 @@ public class NoticeWebsitLogic {
                     .update();
         }
     }
+
+    public void readOne(List<String> id) {
+
+        AdminUserCom adminUser = commonLogic.getAdminUser();
+        noticeWebsitRecordService.lambdaUpdate()
+                .in(NoticeWebsitRecord::getId,id)
+                .in(!CollectionUtils.isEmpty(adminUser.getAdminWebsitIds()),NoticeWebsitRecord::getAdminWebsitId, adminUser.getAdminWebsitIds())
+                .set(NoticeWebsitRecord::getReadFlag, IsYesNoEnum.YES.getKey())
+                .set(NoticeWebsitRecord::getReadTime, new Date())
+                .update();
+
+        for (String idOne : id) {
+
+            NoticeWebsitRecord noticeWebsitRecord = noticeWebsitRecordService.getById(idOne);
+            NoticeWebsit one = noticeWebsitService.getById(noticeWebsitRecord.getNoticeWebsitId());
+            if (one != null){
+                one.setNum(one.getNum()+1);
+                one.updateById();
+            }
+        }
+    }
 }

+ 9 - 0
mall-server-api/src/main/resources/mapper/NoticeRecordBeanMapper.xml

@@ -86,6 +86,7 @@
         a.*
         FROM
         notice_websit a
+        join notice_websit_record b on a.notice_websit_id = b.notice_websit_id
         ${ex.query}
         <if test="adminCompanyIds != null and adminCompanyIds.size > 0">
             and a.company_wechat_id  in
@@ -94,10 +95,18 @@
                 #{item}
             </foreach>
         </if>
+        <if test="ex.adminWebsitIds != null and ex.adminWebsitIds.size > 0">
+            AND b.admin_websit_id IN
+            <foreach item="item" index="index" collection="ex.adminWebsitIds" open="(" separator="," close=")">
+                #{item}
+            </foreach>
+        </if>
         ${ex.orderBy}
+        group by a.notice_websit_id
         <if test="ex.orderBy == null or  ex.orderBy == ''">
             order by a.create_time desc
         </if>
+
     </select>
     <select id="listWebsit" resultType="com.gree.mall.manager.bean.notice.NoticeWebsitRecordVO">
         SELECT