Browse Source

消息已读

sunhh 1 year ago
parent
commit
393aa89986

+ 1 - 1
business-service/src/main/java/com/ozs/service/mapper/MsgAppPushMapper.java

@@ -34,7 +34,7 @@ public interface MsgAppPushMapper extends BaseMapper<MsgAppPush> {
      * @param updateBy
      * @return
      */
-    public int update(@Param("id") Long id, @Param("status") Integer status, @Param("updateBy") String updateBy);
+    int update(MsgAppPush msgAppPush);
 
     List<MsgAlarm> messageMoreApp(MsgAlarmVo msgAlarmVo);
 }

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

@@ -33,6 +33,6 @@ public interface MsgAppPushService extends IService<MsgAppPush> {
      * @param updateBy
      * @return
      */
-    int update(Long id, Integer status, String updateBy);
+    int update(MsgAppPush msgAppPush);
 
 }

+ 2 - 2
business-service/src/main/java/com/ozs/service/service/impl/MsgAppPushServiceImpl.java

@@ -76,8 +76,8 @@ public class MsgAppPushServiceImpl extends ServiceImpl<MsgAppPushMapper, MsgAppP
     }
 
     @Override
-    public int update(Long id, Integer status, String updateBy) {
-        int num = msgAppPushMapper.update(id, status, updateBy);
+    public int update(MsgAppPush msgAppPush) {
+        int num = msgAppPushMapper.update(msgAppPush);
         return num;
     }
 }

+ 15 - 4
business-service/src/main/resources/mapper/service/MsgAppPushMapper.xml

@@ -71,15 +71,26 @@
     <update id="update" parameterType="com.ozs.service.entity.MsgAppPush">
         update msg_app_push
         <set>
-            <if test="status != null and status != 0">status = #{status},</if>
-            <if test="updateBy != null and updateBy != ''">update_by = #{updateBy},</if>
+            <if test="status != null and status != 0">
+                status = #{status},
+            </if>
+            <if test="updateBy != null and updateBy != ''">
+                update_by = #{updateBy},
+            </if>
             update_time = sysdate()
         </set>
-        where concat(push_id,id) = #{id}
+        <where>
+            <if test="pushId != null and pushId != ''">
+                and push_id = #{pushId}
+            </if>
+            <if test="id != null and id != 0">
+                and push_id = #{id}
+            </if>
+        </where>
     </update>
 
     <select id="messageMoreApp" parameterType="com.ozs.service.entity.vo.MsgAlarmVo" resultType="com.ozs.service.entity.MsgAlarm">
-        select b.*, a.status, a.id as msgId
+        select b.*, a.status, a.push_id as msgId
         from msg_app_push AS a
         join msg_alarm AS b on a.alarm_id = b.alarm_id
         join base_camera_management AS c on b.camera_code = c.camera_code

+ 9 - 2
business-service/src/main/resources/mapper/service/MsgWebPushMapper.xml

@@ -20,7 +20,7 @@
     </select>
 
     <select id="messageMore" parameterType="com.ozs.service.entity.vo.MsgAlarmVo" resultType="com.ozs.service.entity.MsgAlarm">
-        select b.*, a.status, a.id as msgId
+        select b.*, a.status, a.push_id as msgId
         from msg_web_push AS a
         join msg_alarm AS b on a.alarm_id = b.alarm_id
         join base_camera_management AS c on b.camera_code = c.camera_code
@@ -71,7 +71,14 @@
                 status = #{status}
             </if>
         </set>
-        where concat(push_id,id) = #{pushId}
+        <where>
+            <if test="pushId != null and pushId != ''">
+                and push_id = #{pushId}
+            </if>
+            <if test="id != null and id != 0">
+                and id = #{id}
+            </if>
+        </where>
     </update>
 
     <update id="readAll" parameterType="java.lang.String">

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

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

+ 2 - 2
hazard-admin/src/main/java/com/ozs/web/controller/app/GeoHazardMineController.java

@@ -123,8 +123,8 @@ public class GeoHazardMineController extends BaseController {
     @RequestMapping(value = "/update", method = RequestMethod.POST)
     @ApiOperation("app推送报警信息记录修改状态")
     public AjaxResult update(@RequestBody MsgAppPush msgAppPush) {
-        String userName = getUsername();
-        msgAppPushService.update(msgAppPush.getId(), msgAppPush.getStatus(), userName);
+        msgAppPush.setUpdateBy(getUsername());
+        msgAppPushService.update(msgAppPush);
         return AjaxResult.success();
     }
 }