Browse Source

消息已读

sunhh 1 year ago
parent
commit
21671b2231

+ 2 - 0
business-service/src/main/java/com/ozs/service/mapper/MsgWebPushMapper.java

@@ -23,4 +23,6 @@ public interface MsgWebPushMapper extends BaseMapper<MsgWebPush> {
     List<MsgAlarm> messageMore(MsgAlarmVo msgAlarmVo);
 
     Map<String, Integer> messageMoreNum(@Param("userId") String userId);
+
+    int updateByPushId(MsgWebPush msgWebPush);
 }

+ 1 - 1
business-service/src/main/java/com/ozs/service/service/impl/MsgWebPushServiceImpl.java

@@ -43,7 +43,7 @@ public class MsgWebPushServiceImpl extends ServiceImpl<MsgWebPushMapper, MsgWebP
     public int read(MsgWebPush msgWebPush) {
         // 状态:1未读;2已读
         msgWebPush.setStatus(2);
-        return msgWebPushMapper.updateById(msgWebPush);
+        return msgWebPushMapper.updateByPushId(msgWebPush);
     }
 
     @Override

+ 10 - 0
business-service/src/main/resources/mapper/service/MsgWebPushMapper.xml

@@ -64,4 +64,14 @@
             </if>
         </where>
     </select>
+
+    <update id="updateByPushId" parameterType="com.ozs.service.entity.MsgWebPush">
+        update msg_web_push
+        <set>
+            <if test="status != null and status != 0">
+                status = #{status}
+            </if>
+        </set>
+        where push_id = #{pushId}
+    </update>
 </mapper>

+ 2 - 2
hazard-admin/src/main/java/com/ozs/web/controller/accountmanagment/MsgAlarmController.java

@@ -136,8 +136,8 @@ public class MsgAlarmController extends BaseController {
     @ApiOperation(value = "web消息已读")
     @Log(title = "报警信息管理", businessType = BusinessType.SELECT)
     public AjaxResult read(@RequestBody MsgWebPush msgWebPush) {
-        if (StringUtils.isEmpty(msgWebPush) || StringUtils.isEmpty(msgWebPush.getId())) {
-            return AjaxResult.error("主键ID不能为空!");
+        if (StringUtils.isEmpty(msgWebPush) || StringUtils.isEmpty(msgWebPush.getPushId())) {
+            return AjaxResult.error("PushId不能为空!");
         }
         return toAjax(msgWebPushService.read(msgWebPush));
     }